cypress/layout: Fix cypress anti-pattern use
Cypress commands should not be invoked in a loop as it is an anti-pattern that can produce flaky tests.