Skip to content

Commit

Permalink
test: scenario for removing the assigned user
Browse files Browse the repository at this point in the history
  • Loading branch information
simonadomnisoru committed Jan 23, 2024
1 parent 8529d35 commit c272d46
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
17 changes: 15 additions & 2 deletions cypress/e2e/WidgetsForEnrollmentPages/WidgetAssignee/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ import { When, Then } from '@badeball/cypress-cucumber-preprocessor';

When('you assign the user Geetha in the view mode', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-assignee-edit"]').click();
cy.get('[data-test="dhis2-uicore-chip-remove"]').click();
cy.get('[data-test="widget-assignee-assign"]').click();
cy.get('[data-test="capture-ui-input"]').type('Geetha');
cy.contains('Geetha Alwan').click();
cy.get('[data-test="widget-assignee-save"]').click();
Expand All @@ -26,6 +25,14 @@ When('you assign the user Tracker demo User in the edit mode', () => {
});
});

When('you remove the assigned user', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-assignee-edit"]').click();
cy.get('[data-test="dhis2-uicore-chip-remove"]').click();
cy.get('[data-test="widget-assignee-save"]').click();
});
});

Then('the event has the user Geetha Alwan assigned', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-contents"]').contains('Geetha Alwan').should('exist');
Expand All @@ -37,3 +44,9 @@ Then('the event has the user Tracker demo User assigned', () => {
cy.get('[data-test="widget-contents"]').contains('Tracker demo User').should('exist');
});
});

Then('the event has no assignd user', () => {
cy.get('[data-test="widget-assignee"]').within(() => {
cy.get('[data-test="widget-contents"]').contains('No one is assigned to this event').should('exist');
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -105,8 +105,10 @@ Feature: The user interacts with the widgets on the enrollment edit event
Then list should contain the new comment: new test comment

Scenario: You can assign a user to a event
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=SObENdEf76z&orgUnitId=g8upMTyEZGZ
Given you land on the enrollment edit event page by having typed /#/enrollmentEventEdit?eventId=veuwiLC2x0e&orgUnitId=g8upMTyEZGZ
When you assign the user Geetha in the view mode
Then the event has the user Geetha Alwan assigned
When you assign the user Tracker demo User in the edit mode
Then the event has the user Tracker demo User assigned
When you remove the assigned user
Then the event has no assignd user

0 comments on commit c272d46

Please sign in to comment.