Page MenuHomeSoftware Heritage

cypress: Generate tests data once and get them through a task
ClosedPublic

Authored by anlambert on Mar 15 2022, 6:31 PM.

Details

Summary

Some cypress tests use input data generated before each test suite.

Some of these data are retrieved by sending HTTP requests to the
Software Heritage Web API, which can take some times, especially
when repeating that processing before each test suite.

So instead of sending those HTTP requests before each test suite,
prefer to do it once and put the test data in global cache. Those
data will then be set to test suite scope through the use of a
custom cypress task.

Depends on D7353

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 has FAILED

Patch application report for D7355 (id=26577)

Could not rebase; Attempt merge onto 5bc77709cb...

Updating 5bc77709..627ba79a
Fast-forward
 cypress/integration/content-display.spec.js |   7 +-
 cypress/plugins/index.js                    | 105 +++++++++++++++++++++++-
 cypress/support/index.js                    | 119 ++++++----------------------
 cypress/utils/index.js                      |   9 +--
 4 files changed, 136 insertions(+), 104 deletions(-)
Changes applied before test
commit 627ba79a1d7bf02ac168ae1d39da0dd75af077a2
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 18:23:17 2022 +0100

    cypress: Generate tests data once and get them through a task
    
    Some cypress tests use input data generated before each test suite.
    
    Some of these data are retrieved by sending HTTP requests to the
    Software Heritage Web API, which can take some times, especially
    when repeating that processing before each test suite.
    
    So instead of sending those HTTP requests before each test suite,
    prefer to do it once and put the test data in global cache. Those
    data will then be set to test suite scope through the use of a
    custom cypress task.

commit 2b1ae26939787f7a84a851a1a5f05a0951482b2c
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 17:07:36 2022 +0100

    cypress: Add missing global intercept for https://status.swh.org
    
    Each time a swh-web HTML page is loaded, an HTTP request is sent to
    https://status.softwareheritage.org for getting the data needed to
    display the status widget in the top right of the Web UI.
    
    That request was not globally intercepted by cypress resulting in
    making real HTTP requests on the internet while executing tests.
    As a consequence, this was slowing down the whole testing process.
    
    So ensure that request is globally intercepted to speedup tests
    execution.

Link to build: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1460/
See console output for more information: https://jenkins.softwareheritage.org/job/DWAPPS/job/tests-on-diff/1460/console

Harbormaster returned this revision to the author for changes because remote builds failed.Mar 15 2022, 6:33 PM
Harbormaster failed remote builds in B27457: Diff 26577!

Build is green

Patch application report for D7355 (id=26577)

Could not rebase; Attempt merge onto 5bc77709cb...

Updating 5bc77709..627ba79a
Fast-forward
 cypress/integration/content-display.spec.js |   7 +-
 cypress/plugins/index.js                    | 105 +++++++++++++++++++++++-
 cypress/support/index.js                    | 119 ++++++----------------------
 cypress/utils/index.js                      |   9 +--
 4 files changed, 136 insertions(+), 104 deletions(-)
Changes applied before test
commit 627ba79a1d7bf02ac168ae1d39da0dd75af077a2
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 18:23:17 2022 +0100

    cypress: Generate tests data once and get them through a task
    
    Some cypress tests use input data generated before each test suite.
    
    Some of these data are retrieved by sending HTTP requests to the
    Software Heritage Web API, which can take some times, especially
    when repeating that processing before each test suite.
    
    So instead of sending those HTTP requests before each test suite,
    prefer to do it once and put the test data in global cache. Those
    data will then be set to test suite scope through the use of a
    custom cypress task.

commit 2b1ae26939787f7a84a851a1a5f05a0951482b2c
Author: Antoine Lambert <anlambert@softwareheritage.org>
Date:   Tue Mar 15 17:07:36 2022 +0100

    cypress: Add missing global intercept for https://status.swh.org
    
    Each time a swh-web HTML page is loaded, an HTTP request is sent to
    https://status.softwareheritage.org for getting the data needed to
    display the status widget in the top right of the Web UI.
    
    That request was not globally intercepted by cypress resulting in
    making real HTTP requests on the internet while executing tests.
    As a consequence, this was slowing down the whole testing process.
    
    So ensure that request is globally intercepted to speedup tests
    execution.

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

This revision is now accepted and ready to land.Mar 16 2022, 10:21 AM