|
1 | 1 | /* eslint-disable no-undef */
|
2 |
| -describe('GTL', () => { |
| 2 | +describe('Settings > My Settings', () => { |
3 | 3 | beforeEach(() => {
|
4 | 4 | cy.login();
|
| 5 | + cy.menu('Settings', 'My Settings'); |
| 6 | + }); |
| 7 | + |
| 8 | + it('Saves the start page setting', () => { |
| 9 | + cy.get('#display\\.startpage').then((value) => { |
| 10 | + expect(value[0].value).to.be.oneOf(['', 'Overview / Dashboard']); |
| 11 | + }); |
| 12 | + cy.changeSelect('display\\.startpage', 'Overview / Utilization'); |
| 13 | + cy.intercept('PATCH', '/api/users/1').as('settingsUpdate'); |
| 14 | + cy.contains('button', 'Save').click(); |
| 15 | + cy.wait('@settingsUpdate').its('response.statusCode').should('eq', 200); |
| 16 | + |
| 17 | + // Wait for page to load before clicking log out to prevent errors |
| 18 | + cy.get('#view\.compare'); |
| 19 | + cy.get('#menu_item_logout').click(); |
| 20 | + cy.login(); |
| 21 | + cy.url().should('include', '/utilization'); |
| 22 | + |
| 23 | + cy.menu('Settings', 'My Settings'); |
| 24 | + cy.get('#display\\.startpage').then((value) => { |
| 25 | + expect(value[0].value).to.equal('Overview / Utilization'); |
| 26 | + }); |
| 27 | + cy.changeSelect('display\\.startpage', 'Overview / Dashboard'); |
| 28 | + cy.intercept('PATCH', '/api/users/1').as('settingsUpdate'); |
| 29 | + cy.contains('button', 'Save').click(); |
| 30 | + cy.wait('@settingsUpdate').its('response.statusCode').should('eq', 200); |
| 31 | + |
| 32 | + cy.get('#menu_item_logout').click(); |
| 33 | + cy.login(); |
| 34 | + cy.url().should('include', '/dashboard'); |
5 | 35 | });
|
6 | 36 | });
|
0 commit comments