-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
app.spec.ts
56 lines (49 loc) · 1.65 KB
/
app.spec.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {
getToolbar,
getText,
getNavigationLinks,
getToggleButton,
getRestrictionLabel,
} from '../support/app.po';
describe('route-restrictions', () => {
it('should display home page text', () => {
cy.visit('/');
getToolbar().contains('Route restrictions');
getText().contains('This route is OPEN');
getToggleButton().should('be.visible');
});
it('should display toggle button and restriction', () => {
cy.visit('/');
getToggleButton().should('be.visible');
getRestrictionLabel().should('contain.text', 'OFF');
});
it('should toggle restriction on toggle click', () => {
cy.visit('/');
getRestrictionLabel().should('contain.text', 'OFF');
getToggleButton().click();
getRestrictionLabel().should('contain.text', 'ON');
});
it('should display restrictions page text', () => {
cy.visit('/restricted');
getText().contains('This route is restricted');
});
it('should switch to restrictions on nav click', () => {
cy.visit('/');
getNavigationLinks().eq(1).click();
cy.url().should('eq', 'http://localhost:4200/restricted');
getText().contains('This route is restricted');
});
it('should redirect to home page when restriction is set', () => {
cy.visit('/restricted');
getToggleButton().click();
cy.url().should('eq', 'http://localhost:4200/');
getText().contains('This route is OPEN');
});
it('should redirect to home page when restriction is set on nav click', () => {
cy.visit('/');
getToggleButton().click();
getNavigationLinks().eq(1).click();
cy.url().should('eq', 'http://localhost:4200/');
getText().contains('This route is OPEN');
});
});