From 44338b449970c17adcf44cee6e7b59d3dbdebbe7 Mon Sep 17 00:00:00 2001 From: eirikhaugstulen Date: Mon, 14 Oct 2024 12:34:09 +0200 Subject: [PATCH] fix: cleanup after tests are run --- cypress/e2e/NewPage/NewPage.feature | 3 +++ cypress/e2e/NewPage/NewPage.js | 15 +++++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/cypress/e2e/NewPage/NewPage.feature b/cypress/e2e/NewPage/NewPage.feature index 49e3d27f99..b6a7907dee 100644 --- a/cypress/e2e/NewPage/NewPage.feature +++ b/cypress/e2e/NewPage/NewPage.feature @@ -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 diff --git a/cypress/e2e/NewPage/NewPage.js b/cypress/e2e/NewPage/NewPage.js index de6efe53e2..9ef6ab3440 100644 --- a/cypress/e2e/NewPage/NewPage.js +++ b/cypress/e2e/NewPage/NewPage.js @@ -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'; @@ -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') @@ -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();