Skip to content

Commit 5223e52

Browse files
Updated addSchedule method to pass down created name via return
1 parent 8c2e598 commit 5223e52

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
@@ -124,6 +124,9 @@ function addSchedule() {
124124
.should('be.enabled') // Checks if Save button is enabled once all required fields are filled
125125
.click(),
126126
});
127+
return cy.then(() => {
128+
return INITIAL_SCHEDULE_NAME;
129+
});
127130
}
128131

129132
function clickScheduleItem(scheduleName) {
@@ -481,12 +484,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
481484

482485
it('Checking whether add, edit & delete schedule works', () => {
483486
/* ===== Adding a schedule ===== */
484-
addSchedule();
485-
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
487+
addSchedule().then((createdScheduleName) => {
488+
// createdScheduleName value will be "Test-name"
489+
// Assert schedule saved flash message
490+
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
491+
// Selecting the schedule and intercepting the API call to get schedule details
492+
clickScheduleItem(createdScheduleName);
493+
});
486494

487495
/* ===== Editing a schedule ===== */
488-
// Selecting the schedule and intercepting the API call to get schedule details
489-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
490496
// Open edit schedule form
491497
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
492498
// Editing name and description
@@ -503,11 +509,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
503509

504510
it('Checking whether Cancel & Reset buttons work fine in the Edit form', () => {
505511
/* ===== Adding a schedule ===== */
506-
addSchedule();
512+
addSchedule().then((createdScheduleName) => {
513+
// createdScheduleName value will be "Test-name"
514+
// Selecting the schedule and intercepting the API call to get schedule details
515+
clickScheduleItem(createdScheduleName);
516+
});
507517

508518
/* ===== Checking whether Reset button works ===== */
509-
// Selecting the schedule and intercepting the API call to get schedule details
510-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
511519
// Open edit schedule form
512520
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
513521
// Editing description and start date

0 commit comments

Comments
 (0)