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

Account e2e test #1099

Merged
merged 34 commits into from
Sep 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
5220b61
Move welcome e2e tests to tests folder
boodland Aug 26, 2024
261c5a5
Tidy up existing test
boodland Aug 26, 2024
875762d
Add header section test
boodland Aug 26, 2024
2e8cf6c
Add account actions section test
boodland Aug 26, 2024
e88c6d2
Simplify image src value
boodland Aug 26, 2024
65f0c80
Add Apply code tests
boodland Aug 26, 2024
ad11bff
Remove non used var
boodland Aug 26, 2024
9260dd3
Add about-you page tests
boodland Aug 26, 2024
4807605
Add disable service emails tests
boodland Aug 26, 2024
9eb70e4
fix: stop pre-commit add all command
eleanorreem Aug 26, 2024
e38bfe0
upgrade: cypress
eleanorreem Aug 26, 2024
8250c81
fix: hydration issue in meet the team page
eleanorreem Aug 26, 2024
571f31c
move: cypress tests into correct folder
eleanorreem Aug 26, 2024
c7ac71c
fix: racey cypress tests
eleanorreem Aug 26, 2024
5a0b920
fix: timeouts in cypress tests and removing async
eleanorreem Aug 26, 2024
86c6def
fix: async issues in reset password cypress test
eleanorreem Aug 26, 2024
77ddbfa
feat: fix checkPageUrl
eleanorreem Aug 27, 2024
5cdbe64
Fix: racey user account page tests
eleanorreem Aug 27, 2024
675bde2
fix: don't clean up users after test run only before
eleanorreem Aug 27, 2024
0391a3d
fix: urls now that the NEXT_PUBLIC_API_URL no longer has a trailing s…
eleanorreem Aug 27, 2024
ab7dc19
fix: return user in cy.logInWithEMailAndPassword
eleanorreem Aug 27, 2024
8c0d78c
fix: signInWithEmailAndPassword cypress command
eleanorreem Aug 27, 2024
535b431
fix: before.cy.tsx to chain events properly
eleanorreem Aug 27, 2024
eaf3132
fix: checkPageUrl
eleanorreem Aug 27, 2024
3f2693b
fix: checkUrl should check pathname not full url
eleanorreem Aug 27, 2024
d1d1a33
fix: remove after.tsx
eleanorreem Aug 27, 2024
c085cbc
fix: meet-the-team cypress test
eleanorreem Aug 28, 2024
47e79ab
Home e2e test (#1098)
boodland Aug 28, 2024
73e57ed
Add create access code badoo tests (#1102)
boodland Aug 28, 2024
6725d85
Admin e2e test (#1101)
boodland Aug 28, 2024
68d702b
build(deps): bump react-cookie-consent from 8.0.1 to 9.0.0
dependabot[bot] Aug 14, 2024
b3c8b03
Merge branch 'develop' into account-e2e-test
boodland Aug 30, 2024
ee91c0a
Fix removed only after merge
boodland Aug 30, 2024
cd17209
Merge branch 'account-e2e-test' of https://github.com/boodland/bloom-…
boodland Aug 30, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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();
});
});
Loading