17266: Avoids reloading the app on cypress tests by using search.
[arvados.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         // given
23         const invalidUUID = '1212r12r12r12r12r12r21r'
24
25         // when
26         cy.loginAs(adminUser);
27         cy.visit(`/collections/${invalidUUID}`);
28
29         // then
30         cy.get('[data-cy=not-found-page]').should('exist');
31         cy.get('[data-cy=not-found-content]').should('exist');
32     });
33
34
35     it('shows not found popup', function() {
36         // given
37         const notExistingUUID = 'zzzzz-tpzed-5o5tg0l9a57gxxx';
38
39         // when
40         cy.loginAs(adminUser);
41         cy.visit(`/projects/${notExistingUUID}`);
42
43         // then
44         cy.get('[data-cy=not-found-page]').should('not.exist');
45         cy.get('[data-cy=not-found-content]').should('exist');
46     });
47 })