Skip to content

Commit

Permalink
fix: cypress tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Nov 4, 2024
1 parent 91d43cb commit 612523b
Show file tree
Hide file tree
Showing 9 changed files with 9 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ Given(/^you land on the enrollment event page with selected (.*) by having typed
When(/^the user clicks on the edit button/, () =>
cy
.get('[data-test="widget-enrollment-event"]')
.find('[data-test="dhis2-uicore-button"]')
.eq(1)
.find('[data-test="widget-enrollment-event-edit-button"]')
.click(),
);

Expand Down Expand Up @@ -206,7 +205,6 @@ And('you open the Birth stage event', () => {

Then('the edit button should be disabled', () => {
cy.get('[data-test="widget-enrollment-event"]')
.find('[data-test="dhis2-uicore-button"]')
.eq(1)
.find('[data-test="widget-enrollment-event-edit-button"]')
.should('be.disabled');
});
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,7 @@ When('the user clicks the first second antenatal care visit event', () => {
});

When(/^the user clicks the "Back to all stages and events" button/, () =>
cy
.get('[data-test="widget-enrollment-event"]')
.find('[data-test="dhis2-uicore-button"]')
.eq(0)
cy.get('[data-test="enrollment-edit-event-back-button"]')
.click(),
);

Expand Down
2 changes: 1 addition & 1 deletion cypress/e2e/TopBarActions/TopBarActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Given(/^you land on a enrollment page domain by having typed (.*)$/, (url) => {
});

When(/^the user clicks on the edit button/, () =>
cy.get('[data-test="widget-enrollment-event"]').find('[data-test="dhis2-uicore-button"]').eq(1).click(),
cy.get('[data-test="widget-enrollment-event"]').find('[data-test="widget-enrollment-event-edit-button"]').click(),
);

When('the user clicks the arrow button to see the dropdown', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@ When('you assign the user Geetha in the view mode', () => {
When('you assign the user Tracker demo User in the edit mode', () => {
cy
.get('[data-test="widget-enrollment-event"]')
.find('[data-test="dhis2-uicore-button"]')
.eq(1)
.find('[data-test="widget-enrollment-event-edit-button"]')
.click();

cy.get('[data-test="widget-assignee"]').within(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ Then('you can assign a user when scheduling the event', () => {
});

When(/^the user clicks the "Back to all stages and events" button/, () =>
cy
.get('[data-test="widget-enrollment-event"]')
.contains('Back to all stages and events')
cy.get('[data-test="enrollment-edit-event-back-button"]')
.click(),
);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,7 @@ Then(/^the scope selector list contains the text (.*)$/, (name) => {
});

When(/^the user clicks the "Back to all stages and events" button/, () =>
cy
.get('[data-test="widget-enrollment-event"]')
.contains('Back to all stages and events')
cy.get('[data-test="enrollment-edit-event-back-button"]')
.click(),
);

Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ export const WidgetsForEnrollmentEventEdit: $ReadOnly<{ [key: string]: WidgetCon

export const DefaultPageLayout: PageLayoutConfig = {
leftColumn: [
{
type: WidgetTypes.COMPONENT,
name: 'TwoEventWorkspace',
},
{
type: WidgetTypes.COMPONENT,
name: 'EditEventWorkspace',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ export const WidgetEventEditWrapper = ({ pageStatus, ...passOnProps }: WidgetPro
return (
<>
<div>
<Button secondary onClick={onGoBack}>
<Button secondary onClick={onGoBack} dataTest="enrollment-edit-event-back-button">
<IconArrowLeft24 />
{i18n.t('Back to all stages and events')}
</Button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ export const WidgetHeaderPlain = ({
disabled={disableEdit}
icon={<IconEdit24 />}
onClick={() => dispatch(startShowEditEventDataEntry(orgUnit, programCategory))}
data-test="widget-enrollment-event-edit-button"
>
{i18n.t('Edit event')}
</Button>
Expand Down

0 comments on commit 612523b

Please sign in to comment.