Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve test delays #1013

Closed
wants to merge 12 commits into from
2 changes: 1 addition & 1 deletion .github/workflows/dependabot-pr-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ jobs:
uses: actions/dependency-review-action@v4
with:
# fails when moderate vulnerabilities are deteched
fail-on-severity: moderate
fail-on-severity: high
4 changes: 2 additions & 2 deletions cypress/integration/404.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ describe.skip('Custom 404 page should display if wrong url is typed in', () => {

it('Should show custom 404 page', () => {
cy.visit('/invalid-url', { failOnStatusCode: false });
cy.get('p', { timeout: 10000 }).contains('This page could not be found');
cy.get('p').contains('This page could not be found');
});

it('Should show custom 404 page at incorrect courses ', () => {
cy.visit('/courses/invalid-course', { failOnStatusCode: false });
cy.get('p', { timeout: 10000 }).contains('This page could not be found');
cy.get('p').contains('This page could not be found');
});
});
8 changes: 2 additions & 6 deletions cypress/integration/activities.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,9 @@ describe('A logged in user should be able to navigate to activities and do an ex
});

it('Should go to the activities page and click on an exercise', () => {
cy.get(`[qa-id=secondary-nav-activities-button]`, { timeout: 10000 })
.should('exist')
.click()
.click(); //navigate to activities - double clicking just in case
cy.wait(2000); // wait to ensure the page has rendered and the auth checks have resolved
cy.get(`[qa-id=secondary-nav-activities-button]`).should('exist').click().click(); //navigate to activities - double clicking just in case // wait to ensure the page has rendered and the auth checks have resolved
// Default timeout is 4 seconds so extended to 8 to avoid racy tests
cy.get('h3', { timeout: 8000 }).contains('Thought diaries').should('exist').click(); //check click first exercise exists and open it
cy.get('h3').contains('Thought diaries').should('exist').click(); //check click first exercise exists and open it

cy.get('.MuiCollapse-root.MuiCollapse-entered') //check the audio file exists in accordian
.should('exist')
Expand Down
2 changes: 1 addition & 1 deletion cypress/integration/auth-redirect.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('Auth redirect', () => {
'/courses/image-based-abuse-and-rebuilding-ourselves/the-social-context-of-image-based-abuse-and-victim-blaming',
);

cy.get('h2', { timeout: 8000 }).should('contain', 'Welcome back');
cy.get('h2').should('contain', 'Welcome back');
cy.url().should(
'include',
'return_url=%2Fcourses%2Fimage-based-abuse-and-rebuilding-ourselves%2Fthe-social-context-of-image-based-abuse-and-victim-blaming',
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/cookie-consent.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Cookie consent', () => {
cy.get('[qa-id="cookieConsentAcceptButton"]').click();
// Cookie should be set
cy.wait;
cy.getCookie('analyticsConsent', { timeout: 8000 }).should('have.property', 'value', 'true');
cy.getCookie('analyticsConsent').should('have.property', 'value', 'true');

// Banner should have disappeared
cy.get('[qa-id="cookieConsentAcceptButton"]').should('not.exist');
Expand All @@ -17,7 +17,7 @@ describe('Cookie consent', () => {
// Click on cookie consent
cy.get('[qa-id="cookieConsentDeclineButton"]').click();
// Cookie should be set
cy.getCookie('analyticsConsent', { timeout: 8000 }).should('have.property', 'value', 'false');
cy.getCookie('analyticsConsent').should('have.property', 'value', 'false');
// Banner should have disappeared
cy.get('[qa-id="cookieConsentAcceptButton"]').should('not.exist');
});
Expand Down
21 changes: 6 additions & 15 deletions cypress/integration/create-user-existing.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,12 @@ describe('Create User', () => {
it('Should not be able to create user with existing email', () => {
// Start from the home page
cy.visit('/');
cy.wait(2000);
// TODO put the correct home page check below when it is published
// cy.get('h2', { timeout: 8000 }).contains('Get started').should('exist');
// TODO - workout why #primary-get-started-button works locallly and headless but not in github actions
cy.get('a[href="/auth/register"]', { timeout: 10000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 10000 }).should('contain', 'Create account');
cy.get('#name', { timeout: 10000 }).type('Cypress test');
cy.get('#email', { timeout: 10000 }).type(username);
cy.get('#password', { timeout: 10000 }).type('testpassword');
cy.get('a[href="/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Create account');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Create account').click();
cy.wait(3000);
cy.get('p', { timeout: 10000 }).should(
'contain',
'This email is already registered with Bloom',
);
cy.get('p').should('contain', 'This email is already registered with Bloom');
});
});
18 changes: 6 additions & 12 deletions cypress/integration/create-user-incorrect-email.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,12 @@ describe('Create User', () => {
it('Should not be able to create user with incorrect email', () => {
// Start from the home page
cy.visit('/');
cy.wait(2000);
// TODO put the correct home page check below when it is published
// cy.get('h2', { timeout: 8000 }).contains('Get started').should('exist');
// TODO - workout why #primary-get-started-button works locallly and headless but not in github actions
cy.get('a[href="/auth/register"]', { timeout: 10000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 10000 }).should('contain', 'Create account');
cy.get('#name', { timeout: 10000 }).type('Cypress test');
cy.get('#email', { timeout: 10000 }).type(username);
cy.get('#password', { timeout: 10000 }).type('testpassword');
cy.get('a[href="/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Create account');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Create account').click();
cy.wait(3000);
cy.get('p', { timeout: 10000 }).should('contain', 'There was an error setting up your account');
cy.get('p').should('contain', 'There was an error setting up your account');
});
});
18 changes: 6 additions & 12 deletions cypress/integration/create-user-weak-password.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@ describe('Create User', () => {
it('Should not be able to create user with a weak password', () => {
// Start from the home page
cy.visit('/');
cy.wait(2000);
// TODO put the correct home page check below when it is published
// cy.get('h2', { timeout: 8000 }).contains('Get started').should('exist');
// TODO - workout why #primary-get-started-button works locallly and headless but not in github actions
cy.get('a[href="/auth/register"]', { timeout: 10000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 10000 }).should('contain', 'Create account');
cy.get('#name', { timeout: 10000 }).type('Cypress test');
cy.get('#email', { timeout: 10000 }).type(username);
cy.get('#password', { timeout: 10000 }).type('123');
cy.get('a[href="/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Create account');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('123');
cy.get('button[type="submit"]').contains('Create account').click();
cy.wait(3000);
cy.get('p', { timeout: 10000 }).should(
cy.get('p').should(
'contain',
"Your password needs to be a little longer, so it's more secure.",
);
Expand Down
18 changes: 6 additions & 12 deletions cypress/integration/create-user.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,19 +9,13 @@ describe('Create User', () => {
it('User should be able to create user', () => {
// Start from the home page
cy.visit('/');
cy.wait(2000);
// TODO put the correct home page check below when it is published
// cy.get('h2', { timeout: 8000 }).contains('Get started').should('exist');
// TODO - workout why #primary-get-started-button works locallly and headless but not in github actions
cy.get('a[href="/auth/register"]', { timeout: 10000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 10000 }).should('contain', 'Create account');
cy.get('#name', { timeout: 10000 }).type('Cypress test');
cy.get('#email', { timeout: 10000 }).type(username);
cy.get('#password', { timeout: 10000 }).type('testpassword');
cy.get('a[href="/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Create account');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Create account').click();
cy.wait(3000);
cy.get('h2', { timeout: 10000 }).should('contain', 'Help us understand');
cy.get('h2').should('contain', 'Help us understand');
});
after(() => {
cy.logout();
Expand Down
19 changes: 7 additions & 12 deletions cypress/integration/create-user.de.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ describe('Create User', () => {
it('User should be able to create user', () => {
// Start from the home page
cy.visitGermanPage('/');
cy.wait(2000);
cy.get('h1', { timeout: 8000 })
.contains('Begleite uns während deines Heilungsprozesses')
.should('exist');
cy.get('a[href="/de/auth/register"]', { timeout: 5000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Konto anlegen');
cy.get('#name', { timeout: 8000 }).type('Cypress test');
cy.get('#email', { timeout: 8000 }).type(username);
cy.get('#password', { timeout: 8000 }).type('testpassword');
cy.get('h1').contains('Begleite uns während deines Heilungsprozesses').should('exist');
cy.get('a[href="/de/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Konto anlegen');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Konto anlegen').click();
cy.wait(3000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Hilf uns, zu verstehen');
cy.get('h2').should('contain', 'Hilf uns, zu verstehen');
});

after(() => {
Expand Down
17 changes: 7 additions & 10 deletions cypress/integration/create-user.es.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,14 @@ describe('Create User', () => {
it('User should be able to create user', () => {
// Start from the home page
cy.visitSpanishPage('/');
cy.wait(2000);
cy.get('h1', { timeout: 8000 }).contains('Acompáñanos en tu viaje de sanación').should('exist');
cy.get('a[href="/es/auth/register"]', { timeout: 5000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Crea una cuenta');
cy.get('#name', { timeout: 8000 }).type('Cypress test');
cy.get('#email', { timeout: 8000 }).type(username);
cy.get('#password', { timeout: 8000 }).type('testpassword');
cy.get('h1').contains('Acompáñanos en tu viaje de sanación').should('exist');
cy.get('a[href="/es/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Crea una cuenta');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Crea una cuenta').click();
cy.wait(3000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Ayúdanos a entender');
cy.get('h2').should('contain', 'Ayúdanos a entender');
});

after(() => {
Expand Down
19 changes: 7 additions & 12 deletions cypress/integration/create-user.fr.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,14 @@ describe('Create User', () => {
it('User should be able to create user', () => {
// Start from the home page
cy.visitFrenchPage('/');
cy.wait(2000);
cy.get('h1', { timeout: 8000 })
.contains('Rejoins-nous sur ton chemin de guérison')
.should('exist');
cy.get('a[href="/fr/auth/register"]', { timeout: 5000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Créer un compte');
cy.get('#name', { timeout: 8000 }).type('Cypress test');
cy.get('#email', { timeout: 8000 }).type(username);
cy.get('#password', { timeout: 8000 }).type('testpassword');
cy.get('h1').contains('Rejoins-nous sur ton chemin de guérison').should('exist');
cy.get('a[href="/fr/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Créer un compte');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Créer un compte').click();
cy.wait(3000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Aidez-nous à compendre');
cy.get('h2').should('contain', 'Aidez-nous à compendre');
});

after(() => {
Expand Down
13 changes: 5 additions & 8 deletions cypress/integration/create-user.hi.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,13 @@ describe('Create User', () => {
it('User should be able to create account in hindi', () => {
// Start from the home page
cy.visitHindiPage('/');
cy.wait(2000);

cy.get('a[href="/hi/auth/register"]', { timeout: 5000 }).first().click({ force: true });
cy.wait(2000);
cy.get('h2', { timeout: 8000 }).should('contain', 'Account banaiye');
cy.get('#name', { timeout: 8000 }).type('Cypress test');
cy.get('#email', { timeout: 8000 }).type(username);
cy.get('#password', { timeout: 8000 }).type('testpassword');
cy.get('a[href="/hi/auth/register"]').first().click({ force: true });
cy.get('h2').should('contain', 'Account banaiye');
cy.get('#name').type('Cypress test');
cy.get('#email').type(username);
cy.get('#password').type('testpassword');
cy.get('button[type="submit"]').contains('Account Banao').click();
cy.wait(3000);
});

after(() => {
Expand Down
8 changes: 3 additions & 5 deletions cypress/integration/delete-user.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,8 @@ describe('Delete User', () => {
});
it(`should be able to delete user from accounts settings page`, () => {
cy.visit('/account/settings');
cy.get('#delete-account-button', { timeout: 10000 })
.should('contain.text', 'Delete Account')
.click();
cy.get('#confirm-dialog-submit', { timeout: 10000 }).click();
cy.url({ timeout: 10000 }).should('include', '/');
cy.get('#delete-account-button').should('contain.text', 'Delete Account').click();
cy.get('#confirm-dialog-submit').click();
cy.url().should('include', '/');
});
});
2 changes: 1 addition & 1 deletion cypress/integration/grounding-exercises.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ describe('A logged in user should be able to navigate to grounding and do an exe
it('Should go to the grounding page and click on an exercise', () => {
cy.get(`[qa-id=secondary-nav-grounding-button]`).should('exist').click(); //navigate to grounding
// Extending timeout to ensure tests don't fail because of lazy loading
cy.get('h3', { timeout: 8000 }).contains('Visual breathing').should('exist').click(); //check visual breathing exercise exists and open it
cy.get('h3').contains('Visual breathing').should('exist').click(); //check visual breathing exercise exists and open it

cy.get('audio') //check the audio file exists in accordian
.should('exist')
Expand Down
12 changes: 6 additions & 6 deletions cypress/integration/initial-exploration.cy.tsx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
describe('Initial exploration', () => {
it('should be able to explore all pages', () => {
cy.visit('/');
cy.get('h1', { timeout: 8000 }).contains('Join us on your healing journey');
cy.get('h1').contains('Join us on your healing journey');
cy.get(`[qa-id=secondary-nav-chat-button]`).click();
cy.get('a', { timeout: 8000 }).contains('Get started');
cy.get('a').contains('Get started');
cy.get(`[qa-id=secondary-nav-grounding-button]`).click();
cy.get('a', { timeout: 8000 }).contains('Get started');
cy.get('a').contains('Get started');
cy.get(`[qa-id=secondary-nav-activities-button]`).click();
cy.get('a', { timeout: 8000 }).contains('Get started');
cy.get('a').contains('Get started');
cy.get(`[qa-id=secondary-nav-notes-button]`).click();
cy.get('a', { timeout: 8000 }).contains('Get started');
cy.get('a').contains('Get started');
cy.get(`[qa-id=secondary-nav-courses-button]`).click();
cy.get('a', { timeout: 8000 }).contains('Get started');
cy.get('a').contains('Get started');
});
});
12 changes: 5 additions & 7 deletions cypress/integration/navigation.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ describe('Navigation', () => {
describe('A non-logged in user', () => {
it('on the home page, the nav bar should have the correct links ', () => {
cy.visit('/');
cy.get(`[qa-id=home-logo-link]`, { timeout: 8000 }).should('exist');
cy.get(`[qa-id=home-logo-link]`).should('exist');
cy.get(`[qa-id=user-menu-button]`).should('not.exist');
cy.get(`[qa-id=language-menu-button]`).should('exist');
cy.get(`[qa-id=meet-team-menu-button]`).should('exist');
Expand All @@ -25,7 +25,7 @@ describe('Navigation', () => {
});
it('on the home page, the nav bar should have the correct links ', () => {
cy.visit('/');
cy.get(`[qa-id=home-logo-link]`, { timeout: 8000 }).should('exist');
cy.get(`[qa-id=home-logo-link]`).should('exist');
cy.get(`[qa-id=user-menu-button]`).should('exist');
cy.get(`[qa-id=language-menu-button]`).should('exist');
cy.get(`[qa-id=meet-team-menu-button]`).should('exist');
Expand All @@ -51,7 +51,6 @@ describe('Navigation', () => {
Cypress.env('bumble_partner_admin_email'),
Cypress.env('bumble_partner_admin_password'),
);
cy.wait(2000);

cy.createAccessCode({
featureLiveChat: true,
Expand All @@ -71,7 +70,7 @@ describe('Navigation', () => {
});
it('on the home page, the nav bar should have the correct links ', () => {
cy.visit('/');
cy.get(`[qa-id=home-logo-link]`, { timeout: 8000 }).should('exist');
cy.get(`[qa-id=home-logo-link]`).should('exist');
cy.get(`[qa-id=user-menu-button]`).should('exist');
cy.get(`[qa-id=language-menu-button]`).should('exist');
cy.get(`[qa-id=meet-team-menu-button]`).should('exist');
Expand All @@ -97,7 +96,6 @@ describe('Navigation', () => {
Cypress.env('badoo_partner_admin_email'),
Cypress.env('badoo_partner_admin_password'),
);
cy.wait(2000);

cy.createAccessCode({
featureLiveChat: true,
Expand All @@ -117,7 +115,7 @@ describe('Navigation', () => {
});
it('on the home page, the nav bar should have the correct links ', () => {
cy.visit('/');
cy.get(`[qa-id=home-logo-link]`, { timeout: 8000 }).should('exist');
cy.get(`[qa-id=home-logo-link]`).should('exist');
cy.get(`[qa-id=user-menu-button]`).should('exist');
cy.get(`[qa-id=language-menu-button]`).should('exist');
cy.get(`[qa-id=meet-team-menu-button]`).should('exist');
Expand All @@ -144,7 +142,7 @@ describe('Navigation', () => {
});
it('on the home page, the nav bar should have the correct links ', () => {
cy.visit('/');
cy.get(`[qa-id=home-logo-link]`, { timeout: 8000 }).should('exist');
cy.get(`[qa-id=home-logo-link]`).should('exist');
cy.get(`[qa-id=user-menu-button]`).should('exist');
cy.get(`[qa-id=language-menu-button]`).should('exist');
cy.get(`[qa-id=meet-team-menu-button]`).should('exist');
Expand Down
4 changes: 2 additions & 2 deletions cypress/integration/notes.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ describe('A logged in user should be able to subscribe to notes from bloom', ()

it('Should go to the notes page and try to subscribe using an incorrect number', () => {
cy.visit('/');
cy.get(`[qa-id=secondary-nav-notes-button]`, { timeout: 8000 }).should('exist').click(); //navigate to notes
cy.get(`[qa-id=secondary-nav-notes-button]`).should('exist').click(); //navigate to notes

cy.get('h2').contains('Subscribe to Notes from Bloom').should('exist'); //check subscribe to notes form exists

cy.get('input[type="tel"]').should('exist').type('0101'); //type invalid number

cy.get('button[type="submit"]').contains('Subscribe').click(); //submit form

cy.get('p', { timeout: 3000 }).should('contain', 'Your phone number appears to be invalid'); //check the form submission fails
cy.get('p').should('contain', 'Your phone number appears to be invalid'); //check the form submission fails
});

after(() => {
Expand Down
Loading
Loading