Skip to content

Commit

Permalink
Merge pull request #1107 from chaynHQ/develop
Browse files Browse the repository at this point in the history
Merge Develop onto Main
  • Loading branch information
eleanorreem authored Aug 28, 2024
2 parents a4df2a5 + 3275c75 commit f75c8b1
Show file tree
Hide file tree
Showing 6 changed files with 109 additions and 5 deletions.
6 changes: 6 additions & 0 deletions components/forms/CreatePartnerAdminForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ const CreatePartnerAdminForm = () => {
return (
<form autoComplete="off" onSubmit={submitHandler}>
<TextField
id="selectPartner"
name="selectPartner"
key="select-partner"
fullWidth
select
Expand All @@ -124,6 +126,8 @@ const CreatePartnerAdminForm = () => {
</TextField>

<TextField
id="email"
name="email"
key="email-input"
onChange={(e) => setEmail(e.target.value)}
label={t('emailAddressLabel')}
Expand All @@ -134,6 +138,8 @@ const CreatePartnerAdminForm = () => {
value={email}
/>
<TextField
id="name"
name="name"
key="name-input"
onChange={(e) => setName(e.target.value)}
label={t('nameLabel')}
Expand Down
2 changes: 2 additions & 0 deletions components/forms/UpdatePartnerAdminForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,8 @@ const UpdatePartnerAdminForm = () => {
return !formSubmitSuccess ? (
<form autoComplete="off" onSubmit={submitHandler}>
<Autocomplete
id="partnerAdmin"
componentName="partnerAdmin"
value={autocompleteInputValue}
onChange={onChange}
onInputChange={onInputChange}
Expand Down
56 changes: 56 additions & 0 deletions cypress/integration/tests/admin-dashboard.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
describe('Admin dashboard page should display', () => {
const superAdminEmail = Cypress.env('CYPRESS_SUPER_ADMIN_EMAIL') as string;
const superAdminPassword = Cypress.env('CYPRESS_SUPER_ADMIN_PASSWORD');
const adminDashboardUrl = '/admin/dashboard';

before(() => {
cy.cleanUpTestState();
cy.logInWithEmailAndPassword(superAdminEmail, superAdminPassword);
});

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

it('header section', () => {
cy.get('h2').should('contain', 'Superadmin dashboard');
});

it('create an admin account panel', () => {
cy.get('h2').should('contain', 'Create an admin account');
cy.get('p').should('contain', 'Admin accounts are able to generate therapy codes');

cy.get('label.Mui-required').contains('Select the partner');
cy.get('input[name="selectPartner"]').should('exist');

cy.get('label.Mui-required').contains('Email address');
cy.get('input[id="email"]').should('exist');

cy.get('label.Mui-required').contains('Name');
cy.get('input[id="name"]').should('exist');

cy.get('button').contains('Create an admin account');
});

it('update therapy sessions panel', () => {
cy.get('h2').should('contain', 'Update therapy sessions');

cy.get('label').contains(`Type a user's email address`);
cy.get('input[id="user-email-address-search"]').should('exist');

cy.get('button').contains('Update therapy sessions');
});

it('update partner admin panel', () => {
cy.get('h2').should('contain', 'Update partner admin');

cy.get('label').contains('Type at least 4 letters');
cy.get('input[id="partnerAdmin"]').should('exist');

cy.get('button').contains('Update partner admin');
});

after(() => {
cy.logout();
});
});
40 changes: 40 additions & 0 deletions cypress/integration/tests/create-access-code.badoo.cy.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
describe('Create access code page should display', () => {
const badooEmail = Cypress.env('CYPRESS_BADOO_PARTNER_ADMIN_EMAIL') as string;
const badooPassword = Cypress.env('CYPRESS_BADOO_PARTNER_ADMIN_PASSWORD');

before(() => {
cy.cleanUpTestState();
cy.logInWithEmailAndPassword(badooEmail, badooPassword);
});

beforeEach(() => {
cy.visit('/partner-admin/create-access-code');
});

it('header section', () => {
cy.get('h2').should('contain', 'Create access codes');
cy.checkImage('Badoo logo', 'badoo_logo');
});

it('Create access codes panel', () => {
cy.get('h2').should('contain', 'Create access codes');
cy.get('p').should(
'contain',
'Use this form to create an access code every time you want to give someone access to Bloom.',
);

cy.get('legend').contains('Select support type offered to this user');
cy.get('input')
.should('exist')
.should('have.prop', 'type', 'radio')
.should('have.value', 'therapy')
.parents('label')
.contains('Courses, 1:1 chat and six therapy sessions');

cy.get('button').contains('Create access codes').should('have.prop', 'type', 'submit');
});

after(() => {
cy.logout();
});
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"nuka-carousel": "^7.0.0",
"phone": "^3.1.33",
"react": "^18.3.1",
"react-cookie-consent": "^8.0.1",
"react-cookie-consent": "^9.0.0",
"react-dom": "^18.3.1",
"react-international-phone": "^4.0.4",
"react-player": "^2.13.0",
Expand Down
8 changes: 4 additions & 4 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7958,10 +7958,10 @@ randombytes@^2.1.0:
dependencies:
safe-buffer "^5.1.0"

react-cookie-consent@^8.0.1:
version "8.0.1"
resolved "https://registry.yarnpkg.com/react-cookie-consent/-/react-cookie-consent-8.0.1.tgz#83526a39c19be82872e9374c6fef98d05e12e5ba"
integrity sha512-4A2jzPQDFfBhtxIz4hYX+vJ0QnOknGdOXpEoetXzgwUrMtxVJVow8YgBsGerNt5rJI7WhKkHwr8LmxekxgVejg==
react-cookie-consent@^9.0.0:
version "9.0.0"
resolved "https://registry.yarnpkg.com/react-cookie-consent/-/react-cookie-consent-9.0.0.tgz#26dc3a3387cc8524275864a4ed4584af881435f0"
integrity sha512-Blyj+m+Zz7SFHYqT18p16EANgnSg2sIyU6Yp3vk83AnOnSW7qnehPkUe4+8+qxztJrNmCH5GP+VHsWzAKVOoZA==
dependencies:
js-cookie "^2.2.1"

Expand Down

0 comments on commit f75c8b1

Please sign in to comment.