19153: Fix project cypress test
[arvados-workbench2.git] / cypress / integration / page-not-found.spec.js
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 describe('Page not found tests', function() {
6     let adminUser;
7
8     before(function() {
9         cy.getUser('admin', 'Admin', 'User', true, true)
10             .as('adminUser').then(function() {
11                 adminUser = this.adminUser;
12             }
13         );
14     });
15
16     beforeEach(function() {
17         cy.clearCookies()
18         cy.clearLocalStorage()
19     });
20
21     it('shows not found page', function() {
22         // when
23         cy.loginAs(adminUser);
24         cy.goToPath(`/this/is/an/invalid/route`);
25
26         // then
27         cy.get('[data-cy=not-found-page]').should('exist');
28         cy.get('[data-cy=not-found-content]').should('exist');
29     });
30
31
32     it('shows not found popup', function() {
33         // given
34         [
35             '/projects/zzzzz-j7d0g-nonexistingproj',
36             '/projects/zzzzz-tpzed-nonexistinguser',
37             '/processes/zzzzz-xvhdp-nonexistingproc',
38             '/collections/zzzzz-4zz18-nonexistingcoll'
39         ].forEach(function(path) {
40             // Using de slower loginAs() method to avoid bumping into dialog
41             // dismissal issues that are not related to this test.
42             cy.loginAs(adminUser);
43
44             // when
45             cy.goToPath(path);
46
47             // then
48             cy.get('[data-cy=not-found-page]').should('not.exist');
49             cy.get('[data-cy=not-found-content]').should('exist');
50         });
51     });
52 })