Skip to content

Commit 1401207

Browse files
Updated addSchedule method to pass down created name via return
1 parent b00c16b commit 1401207

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) {
@@ -529,12 +532,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
529532

530533
it('Checking whether add, edit & delete schedule works', () => {
531534
/* ===== Adding a schedule ===== */
532-
addSchedule();
533-
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
535+
addSchedule().then((createdScheduleName) => {
536+
// createdScheduleName value will be "Test-name"
537+
// Assert schedule saved flash message
538+
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
539+
// Selecting the schedule and intercepting the API call to get schedule details
540+
clickScheduleItem(createdScheduleName);
541+
});
534542

535543
/* ===== Editing a schedule ===== */
536-
// Selecting the schedule and intercepting the API call to get schedule details
537-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
538544
// Open edit schedule form
539545
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
540546
// Editing name and description
@@ -558,11 +564,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
558564

559565
it('Checking whether Cancel & Reset buttons work fine in the Edit form', () => {
560566
/* ===== Adding a schedule ===== */
561-
addSchedule();
567+
addSchedule().then((createdScheduleName) => {
568+
// createdScheduleName value will be "Test-name"
569+
// Selecting the schedule and intercepting the API call to get schedule details
570+
clickScheduleItem(createdScheduleName);
571+
});
562572

563573
/* ===== Checking whether Reset button works ===== */
564-
// Selecting the schedule and intercepting the API call to get schedule details
565-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
566574
// Open edit schedule form
567575
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
568576
// Editing description and start date

0 commit comments

Comments
 (0)