Skip to content

Commit 2ffc783

Browse files
Updated addSchedule method to pass down created name via return
1 parent b25ee46 commit 2ffc783

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
@@ -143,6 +143,9 @@ function addSchedule() {
143143
.should('be.enabled') // Checks if Save button is enabled once all required fields are filled
144144
.click(),
145145
});
146+
return cy.then(() => {
147+
return INITIAL_SCHEDULE_NAME;
148+
});
146149
}
147150

148151
function clickScheduleItem(scheduleName) {
@@ -545,12 +548,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
545548

546549
it('Checking whether add, edit & delete schedule works', () => {
547550
/* ===== Adding a schedule ===== */
548-
addSchedule();
549-
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
551+
addSchedule().then((createdScheduleName) => {
552+
// createdScheduleName value will be "Test-name"
553+
// Assert schedule saved flash message
554+
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
555+
// Selecting the schedule and intercepting the API call to get schedule details
556+
clickScheduleItem(createdScheduleName);
557+
});
550558

551559
/* ===== Editing a schedule ===== */
552-
// Selecting the schedule and intercepting the API call to get schedule details
553-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
554560
// Open edit schedule form
555561
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
556562
// Editing name and description
@@ -574,11 +580,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
574580

575581
it('Checking whether Cancel & Reset buttons work fine in the Edit form', () => {
576582
/* ===== Adding a schedule ===== */
577-
addSchedule();
583+
addSchedule().then((createdScheduleName) => {
584+
// createdScheduleName value will be "Test-name"
585+
// Selecting the schedule and intercepting the API call to get schedule details
586+
clickScheduleItem(createdScheduleName);
587+
});
578588

579589
/* ===== Checking whether Reset button works ===== */
580-
// Selecting the schedule and intercepting the API call to get schedule details
581-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
582590
// Open edit schedule form
583591
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
584592
// Editing description and start date

0 commit comments

Comments
 (0)