Skip to content

Commit ac04e8b

Browse files
Updated addSchedule method to pass down created name via return
1 parent 0c88699 commit ac04e8b

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
@@ -107,6 +107,9 @@ function addSchedule() {
107107
.should('be.enabled') // Checks if Save button is enabled once all required fields are filled
108108
.click(),
109109
});
110+
return cy.then(() => {
111+
return INITIAL_SCHEDULE_NAME;
112+
});
110113
}
111114

112115
function clickScheduleItem(scheduleName) {
@@ -333,12 +336,15 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
333336

334337
it('Checking whether add, edit & delete schedule works', () => {
335338
/* ===== Adding a schedule ===== */
336-
addSchedule();
337-
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
339+
addSchedule().then((createdScheduleName) => {
340+
// createdScheduleName value will be "Test-name"
341+
// Assert schedule saved flash message
342+
cy.expect_flash(flashClassMap.success, FLASH_MESSAGE_SCHEDULE_SAVED);
343+
// Selecting the schedule and intercepting the API call to get schedule details
344+
clickScheduleItem(createdScheduleName);
345+
});
338346

339347
/* ===== Editing a schedule ===== */
340-
// Selecting the schedule and intercepting the API call to get schedule details
341-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
342348
// Open edit schedule form
343349
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
344350
// Editing name and description
@@ -355,11 +361,13 @@ describe('Automate Schedule form operations: Settings > Application Settings > S
355361

356362
it('Checking whether Cancel & Reset buttons work fine in the Edit form', () => {
357363
/* ===== Adding a schedule ===== */
358-
addSchedule();
364+
addSchedule().then((createdScheduleName) => {
365+
// createdScheduleName value will be "Test-name"
366+
// Selecting the schedule and intercepting the API call to get schedule details
367+
clickScheduleItem(createdScheduleName);
368+
});
359369

360370
/* ===== Checking whether Reset button works ===== */
361-
// Selecting the schedule and intercepting the API call to get schedule details
362-
clickScheduleItem(INITIAL_SCHEDULE_NAME);
363371
// Open edit schedule form
364372
selectConfigMenu(EDIT_SCHEDULE_CONFIG_OPTION);
365373
// Editing description and start date

0 commit comments

Comments
 (0)