Skip to content

Add Random Sampling E2E Test (OP-2837)#93

Open
sunilparajuli wants to merge 2 commits intoopenimis:feature/coremis-e2e-vitefrom
sunilparajuli:feature/coremis-e2e-vite
Open

Add Random Sampling E2E Test (OP-2837)#93
sunilparajuli wants to merge 2 commits intoopenimis:feature/coremis-e2e-vitefrom
sunilparajuli:feature/coremis-e2e-vite

Conversation

@sunilparajuli
Copy link
Copy Markdown
Member

@sunilparajuli sunilparajuli commented Mar 15, 2026

PR Description: Add Random Sampling E2E Test (OP-2837)
Add E2E test for the Random Sampling module.

What was done:

Implemented the 4-step workflow in

cypress/e2e/randomsampling.cy.js
.
Improved MUI interaction commands in

cypress/support/commands.js
to ensure stability on the Vite distribution.

Verification:
Verified manually in the browser and via automated Cypress runs.
Confirmed working on the latest Docker environment.
Jira Ticket: OP-2837

@sunilparajuli sunilparajuli requested a review from weilu March 15, 2026 07:33
Comment on lines +7 to +15
cy.fixture('cred').then((cred) => {
this.cred = cred;
cy.get('input[type="text"]').type(this.cred.username);
cy.get('input[type="password"]').type(this.cred.password);
cy.get('button[type="submit"]').click();

// Ensure login is successful and we are on the home page
cy.contains('Welcome').should('be.visible');
});
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use cy.login defined in commands.js?


const randomPercent = Math.floor(Math.random() * 16) + 5;
cy.enterMuiInput('Percent of claims', randomPercent);
cy.chooseMuiSelect('Task Group', 'any');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this task group guaranteed to exist for our CI setup?

Comment on lines +642 to +649
// Fallback: if specific value not found, pick the first available option
if (!found) {
cy.wrap($options.first()).click({ force: true });
}
} else {
// Fallback: just close the dropdown by clicking the body if no options found
cy.get('body').click(0, 0);
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another PR is going to implement chooseMuiSelectFirstAvailable: https://github.com/openimis/openimis-dist_dkr/pull/84/changes#r2913544525 Consider using that instead of this fallback as the intention is more explicit.

cy.contains(/CREATE CLAIM SAMPLE/i).click({ force: true });

// Verify success confirmation and return to page
cy.contains(/New task for claim sampling was created/i).should('be.visible');
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the task creation the end of this workflow? Don't we want to check the entities are created as expected after the task is approved?

@weilu weilu changed the title Feature/coremis e2e vite Add Random Sampling E2E Test (OP-2837) Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants