Skip to content

Commit

Permalink
Subscription e2e test (#1103)
Browse files Browse the repository at this point in the history
* Add id to phone input

* Create subscription whatsapp data

* Create subscription whatsapp 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: add cy.wait as form seems to detach in user-account-settings.tsx

* fix: checkUrl should check pathname not full url

* fix: extend wait for email  form to reload

* 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]>

* Merge subscription tests within notes

---------

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 ab50621 commit f796e84
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 0 deletions.
2 changes: 2 additions & 0 deletions components/forms/PhoneInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ const PhoneInput = (props: PhoneInputProps) => {

return (
<TextField
id="phoneNumber"
name="phoneNumber"
variant="standard"
label={t('phoneNumber')}
color="primary"
Expand Down
40 changes: 40 additions & 0 deletions cypress/fixtures/subscription-whatsapp.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"notes": [
{
"question": "What will the messages say?",
"answer": "Our notes to you will contain encouragement, affirmations, quotes, snippets of our Bloom content, links to our course sessions, resources, grounding exercises, and more!"
},
{
"question": "What languages will the notes be in? ",
"answer": "Our notes are currently only available in English."
},
{
"question": "Can I receive the messages by SMS or another platform?",
"answer": "This service is currently only available via WhatsApp"
},
{
"question": "When will I receive the messages?",
"answer": "We send two messages a week, on Wednesdays and Sundays. You will receive the messages between 11am and 1pm UK time. If you are in other parts of the world, you can use this "
},
{
"question": "How do I keep myself safe when receiving messages?",
"answer": "Once you receive your first message, you can save our Bloom WhatsApp number. Some people prefer to name it as a person such as ‘Lucia’ to keep messages discreet. We will be talking about the content of our Bloom courses in our messages, and there will be references to trauma, healing, sex, and relationships. Your name and number is only viewable by our Bloom team and we keep all of your information completely confidential."
},
{
"question": "How do I unsubscribe from messages?",
"answer": "To stop receiving messages from us, click on the 'Notes' tab in Bloom. You will see a section titled 'Manage your subscription'. Enter the telephone number you used to sign up and click 'Unsubscribe'."
},
{
"question": "Do I need to have taken a course to sign up?",
"answer": "No! Notes from Bloom is for everyone, regardless of where you are in your journey with Bloom. You can sign up if you’ve taken one session, multiple sessions, or are yet to begin."
},
{
"question": "How can I access further support?",
"answer": "Our Bloom and Chayn team are from different parts of the world and we manage"
},
{
"question": "How will I be able to share my tips and experiences?",
"answer": "You can contact us via our chat service on Bloom to share with us at any time. To start a chat, click on the chatbox that appears in the right-hand corner of Bloom. We will periodically send you surveys that you can fill in anonymously, where you can share your tips and experiences of your healing journey."
}
]
}
68 changes: 68 additions & 0 deletions cypress/integration/tests/notes.cy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,74 @@ describe('A logged in user should be able to subscribe to notes from bloom', ()
cy.get('p', { timeout: 3000 }).should('contain', 'Your phone number appears to be invalid'); //check the form submission fails
});

describe('Notes page should display', () => {
const SUBSCRIPTION_WHATSAPP_PAGE_URL = '/subscription/whatsapp';

beforeEach(() => {
cy.visit(SUBSCRIPTION_WHATSAPP_PAGE_URL);
});

it('heading section', () => {
cy.get('h1').should('contain', 'Sign up to Notes from Bloom');
cy.get('p').should(
'contain',
'The path to healing can be lonely and sometimes thorny. Our Notes from Bloom are twice-weekly reminders, encouragement, affirmations, and activities from our courses, sent directly to your phone to help you continue your healing journey.',
);
cy.get('p').should(
'contain',
'Notes from Bloom is another way to connect with Bloom and anyone can sign up — whether you’re yet to start digging into our courses or have finished multiple sessions.',
);
cy.get('p').should(
'contain',
'You’ll be able to contribute to making Bloom better for you, and everyone else, by anonymously sharing your tips and experiences. Curated by Bloom’s global community of survivors and allies, Notes from Bloom are buds to remind you that we are here to support you, wherever you are. Our notes are currently only available in English.',
);
cy.checkImage('Illustration of a phone with a message', 'illustration_notes');
});

it('subscribe to notes section', () => {
cy.checkImage(
`Illustration of a side profile of a person's face, with a flower`,
'illustration_choose_therapist',
);
cy.get('p').should('contain', 'We send messages to your Whatsapp number.');
cy.checkImage(
`Illustration of a calendar with a heart in the middle`,
'illustration_date_selector',
);
cy.get('p').should(
'contain',
'The messages are sent twice a week, on Wednesdays and Sundays.',
);
cy.checkImage(
`Illustration of a cycle - three suns in a circle with arrows between them`,
'illustration_change',
);
cy.get('p').should(
'contain',
'If you change your mind, you can un-subscribe or resubscribe at any time.',
);

cy.get('h2').should('contain', 'Subscribe to Notes from Bloom');
cy.get('label').contains('Phone number');
cy.get('input[aria-hidden="true"]').should('exist').should('have.value', 'gb');
cy.get('input[id="phoneNumber"]').should('exist').should('have.prop', 'type', 'tel');
cy.get('button').contains('Subscribe').should('have.prop', 'type', 'submit');
});

it('more about section', () => {
cy.get('h2').should('contain', 'More about Notes from Bloom');
cy.checkImage('alt', 'illustration_leaf_mix');

cy.fixture('subscription-whatsapp').then(
(data: { notes: { question: string; answer: string }[] }) => {
data.notes.forEach((note) => {
cy.get('p').contains(note.question).parents('.MuiAccordion-root').contains(note.answer);
});
},
);
});
});

after(() => {
cy.logout();
});
Expand Down

0 comments on commit f796e84

Please sign in to comment.