Details
- Reviewers
anlambert - Group Reviewers
Reviewers - Commits
- rDWAPPS3feeb9fc12f2: cypress: Add error tests
Diff Detail
- Repository
- rDWAPPS Web applications
- Branch
- errorTest
- Lint
No Linters Available - Unit
No Unit Test Coverage - Build Status
Buildable 6653 Build 9295: tox-on-jenkins Jenkins Build 9294: arc lint + arc unit
Event Timeline
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/544/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/558/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/559/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/563/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/565/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/569/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/570/ for more details.
Great work, thanks !
Before landing this, I want you to remove the harcoded swh-web urls in tests implementation (see commit ea8796c I just pushed for examples and my inline comments).
The idea is to use the Urls global javascript object allowing to manipulate named urls instead of raw ones.
This object is made available by the django-js-reverse extension we are using in swh-web.
For each named Django view, it adds a function in the Urls that will generate the raw url from its name and its required arguments.
This way, if we modify a raw url in Python code, we will not need to modify it in the cypress tests implementation.
cypress/integration/errors.spec.js | ||
---|---|---|
38 | Here, you must add the following global variable declaration: let Urls; | |
39 | Then add a before hook to get the Urls global object from swh-web: before(function() { cy.visit('/').window().then(win => { Urls = win.Urls; }); }); | |
41 | Replace this line with: const url = Urls.browse_origin_directory(unarchivedRepo.url); And do the same in tests below. The naming scheme for the functions of the Urls object is quite straightforward:
where <object_type> can be one of: content, directory, snapshot, ... | |
137 | Replace this line with: const url = Urls[`browse_${type}`](invalidChecksum) |
@anlambert Thank you for the improvements. I think, it will be even better if we declare Urls object in cypress/support/index.js, no need to repeat in every spec file
Thank you for the improvements. I think, it will be even better if we declare Urls object in cypress/support/index.js, no need to repeat in every spec file
Thanks for pointing me to this, I was looking for such a feature yesterday but I missed it in the documentation.
I will commit the improvement today.
@kalpitk , the Urls variable is now set globally in the support file (958fd1da20e9). You can access it through this.Urls in tests implementation.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/575/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/576/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/578/ for more details.
Build is green
See https://jenkins.softwareheritage.org/job/DWAPPS/job/tox/579/ for more details.