diff --git a/.github/workflows/dependabot-pr-review.yml b/.github/workflows/dependabot-pr-review.yml index 0345750a..6c564e3f 100644 --- a/.github/workflows/dependabot-pr-review.yml +++ b/.github/workflows/dependabot-pr-review.yml @@ -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 diff --git a/cypress/integration/404.cy.tsx b/cypress/integration/404.cy.tsx index c86bcb1e..72436b1e 100644 --- a/cypress/integration/404.cy.tsx +++ b/cypress/integration/404.cy.tsx @@ -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'); }); }); diff --git a/cypress/integration/activities.cy.tsx b/cypress/integration/activities.cy.tsx index f41a0dd2..659bedf0 100644 --- a/cypress/integration/activities.cy.tsx +++ b/cypress/integration/activities.cy.tsx @@ -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') diff --git a/cypress/integration/auth-redirect.cy.tsx b/cypress/integration/auth-redirect.cy.tsx index 5672fc7d..bf78ea84 100644 --- a/cypress/integration/auth-redirect.cy.tsx +++ b/cypress/integration/auth-redirect.cy.tsx @@ -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', diff --git a/cypress/integration/cookie-consent.cy.tsx b/cypress/integration/cookie-consent.cy.tsx index 6fb9ad9e..adf7a5be 100644 --- a/cypress/integration/cookie-consent.cy.tsx +++ b/cypress/integration/cookie-consent.cy.tsx @@ -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'); @@ -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'); }); diff --git a/cypress/integration/create-user-existing.cy.tsx b/cypress/integration/create-user-existing.cy.tsx index ae46359c..a4d4ecd4 100644 --- a/cypress/integration/create-user-existing.cy.tsx +++ b/cypress/integration/create-user-existing.cy.tsx @@ -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'); }); }); diff --git a/cypress/integration/create-user-incorrect-email.cy.tsx b/cypress/integration/create-user-incorrect-email.cy.tsx index 37e2a8b1..b7a0cf6d 100644 --- a/cypress/integration/create-user-incorrect-email.cy.tsx +++ b/cypress/integration/create-user-incorrect-email.cy.tsx @@ -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'); }); }); diff --git a/cypress/integration/create-user-weak-password.cy.tsx b/cypress/integration/create-user-weak-password.cy.tsx index c384ec33..aae7b5fe 100644 --- a/cypress/integration/create-user-weak-password.cy.tsx +++ b/cypress/integration/create-user-weak-password.cy.tsx @@ -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.", ); diff --git a/cypress/integration/create-user.cy.tsx b/cypress/integration/create-user.cy.tsx index 5e1fd03e..e117e10b 100644 --- a/cypress/integration/create-user.cy.tsx +++ b/cypress/integration/create-user.cy.tsx @@ -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(); diff --git a/cypress/integration/create-user.de.cy.tsx b/cypress/integration/create-user.de.cy.tsx index a7bf11a0..39068f03 100644 --- a/cypress/integration/create-user.de.cy.tsx +++ b/cypress/integration/create-user.de.cy.tsx @@ -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(() => { diff --git a/cypress/integration/create-user.es.cy.tsx b/cypress/integration/create-user.es.cy.tsx index a14996a9..c6038b98 100644 --- a/cypress/integration/create-user.es.cy.tsx +++ b/cypress/integration/create-user.es.cy.tsx @@ -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(() => { diff --git a/cypress/integration/create-user.fr.cy.tsx b/cypress/integration/create-user.fr.cy.tsx index 5e1863d8..c43ca691 100644 --- a/cypress/integration/create-user.fr.cy.tsx +++ b/cypress/integration/create-user.fr.cy.tsx @@ -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(() => { diff --git a/cypress/integration/create-user.hi.cy.tsx b/cypress/integration/create-user.hi.cy.tsx index bca2db73..4b1d4343 100644 --- a/cypress/integration/create-user.hi.cy.tsx +++ b/cypress/integration/create-user.hi.cy.tsx @@ -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(() => { diff --git a/cypress/integration/delete-user.cy.tsx b/cypress/integration/delete-user.cy.tsx index 3bad0155..c68cef89 100644 --- a/cypress/integration/delete-user.cy.tsx +++ b/cypress/integration/delete-user.cy.tsx @@ -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', '/'); }); }); diff --git a/cypress/integration/grounding-exercises.cy.tsx b/cypress/integration/grounding-exercises.cy.tsx index 99038115..df1124a2 100644 --- a/cypress/integration/grounding-exercises.cy.tsx +++ b/cypress/integration/grounding-exercises.cy.tsx @@ -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') diff --git a/cypress/integration/initial-exploration.cy.tsx b/cypress/integration/initial-exploration.cy.tsx index 62aa7267..77faf273 100644 --- a/cypress/integration/initial-exploration.cy.tsx +++ b/cypress/integration/initial-exploration.cy.tsx @@ -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'); }); }); diff --git a/cypress/integration/navigation.cy.tsx b/cypress/integration/navigation.cy.tsx index b21a928c..96d7094f 100644 --- a/cypress/integration/navigation.cy.tsx +++ b/cypress/integration/navigation.cy.tsx @@ -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'); @@ -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'); @@ -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, @@ -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'); @@ -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, @@ -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'); @@ -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'); diff --git a/cypress/integration/notes.cy.tsx b/cypress/integration/notes.cy.tsx index 0b73b3f5..dcc3729f 100644 --- a/cypress/integration/notes.cy.tsx +++ b/cypress/integration/notes.cy.tsx @@ -6,7 +6,7 @@ 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 @@ -14,7 +14,7 @@ describe('A logged in user should be able to subscribe to notes from bloom', () 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(() => { diff --git a/cypress/integration/partner-admin.cy.tsx b/cypress/integration/partner-admin.cy.tsx index ef94bc08..256a16cf 100644 --- a/cypress/integration/partner-admin.cy.tsx +++ b/cypress/integration/partner-admin.cy.tsx @@ -8,7 +8,7 @@ describe('A partner admin should be directed to admin ', () => { Cypress.env('bumble_partner_admin_email'), Cypress.env('bumble_partner_admin_password'), ); - cy.get('[qa-id=partner-admin-menu-button]', { timeout: 10000 }).should('exist'); + cy.get('[qa-id=partner-admin-menu-button]').should('exist'); cy.get('h2').contains('Create access code').should('exist'); // We should be redirected to the create access code page }); diff --git a/cypress/integration/register-partner-with-code.cy.tsx b/cypress/integration/register-partner-with-code.cy.tsx index 731a7da9..0e152d6a 100644 --- a/cypress/integration/register-partner-with-code.cy.tsx +++ b/cypress/integration/register-partner-with-code.cy.tsx @@ -10,7 +10,6 @@ describe('Register with access code', () => { Cypress.env('badoo_partner_admin_email'), Cypress.env('badoo_partner_admin_password'), ); - cy.wait(2000); cy.createAccessCode({ featureLiveChat: true, @@ -27,23 +26,21 @@ describe('Register with access code', () => { it('Access code input should be on form', () => { // Start from the home page cy.visit(welcomeCodeLink); - cy.wait(5000); + cy.wait(2000); // The new page should contain an h2 with "Reset your password" - cy.get('p', { timeout: 8000 }).contains( + cy.get('p').contains( 'Enter the access code you received from Badoo to begin your Bloom journey.', ); cy.get('#accessCode') .invoke('val') .then((val) => expect(val).equals(welcomeCode)); - cy.get('button[type="submit"]').contains('Get started').click(); - cy.wait(2000); // waiting for dom to rerender - cy.get('h2', { timeout: 8000 }).should('contain', 'Create account'); + cy.get('button[type="submit"]').contains('Get started').click(); // waiting for dom to rerender + 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(4000); // Waiting for dom to rerender - cy.get('h2', { timeout: 8000 }).should('contain', 'Help us understand'); + cy.get('h2').should('contain', 'Help us understand'); }); after(() => { cy.logout(); diff --git a/cypress/integration/register-partner-without-code.cy.tsx b/cypress/integration/register-partner-without-code.cy.tsx index f802002c..9b9a9a53 100644 --- a/cypress/integration/register-partner-without-code.cy.tsx +++ b/cypress/integration/register-partner-without-code.cy.tsx @@ -8,22 +8,19 @@ describe('Register without access code', () => { it('Access code input should be on form', () => { // Start from the home page cy.visit('/welcome/bumble'); - cy.wait(5000); - cy.get('p', { timeout: 8000 }) + cy.get('p') .contains('Enter the access code you received from Bumble to begin your Bloom journey.') .should('not.exist'); cy.get('p').contains( 'Create an account with Bloom to get started with our courses, or first find out more about Bloom below.', ); - cy.get('a', { timeout: 8000 }).contains('Get started').click(); - cy.wait(2000); // waiting for dom to rerender - cy.get('h2', { timeout: 8000 }).should('contain', 'Create account'); + cy.get('a').contains('Get started').click(); // waiting for dom to rerender + 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(4000); // Waiting for dom to rerender - cy.get('h2', { timeout: 8000 }).should('contain', 'Help us understand'); + cy.get('h2').should('contain', 'Help us understand'); }); after(() => { cy.logout(); diff --git a/cypress/integration/reset-password.cy.tsx b/cypress/integration/reset-password.cy.tsx index b20ea9d5..530df079 100644 --- a/cypress/integration/reset-password.cy.tsx +++ b/cypress/integration/reset-password.cy.tsx @@ -9,7 +9,7 @@ describe('Reset password', () => { cy.visit('/'); // Find a link with an href attribute containing "login" and click it - cy.get('a[href*="login"]', { timeout: 8000 }).click(); + cy.get('a[href*="login"]').click(); // The new url should include "login" cy.url().should('include', Cypress.env('login_path')); @@ -20,21 +20,16 @@ describe('Reset password', () => { cy.url().should('include', Cypress.env('reset_password_path')); // The new page should contain an h2 with "Reset your password" - cy.get('h2', { timeout: 8000 }).contains('Reset your password'); + cy.get('h2').contains('Reset your password'); }); it('should see resend-link button after typing known email', () => { cy.visit(Cypress.env('reset_password_path')); - cy.wait(1000); // Waiting for dom to rerender as the email input was detaching - cy.get('[qa-id=passwordResetEmailInput]', { timeout: 8000 }).type( - `${Cypress.env('reset_pwd_confirm_email')}`, - ); + cy.get('[qa-id=passwordResetEmailInput]').type(`${Cypress.env('reset_pwd_confirm_email')}`); cy.get('[qa-id=passwordResetEmailButton]').click(); + cy.wait(3000); - cy.get('p', { timeout: 8000 }).should( - 'contain', - 'Check your emails for a reset link from Bloom.', - ); + cy.get('p').should('contain', 'Check your emails for a reset link from Bloom.'); cy.get('button[type="submit"]').contains('Resend email'); }); @@ -49,8 +44,8 @@ describe('Reset password', () => { // Reset password cy.visit(Cypress.env('reset_password_path')); - cy.get('[qa-id=passwordResetEmailInput]', { timeout: 8000 }).focus().type(`${email}{enter}`); - cy.get('p', { timeout: 8000 }) + cy.get('[qa-id=passwordResetEmailInput]').focus().type(`${email}{enter}`); + cy.get('p') // check that front-end confirms an email has been sent .should('contain', 'Check your emails for a reset link from Bloom.') .then(async () => { diff --git a/cypress/integration/therapy-usage.cy.tsx b/cypress/integration/therapy-usage.cy.tsx index 7931ff24..52453948 100644 --- a/cypress/integration/therapy-usage.cy.tsx +++ b/cypress/integration/therapy-usage.cy.tsx @@ -17,7 +17,7 @@ describe('Therapy Usage', () => { it('Navigate to the admin page and create the access code', () => { cy.visit('/'); - cy.get(`[qa-id=partner-admin-menu-button]`, { timeout: 8000 }).should('exist').click(); //Find admin button and click + cy.get(`[qa-id=partner-admin-menu-button]`).should('exist').click(); //Find admin button and click cy.uiCreateAccessCode().then((res) => { accessCode = res; }); @@ -36,17 +36,15 @@ describe('Therapy Usage', () => { it('Log in as new bumble user and apply code', () => { cy.visit('/welcome/bumble'); - cy.get('button#user-menu-button', { timeout: 10000 }).should('exist').click(); //check user menu exists and access it + cy.get('button#user-menu-button').should('exist').click(); //check user menu exists and access it cy.get('a').contains('Apply a code').should('exist').click(); //go to the apply code page cy.get('input#accessCode').should('exist').click().type(accessCode); // populate the access code field cy.get('button[type="submit"]').contains('Apply code').click(); // submit form to add access code - cy.get('p', { timeout: 10000 }) - .contains('A Bumble code was applied to your account!') - .should('exist'); //check form submitted successfully + cy.get('p').contains('A Bumble code was applied to your account!').should('exist'); //check form submitted successfully }); it('Check therapy is available and start to book a session', () => { cy.visit('/welcome/bumble'); - cy.get(`[qa-id=secondary-nav-therapy-button]`, { timeout: 10000 }).should('exist').click(); //Find therapy button and click + cy.get(`[qa-id=secondary-nav-therapy-button]`).should('exist').click(); //Find therapy button and click cy.get('#therapy-sessions-remaining').should('have.text', '6'); //check number of therapy sessions is 6 cy.get('button').contains('Begin booking').should('exist').click(); //begin booking cy.get('iframe[title="Booking widget"]').should('exist'); //check it worked diff --git a/cypress/integration/user-chat.cy.tsx b/cypress/integration/user-chat.cy.tsx index 3d270868..d75e1dcf 100644 --- a/cypress/integration/user-chat.cy.tsx +++ b/cypress/integration/user-chat.cy.tsx @@ -6,7 +6,7 @@ describe('A logged in public user can start a chat', () => { it('Navigate to the chat page and begin a chat', () => { cy.visit('/'); //intitial home page visit - cy.get(`[qa-id=secondary-nav-chat-button]`, { timeout: 8000 }).should('exist').click(); //go to chat page + cy.get(`[qa-id=secondary-nav-chat-button]`).should('exist').click(); //go to chat page cy.get('button[type="button"]').contains('Start a chat').click(); //click button to start chatting diff --git a/cypress/integration/user-course-session-behaviour.cy.tsx b/cypress/integration/user-course-session-behaviour.cy.tsx index b602ee2e..c349b185 100644 --- a/cypress/integration/user-course-session-behaviour.cy.tsx +++ b/cypress/integration/user-course-session-behaviour.cy.tsx @@ -15,27 +15,19 @@ describe.only('A logged in user should be able to navigate to a course session a it('Should go to courses page and select a course & session', () => { cy.logInWithEmailAndPassword(newUserEmail, password); //log in to test user - cy.get(`[qa-id=secondary-nav-courses-button]`, { timeout: 8000 }).should('exist').click(); //navigate to courses + cy.get(`[qa-id=secondary-nav-courses-button]`).should('exist').click(); //navigate to courses - cy.get('a[href*="healing-from-sexual-trauma"]', { - timeout: 8000, - }) - .first() - .click(); //click on a course when link load + cy.get('a[href*="healing-from-sexual-trauma"]').first().click(); //click on a course when link load // cy.getIframeBody().find('button').click(); Attempting to watch the session video. iframe isnt working at the moment - cy.get('a[href*="what-is-sexual-trauma"]', { - timeout: 8000, - }) - .first() - .click(); //click on a session when link loads + cy.get('a[href*="what-is-sexual-trauma"]').first().click(); //click on a session when link loads }); it('Should read activity & bonus content and complete session', () => { cy.visit('/courses/healing-from-sexual-trauma/what-is-sexual-trauma'); - cy.get('h3', { timeout: 10000 }).contains('Activity').click(); //open activities + cy.get('h3').contains('Activity').click(); //open activities cy.get('h3').contains('Bonus content').click(); //open bonus content diff --git a/cypress/integration/user-update-email.cy.tsx b/cypress/integration/user-update-email.cy.tsx index 207ffb01..076f5da0 100644 --- a/cypress/integration/user-update-email.cy.tsx +++ b/cypress/integration/user-update-email.cy.tsx @@ -10,19 +10,19 @@ describe('User account settings page', () => { it('Should successfully update name', () => { cy.visit('/account/settings'); - cy.get('#name', { timeout: 10000 }).clear().type('Updated name'); - cy.get('#profile-settings-submit', { timeout: 10000 }).click(); - cy.get(`[data-testid='CheckCircleOutlinedIcon']`, { timeout: 10000 }).should('be.visible'); + cy.get('#name').clear().type('Updated name'); + cy.get('#profile-settings-submit').click(); + cy.get(`[data-testid='CheckCircleOutlinedIcon']`).should('be.visible'); }); it('Should display error if attempting to update email to existing email in use', () => { cy.visit('/account/settings'); - cy.get('#email', { timeout: 10000 }) + cy.get('#email') .clear() .type(Cypress.env('public_email') as string); - cy.get('#profile-settings-submit', { timeout: 10000 }).click(); - cy.get('#confirm-dialog-submit', { timeout: 10000 }).click(); - cy.get('p', { timeout: 10000 }) + cy.get('#profile-settings-submit').click(); + cy.get('#confirm-dialog-submit').click(); + cy.get('p') .contains('This email is already in use by another account, please try again') .should('be.visible'); }); @@ -30,15 +30,15 @@ describe('User account settings page', () => { it('Should successfully update email', () => { const newEmail = `cypresstestemail+${Date.now()}@chayn.co`; cy.visit('/account/settings'); - cy.get('#email', { timeout: 10000 }).clear().type(newEmail); - cy.get('#profile-settings-submit', { timeout: 10000 }).click(); - cy.get('#confirm-dialog-submit', { timeout: 10000 }).click(); - cy.url({ timeout: 10000 }).should('include', '/auth/login'); + cy.get('#email').clear().type(newEmail); + cy.get('#profile-settings-submit').click(); + cy.get('#confirm-dialog-submit').click(); + cy.url().should('include', '/auth/login'); cy.get('#email').type(newEmail); cy.get('#password').type(password); - cy.get('#login-submit', { timeout: 10000 }).click(); + cy.get('#login-submit').click(); - cy.get('#email', { timeout: 10000 }).should('have.value', newEmail); + cy.get('#email').should('have.value', newEmail); }); after(() => { cy.logout(); diff --git a/cypress/support/commands.js b/cypress/support/commands.js index 1c849e8a..1649684a 100644 --- a/cypress/support/commands.js +++ b/cypress/support/commands.js @@ -31,7 +31,6 @@ const http = require('http'); Cypress.Commands.add('uiLogin', (email, password) => { cy.visit('/auth/login'); - cy.wait(4000); cy.get('input[type="email"]', { timeout: 10000 }).click().type(email); cy.get('#password').type(password); cy.get('button[type="submit"]').contains('Login').click(); @@ -40,10 +39,7 @@ Cypress.Commands.add('uiLogin', (email, password) => { Cypress.Commands.add('uiLogout', (e) => { cy.get('#user-menu-button').click({ force: true }); - cy.wait(1000); - cy.get('#logout-button').click({ force: true }); - cy.wait(1000); }); // TODO maybe delete this helper - keeping for now but could potentially not be useful @@ -113,7 +109,6 @@ Cypress.Commands.add('deleteAllCypressUsers', () => { }, }); }); - cy.wait(2000); }); Cypress.Commands.add('deleteCypressAccessCodes', () => { @@ -126,7 +121,6 @@ Cypress.Commands.add('deleteCypressAccessCodes', () => { }, }); }); - cy.wait(2000); }); Cypress.Commands.add('cleanUpTestState', () => { @@ -140,7 +134,6 @@ Cypress.Commands.add('cleanUpTestState', () => { cy.clearAllCookies(); cy.clearAllLocalStorage(); cy.clearAllSessionStorage(); - cy.wait(1000); }); Cypress.Commands.add('visitGermanPage', (url) => {