Skip to content

Commit 9e39c71

Browse files
Updated addSchedule method to pass down created name via return
1 parent 1c4c112 commit 9e39c71

File tree

1 file changed

+15
-7
lines changed

1 file changed

+15
-7
lines changed

cypress/e2e/ui/Settings/Application-Settings/schedule.cy.js

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,9 @@ function addSchedule() {
125125
.should('be.enabled') // Checks if Save button is enabled once all required fields are filled
126126
.click(),
127127
});
128+
return cy.then(() => {
129+
return INITIAL_SCHEDULE_NAME;
130+
});
128131
}
129132

130133
function clickScheduleItem(scheduleName) {
@@ -489,12 +492,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
489492

490493
it('Checking whether add, edit & delete schedule works', () => {
491494
/* ===== Adding a schedule ===== */
492-
addSchedule();
493-
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
495+
addSchedule().then((createdScheduleName) => {
496+
// createdScheduleName value will be "Test-name"
497+
// Assert schedule saved flash message
498+
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
499+
// Selecting the schedule and intercepting the API call to get schedule details
500+
clickScheduleItem(createdScheduleName);
501+
});
494502

495503
/* ===== Editing a schedule ===== */
496-
// Selecting the schedule and intercepting the API call to get schedule details
497-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
498504
// Open edit schedule form
499505
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
500506
// Editing name and description
@@ -511,11 +517,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
511517

512518
it('Checking whether Cancel & Reset buttons work fine in the Edit form', () => {
513519
/* ===== Adding a schedule ===== */
514-
addSchedule();
520+
addSchedule().then((createdScheduleName) => {
521+
// createdScheduleName value will be "Test-name"
522+
// Selecting the schedule and intercepting the API call to get schedule details
523+
clickScheduleItem(createdScheduleName);
524+
});
515525

516526
/* ===== Checking whether Reset button works ===== */
517-
// Selecting the schedule and intercepting the API call to get schedule details
518-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
519527
// Open edit schedule form
520528
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
521529
// Editing description and start date

0 commit comments

Comments
 (0)