|
| 1 | +describe('Angular app', () => { |
| 2 | + beforeEach(() => { |
| 3 | + window.sessionStorage.clear(); |
| 4 | + }); |
| 5 | + |
| 6 | + it('loads', () => { |
| 7 | + cy.visit(''); |
| 8 | + }); |
| 9 | + |
| 10 | + it('loads home state by default', () => { |
| 11 | + cy.visit(''); |
| 12 | + cy.url().should('include', '/home'); |
| 13 | + }); |
| 14 | + |
| 15 | + it('renders uisref as links', () => { |
| 16 | + cy.visit(''); |
| 17 | + cy.get('a').contains('home'); |
| 18 | + cy.get('a').contains('about'); |
| 19 | + cy.get('a').contains('lazy'); |
| 20 | + cy.get('a').contains('lazy.child'); |
| 21 | + cy.get('a').contains('lazy.child.viewtarget'); |
| 22 | + }); |
| 23 | + |
| 24 | + it('renders home', () => { |
| 25 | + cy.visit('/home'); |
| 26 | + cy.get('a').contains('home').should('have.class', 'active'); |
| 27 | + cy.get('a').contains('about').should('not.have.class', 'active'); |
| 28 | + cy.get('#default').contains('home works'); |
| 29 | + }); |
| 30 | + |
| 31 | + it('renders about', () => { |
| 32 | + cy.visit('/home'); |
| 33 | + cy.visit('/about'); |
| 34 | + cy.get('a').contains('home').should('not.have.class', 'active'); |
| 35 | + cy.get('a').contains('about').should('have.class', 'active'); |
| 36 | + cy.get('#default').contains('about works'); |
| 37 | + }); |
| 38 | + |
| 39 | + it('loads lazy routes', () => { |
| 40 | + cy.visit('/home'); |
| 41 | + cy.visit('/lazy'); |
| 42 | + cy.get('a').contains('home').should('not.have.class', 'active'); |
| 43 | + cy.get('a').contains('lazy').should('have.class', 'active'); |
| 44 | + cy.get('#default').contains('lazy works'); |
| 45 | + }); |
| 46 | + |
| 47 | + it('routes to lazy routes', () => { |
| 48 | + cy.visit('/lazy'); |
| 49 | + cy.get('a').contains('home').should('not.have.class', 'active'); |
| 50 | + cy.get('a').contains('lazy').should('have.class', 'active'); |
| 51 | + cy.get('#default').contains('lazy works'); |
| 52 | + }); |
| 53 | + |
| 54 | + it('routes to lazy child routes', () => { |
| 55 | + cy.visit('/lazy/child'); |
| 56 | + cy.get('a').contains('home').should('not.have.class', 'active'); |
| 57 | + cy.get('a').contains('lazy.child').should('have.class', 'active'); |
| 58 | + cy.get('#default').contains('lazy.child works'); |
| 59 | + }); |
| 60 | + |
| 61 | + it('targets named views', () => { |
| 62 | + cy.visit('/lazy/child/viewtarget'); |
| 63 | + cy.get('a').contains('home').should('not.have.class', 'active'); |
| 64 | + cy.get('a').contains('lazy.child').should('have.class', 'active'); |
| 65 | + cy.get('#default').contains('lazy.child works'); |
| 66 | + cy.get('#header').contains('lazy.child.viewtarget works'); |
| 67 | + cy.get('#footer').contains('lazy.child.viewtarget works'); |
| 68 | + }); |
| 69 | +}); |
0 commit comments