Page MenuHomeSoftware Heritage

cypress/layout: Fix cypress anti-pattern use
ClosedPublic

Authored by anlambert on Jul 8 2021, 7:09 PM.

Details

Summary

Cypress commands should not be invoked in a loop as it is an anti-pattern
that can produce flaky tests.

Diff Detail

Repository
rDWAPPS Web applications
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

Build is green

Patch application report for D5982 (id=21563)

Rebasing onto 25c639f292...

Current branch diff-target is up to date.
Changes applied before test
commit a9688b3a981847d71c56e340c25f743c94a8d85a
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Thu Jul 8 19:08:14 2021 +0200

    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.

See https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/957/ for more details.

ardumont added a subscriber: ardumont.

lgtm

cypress/integration/layout.spec.js
185

I guess those calls could have been made in a loop though, right?

(just asking out of curiosity, not asking you to change anything ;)

This revision is now accepted and ready to land.Jul 9 2021, 11:50 AM
cypress/integration/layout.spec.js
185

The thing is that we can't use for loops with cypress because of its async nature.
Cypress doesn't wait for everything to complete in the loop before starting the loop again.

cypress/integration/layout.spec.js
185

ah yes, thx!