Skip to content

Commit

Permalink
fix: cleanup after tests are run
Browse files Browse the repository at this point in the history
  • Loading branch information
eirikhaugstulen committed Oct 14, 2024
1 parent 5e377e6 commit 44338b4
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
3 changes: 3 additions & 0 deletions cypress/e2e/NewPage/NewPage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,9 @@ Feature: User creates a new entries from the registration page
And you fill the Malaria case diagnosis registration form with values
And you click the save malaria entity submit button
Then you see the enrollment event Edit page
# Cleanup
And you delete the recently added malaria entity


## New enrollment of existing TEI

Expand Down
15 changes: 13 additions & 2 deletions cypress/e2e/NewPage/NewPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Given, When, Then, defineStep as And } from '@badeball/cypress-cucumber-preprocessor';
import { defineStep as And, Given, Then, When } from '@badeball/cypress-cucumber-preprocessor';
import moment from 'moment';
import { getCurrentYear } from '../../support/date';

Expand All @@ -17,7 +17,7 @@ And('there should be informative message explaining you need to select an organi
});

And('you select tracked entity type person', () => {
cy.get('[data-test="dhis2-uicore-select"')
cy.get('[data-test="dhis2-uicore-select"]')
.click();
cy.get('[data-test="dhis2-uicore-singleselectoption"]')
.contains('Person')
Expand Down Expand Up @@ -645,6 +645,17 @@ And('you delete the recently added tracked entity', () => {
cy.url().should('include', 'selectedTemplateId=IpHINAT79UW');
});

And('you delete the recently added malaria entity', () => {
cy.get('[data-test="widget-profile-overflow-menu"]')
.click();
cy.contains('Delete Malaria Entity')
.click();
cy.get('[data-test="widget-profile-delete-modal"]').within(() => {
cy.contains('Yes, delete Malaria Entity')
.click();
});
});

And(/^you select (.*) from the available tracked entity types/, (selection) => {
cy.get('[data-test="dhis2-uicore-select-input"]')
.click();
Expand Down

0 comments on commit 44338b4

Please sign in to comment.