Skip to content

Commit

Permalink
refactor: move E2E timeout value to central call
Browse files Browse the repository at this point in the history
  • Loading branch information
Raphael Kabo committed Dec 13, 2023
1 parent 4cca971 commit 6e81877
Showing 1 changed file with 11 additions and 30 deletions.
41 changes: 11 additions & 30 deletions cypress/tests/e2e/e2e.cy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,63 +2,49 @@ import { signInOkta } from '../../lib/signInOkta';

describe('E2E with Okta', () => {
beforeEach(() => {
Cypress.config('defaultCommandTimeout', 30_000);

cy.clearAllCookies();
signInOkta();
cy.get('h1', {
timeout: 30000,
}).should('contain', 'Account overview');
cy.get('h1').should('contain', 'Account overview');
});

context('account overview tab', () => {
it('should contain an email address', () => {
cy.findByText('Email address', {
timeout: 30000,
});
cy.findByText('Email address');
});
});

context('profile tab', () => {
it('should contain a username', () => {
cy.visit('/public-settings');
cy.findByText('Username', {
timeout: 30000,
});
cy.findByText('Username');
});
});

context('emails tab', () => {
it('should allow the user to update their email preferences', () => {
cy.visit('/email-prefs');
cy.findByText('Guardian products and support', {
timeout: 30000,
}).click();
cy.findByText('Guardian products and support').click();
cy.visit('/email-prefs');
cy.findByText('Guardian products and support', {
timeout: 30000,
})
cy.findByText('Guardian products and support')
.parents('div')
.get('input[type="checkbox"]')
.should('be.checked');
});

it('should allow the user to unsubscribe from all emails', () => {
cy.visit('/email-prefs');
cy.findByText('Unsubscribe from all emails', {
timeout: 30000,
}).click();
cy.findByText('Unsubscribe from all emails').click();
cy.visit('/email-prefs');
cy.get('input[type="checkbox"]', {
timeout: 30000,
}).should('not.be.checked');
cy.get('input[type="checkbox"]').should('not.be.checked');
});
});

context('settings tab', () => {
it('should allow the user to update their personal information', () => {
cy.visit('/account-settings');
cy.findByLabelText('First Name', {
timeout: 30000,
}).clear();
cy.findByLabelText('First Name').clear();
cy.findByLabelText('Last Name').clear();
cy.findByLabelText('First Name').type('Test');
cy.findByLabelText('Last Name').type('User');
Expand All @@ -74,9 +60,6 @@ describe('E2E with Okta', () => {
cy.visit('/help');
cy.findByText(
'If you still can’t find what you need and want to contact us, check',
{
timeout: 30000,
},
)
.parent()
.findByText('here')
Expand All @@ -89,9 +72,7 @@ describe('E2E with Okta', () => {
cy.solveGoogleReCAPTCHA();
cy.wait(1000);
cy.findByText('Submit').click();
cy.findByText('Thank you for contacting us', {
timeout: 30000,
});
cy.findByText('Thank you for contacting us');
});
});
});

0 comments on commit 6e81877

Please sign in to comment.