Skip to content

Commit

Permalink
Account e2e test (#1099)
Browse files Browse the repository at this point in the history
* Move welcome e2e tests to tests folder

* Tidy up existing test

* Add header section test

* Add account actions section test

* Simplify image src value

* Add Apply code tests

* Remove non used var

* Add about-you page tests

* Add disable service emails tests

* fix: stop pre-commit add all command

* upgrade: cypress

* fix: hydration issue in meet the team page

* move: cypress tests into correct folder

* fix: racey cypress tests

* fix: timeouts in cypress tests and removing async

* fix: async issues in reset password cypress test

* feat: fix checkPageUrl

* Fix: racey user account page tests

* fix: don't clean up users after test run only before

* fix: urls now that the NEXT_PUBLIC_API_URL no longer has a trailing slash

* fix: return user in cy.logInWithEMailAndPassword

* fix: signInWithEmailAndPassword cypress command

* fix: before.cy.tsx to chain events properly

* fix: checkPageUrl

* fix: checkUrl should check pathname not full url

* fix: remove after.tsx

* fix: meet-the-team cypress test

* Home e2e test (#1098)

* Move meet-the-team page to new cypress test location

* Add join us section test

* Add our free services section test

* Add why bloom section test

* Add our bloom team section test

* Add our themes section test

* Add testimonial section test

* Add create access code badoo tests (#1102)

* Admin e2e test (#1101)

* Add ids to form fields

* Add admin dashboard tests

* build(deps): bump react-cookie-consent from 8.0.1 to 9.0.0

Bumps [react-cookie-consent](https://github.com/Mastermindzh/react-cookie-consent) from 8.0.1 to 9.0.0.
- [Release notes](https://github.com/Mastermindzh/react-cookie-consent/releases)
- [Changelog](https://github.com/Mastermindzh/react-cookie-consent/blob/master/CHANGELOG.md)
- [Commits](Mastermindzh/react-cookie-consent@8.0.1...9.0.0)

---
updated-dependencies:
- dependency-name: react-cookie-consent
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <[email protected]>

* Fix removed only after merge

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Ellie Re'em <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
  • Loading branch information
3 people committed Sep 3, 2024
1 parent 3275c75 commit ab50621
Show file tree
Hide file tree
Showing 4 changed files with 189 additions and 3 deletions.
94 changes: 94 additions & 0 deletions cypress/integration/tests/user-about-you.cy.tsx
Original file line number Diff line number Diff line change
@@ -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();
});
});
23 changes: 20 additions & 3 deletions cypress/integration/tests/user-account-settings.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand All @@ -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();
});
Expand Down
49 changes: 49 additions & 0 deletions cypress/integration/tests/user-apply-a-code.cy.tsx
Original file line number Diff line number Diff line change
@@ -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();
});
});
26 changes: 26 additions & 0 deletions cypress/integration/tests/user-disable-service-emails.cy.tsx
Original file line number Diff line number Diff line change
@@ -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();
});
});

0 comments on commit ab50621

Please sign in to comment.