21720:
[arvados.git] / services / workbench2 / cypress / e2e / page-not-found.cy.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     it('shows not found page', function() {
17         // when
18         cy.loginAs(adminUser);
19         cy.goToPath(`/this/is/an/invalid/route`);
20
21         // then
22         cy.get('[data-cy=not-found-page]').should('exist');
23         cy.get('[data-cy=not-found-content]').should('exist');
24     });
25
26
27     it('shows not found popup', function() {
28         // given
29         [
30             '/projects/zzzzz-j7d0g-nonexistingproj',
31             '/projects/zzzzz-tpzed-nonexistinguser',
32         ].forEach(function(path) {
33             // Using de slower loginAs() method to avoid bumping into dialog
34             // dismissal issues that are not related to this test.
35             cy.loginAs(adminUser);
36
37             // when
38             cy.goToPath(path);
39
40             // then
41             cy.get('[data-cy=default-view]').should('exist');
42         });
43
44         [
45             '/processes/zzzzz-xvhdp-nonexistingproc',
46             '/collections/zzzzz-4zz18-nonexistingcoll'
47         ].forEach(function(path) {
48             cy.loginAs(adminUser);
49
50             cy.goToPath(path);
51
52             cy.get('[data-cy=not-found-view]').should('exist');
53         });
54     });
55 })