Skip to content

Commit

Permalink
fix: cypress for NewPage
Browse files Browse the repository at this point in the history
  • Loading branch information
henrikmv committed Feb 23, 2024
1 parent fcd6dd4 commit aad87d5
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 23 deletions.
15 changes: 5 additions & 10 deletions cypress/e2e/NewPage.feature
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,7 @@ Feature: User creates a new entries from the registration page
Given you are in the main page with no selections made
And you select org unit
And you select the Contraceptives Voucher Program
Then you see a split button
When you click the the "Create new event" option
When you click the Create new button
Then you are navigated to the Contraceptives Voucher Program registration page with program selected
And there should be informative message explaining you need to complete your selections

Expand Down Expand Up @@ -57,8 +56,7 @@ Feature: User creates a new entries from the registration page
Given you are in the main page with no selections made
And you select org unit
And you select Child Programme
Then you see a split button
When you click the "Create new in another program..." option
When you click the first option in split button dropdown
Then you are navigated to the registration page without program selected
And you see the dropdown menu for selecting tracked entity type
And you have no program selection
Expand All @@ -67,8 +65,7 @@ Feature: User creates a new entries from the registration page
Given you are in the main page with no selections made
And you select org unit
And you select Child Programme
Then you see a split button
When you click the the first option
When you click the Create new button
Then you are navigated to the Child Programme registration page with program selected
And you see a registration form for the Child Programme
And you have Child Programme selected
Expand All @@ -77,8 +74,7 @@ Feature: User creates a new entries from the registration page
Given you are in the main page with no selections made
And you select org unit
And you select the Contraceptives Voucher Program
Then you see a split button
When you click the the first option
When you click the Create new button
Then you are navigated to the Contraceptives Voucher Program registration page with program selected
And there should be informative message explaining you need to complete your selections
When you select the first category
Expand All @@ -90,8 +86,7 @@ Feature: User creates a new entries from the registration page
And you select the Antenatal care visit program
Then you see a list of events
When you select one of the events
Then you see a split button
When you click the the first option
When you click the Create new button
Then you are navigated to the Antenatal care visit registration page
Then program and organisation unit is still selected in top bar

Expand Down
17 changes: 4 additions & 13 deletions cypress/e2e/NewPage/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -203,22 +203,13 @@ When('you select the Inpatient morbidity and mortality program', () => {
.click();
});

When('you click the "Create new in another program..." option', () => {
cy.get('[data-test="new-button-toggle"]')
.click();
cy.get('[data-test="new-menuitem-one"]')
.click();
});


When('you see a split button', () => {
When('you click the Create new button', () => {
cy.get('[data-test="new-button"]')
.contains('Create new')
.should('exist');
.click();
});

When('you click the the first option', () => {
cy.get('[data-test="new-button"]')
When('you click the first option in split button dropdown', () => {
cy.get('[data-test="new-button-toggle"]')
.click();
cy.get('[data-test="new-menuitem-one"]')
.click();
Expand Down

0 comments on commit aad87d5

Please sign in to comment.