diff --git a/cypress/integration/tests/user-about-you.cy.tsx b/cypress/integration/tests/user-about-you.cy.tsx new file mode 100644 index 00000000..f88debcb --- /dev/null +++ b/cypress/integration/tests/user-about-you.cy.tsx @@ -0,0 +1,94 @@ +describe('User about you page should display', () => { + const publicEmail = Cypress.env('CYPRESS_PUBLIC_EMAIL') as string; + + before(() => { + cy.cleanUpTestState(); + cy.logInWithEmailAndPassword(publicEmail, Cypress.env('CYPRESS_PUBLIC_PASSWORD')); + }); + + beforeEach(() => { + cy.visit('/account/about-you'); + }); + + it('header section', () => { + cy.checkImage('Welcome to Bloom', 'welcome_to_bloom'); + cy.checkImage( + `Illustration of a person's face and shoulders, with big leaves and flowers blooming above them`, + 'illustration_bloom_head_yellow', + ); + }); + + it('Help us understand section', () => { + cy.get('h2').should('contain', 'Help us understand'); + cy.get('p').should( + 'contain', + 'These questions help us understand who is using Bloom and what kinds of support they need from us.', + ); + cy.checkLink('/courses', 'Skip to courses'); + }); + + it('About you panel', () => { + cy.get('h2').should('contain', 'About you'); + + cy.get('label.Mui-required').contains( + 'Please select one or more options that reflect your gender identity', + ); + cy.get('input[id="gender"]') + .should('exist') + .should('have.prop', 'role', 'combobox') + .should('have.prop', 'required', true); + cy.get('p').should( + 'contain', + `We are asking this to better understand how our users identify, with a view to designing even more inclusive and gender-affirming resources. You can select 'Prefer not to answer'.`, + ); + + cy.get('legend.Mui-required').contains('Would you describe yourself as neurodivergent?'); + const neurodivergentOptions = ['Yes', 'No', 'Not sure']; + cy.get('input[name="neurodivergent-radio-buttons-group"]').each(($option, index) => { + cy.wrap($option) + .should('have.value', neurodivergentOptions[index]) + .should('have.prop', 'type', 'radio') + .parents('label') + .contains(neurodivergentOptions[index]); + }); + cy.get('p').should( + 'contain', + `We design our services to be inclusive, so it’s helpful for us to hear feedback from people who are neurodivergent`, + ); + + cy.get('label').contains( + 'How would you describe your race, ethnicity and nationality? E.g., White Hispanic Mexican, or Tamil Indian.', + ); + cy.get('input[id="raceEthnNatn"]').should('exist').should('have.prop', 'type', 'text'); + cy.get('p').should( + 'contain', + `We know that people's experiences of race and ethnicity vary widely based on where they live, so write what you feel best describes you personally.`, + ); + + cy.get('label.Mui-required').contains('What country do you live in right now?'); + cy.get('input[id="country"]') + .should('exist') + .should('have.prop', 'role', 'combobox') + .should('have.prop', 'required', true); + cy.get('p').should( + 'contain', + `This will help us understand where survivors are accessing our services from.`, + ); + + cy.get('legend').contains('What is your age group?'); + const ageOptions = ['Under 18', '18-25', '25-35', '35-45', '45-55', '55+', 'Prefer not to say']; + cy.get('input[name="age-radio-buttons-group"]').each(($option, index) => { + cy.wrap($option) + .should('have.value', ageOptions[index]) + .should('have.prop', 'type', 'radio') + .parents('label') + .contains(ageOptions[index]); + }); + + cy.get('button').contains('Submit').should('have.prop', 'type', 'submit'); + }); + + after(() => { + cy.logout(); + }); +}); diff --git a/cypress/integration/tests/user-account-settings.cy.tsx b/cypress/integration/tests/user-account-settings.cy.tsx index 1e482836..aa1abf95 100644 --- a/cypress/integration/tests/user-account-settings.cy.tsx +++ b/cypress/integration/tests/user-account-settings.cy.tsx @@ -7,14 +7,16 @@ describe.only('User account settings page', () => { cy.logInWithEmailAndPassword(publicEmail, Cypress.env('CYPRESS_PUBLIC_PASSWORD')); }); - it.skip('Should display disabled user email and name fields with user data', () => { + beforeEach(() => { cy.visit('/account/settings'); + }); + + it.skip('Should display disabled user email and name fields with user data', () => { cy.get('#email', { timeout: 8000 }).should('have.value', publicEmail); cy.get('#name').should('have.value', publicName); }); it.skip('Should have marketing and service email checkbox fields and submit button', () => { - cy.visit('/account/settings'); cy.get('input[name="contactPermission"]', { timeout: 8000 }).check(); cy.get('input[name="serviceEmailsPermission"]').check(); cy.get('button[type="submit"]').contains('Save email preferences').click(); @@ -30,7 +32,6 @@ describe.only('User account settings page', () => { NEVER: 3, }; - cy.visit('/account/settings'); // Get currently set value cy.get('input[name="email-reminders-settings"]:checked').then((item) => { const currentValue: string = item.val().toString(); @@ -50,6 +51,22 @@ describe.only('User account settings page', () => { }); }); + it('Should display header section', () => { + cy.get('h1').should('contain', 'Account Settings'); + cy.get('p').should('contain', 'View and update your settings in bloom'); + cy.checkImage('Illustration of a mobile phone with message containing a heart', 'phone'); + }); + + it('Should display Account actions section', () => { + cy.get('h2').should('contain', 'Account actions'); + cy.get('p').should( + 'contain', + `Deleting your account will permanently erase your name, email address and the history of sessions you've watched from our system.`, + ); + cy.get('button').should('contain', 'Reset password'); + cy.get('button').should('contain', 'Delete Account'); + }); + after(() => { cy.logout(); }); diff --git a/cypress/integration/tests/user-apply-a-code.cy.tsx b/cypress/integration/tests/user-apply-a-code.cy.tsx new file mode 100644 index 00000000..aadb1119 --- /dev/null +++ b/cypress/integration/tests/user-apply-a-code.cy.tsx @@ -0,0 +1,49 @@ +describe('User apply a code page should display', () => { + const publicEmail = Cypress.env('CYPRESS_PUBLIC_EMAIL') as string; + + before(() => { + cy.cleanUpTestState(); + cy.logInWithEmailAndPassword(publicEmail, Cypress.env('CYPRESS_PUBLIC_PASSWORD')); + }); + + beforeEach(() => { + cy.visit('/account/apply-a-code'); + }); + + it('header section', () => { + cy.get('h1').should('contain', 'Apply a code'); + cy.get('p').should( + 'contain', + 'Bloom works with partners to support healing for survivors of abuse around the world.', + ); + cy.checkImage('Illustration of a person sitting, holding a tea', 'illustration_person4_peach'); + }); + + it('description', () => { + cy.get('p').should( + 'contain', + `If you've received an access code from one of our partners, you can add it here to receive support specific to their programme.`, + ); + cy.get('p').should('contain', 'You can add codes from more than one partner.'); + }); + + it('our partners panel', () => { + cy.get('h3').should('contain', 'Our partners'); + cy.get('p').should('contain', 'Read more about our partnerships by clicking on their logo.'); + cy.checkImage('Bumble logo', 'bumble_logo'); + cy.checkImage('Badoo logo', 'badoo_logo'); + cy.checkImage('Fruitz logo', 'fruitz_logo'); + }); + + it('apply a code panel', () => { + cy.get('h2').should('contain', 'Apply a code'); + cy.get('p').should('contain', 'Enter the access code you received from a Bloom partner.'); + cy.get('label.Mui-required').contains('Access code'); + cy.get('input[id="accessCode"]').should('exist'); + cy.get('button').contains('Apply code'); + }); + + after(() => { + cy.logout(); + }); +}); diff --git a/cypress/integration/tests/user-disable-service-emails.cy.tsx b/cypress/integration/tests/user-disable-service-emails.cy.tsx new file mode 100644 index 00000000..82f0a808 --- /dev/null +++ b/cypress/integration/tests/user-disable-service-emails.cy.tsx @@ -0,0 +1,26 @@ +describe('User disable service emails page should display', () => { + const publicEmail = Cypress.env('CYPRESS_PUBLIC_EMAIL') as string; + + before(() => { + cy.cleanUpTestState(); + cy.logInWithEmailAndPassword(publicEmail, Cypress.env('CYPRESS_PUBLIC_PASSWORD')); + }); + + beforeEach(() => { + cy.visit('/account/disable-service-emails'); + }); + + it('header section', () => { + cy.get('h1').contains('Bloom emails turned off'); + cy.checkImage('Account.disableServiceEmails.imageAlt', 'illustration_leaf_mix_bee'); + cy.get('p').should( + 'contain', + `You will no longer receive emails related to Bloom. If you'd like to change this later, please get in touch with the`, + ); + cy.checkLink('/account/disable-service-emails#', 'Bloom team'); + }); + + after(() => { + cy.logout(); + }); +});