Skip to content

Commit

Permalink
fix: flaky custom program stage working list tests
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Sep 26, 2023
1 parent a153053 commit ec5767d
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,19 @@ import { v4 as uuid } from 'uuid';
import '../../sharedSteps';
import '../../../sharedSteps';

const cleanUpIfApplicable = () => {
cy.buildApiUrl('programStageWorkingLists?filter=program.id:eq:qDkgAbB5Jlk&fields=id,displayName')
.then(url => cy.request(url))
.then(({ body }) => {
const workingList = body.programStageWorkingLists?.find(e => e.displayName === 'Custom Program stage list');
if (!workingList) {
return null;
}
return cy
.buildApiUrl('programStageWorkingLists', workingList.id)
.then(workingListUrl => cy.request('DELETE', workingListUrl));
});
};
Given('you open the main page with Ngelehun and child programme context', () => {
cy.visit('#/?programId=IpHINAT79UW&orgUnitId=DiszpKrYNg8');
});
Expand All @@ -13,6 +26,7 @@ Given('you open the main page with Ngelehun and WHO RMNCH Tracker context', () =
});

Given('you open the main page with Ngelehun and Malaria focus investigation context', () => {
cleanUpIfApplicable();
cy.visit('#/?programId=M3xtLkYBlKI&orgUnitId=DiszpKrYNg8');
});

Expand Down Expand Up @@ -42,6 +56,7 @@ Given('you open the main page with Ngelehun and Malaria case diagnosis context',
});

Given('you open the main page with Ngelehun and Malaria case diagnosis and Household investigation context', () => {
cleanUpIfApplicable();
cy.visit('#/?programId=qDkgAbB5Jlk&orgUnitId=DiszpKrYNg8');

cy.get('[data-test="tei-working-lists"]')
Expand Down Expand Up @@ -740,3 +755,4 @@ Then('the program stage custom working list filters are loaded', () => {
.find('[data-test="more-filters"]')
.should('have.length', 2);
});

0 comments on commit ec5767d

Please sign in to comment.