Skip to content

Commit ec99ce9

Browse files
Restructured after hooks
1 parent 8e70ae3 commit ec99ce9

File tree

1 file changed

+20
-24
lines changed

1 file changed

+20
-24
lines changed

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

Lines changed: 20 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,6 @@ describe('Automate Collect logs Edit form operations', () => {
192192
beforeEach(() => {
193193
registeredApiIntercepts = {};
194194
cy.login();
195-
cy.wait(500);
196195
// Navigate to Application settings and Select Diagnostics
197196
cy.menu(settingsMenuOption, appSettingsMenuOption);
198197
interceptAndAwaitApi({
@@ -228,20 +227,19 @@ describe('Automate Collect logs Edit form operations', () => {
228227
});
229228

230229
after(() => {
231-
cy?.url()?.then((url) => {
232-
// Ensures navigation to Settings -> Application-Settings in the UI
233-
if (url?.includes(componentRouteUrl)) {
230+
cy.url()
231+
?.then((url) => {
232+
// Ensures navigation to Settings -> Application-Settings in the UI
233+
if (!url?.includes(componentRouteUrl)) {
234+
// Navigate to Settings -> Application-Settings before cleanup
235+
cy.menu(settingsMenuOption, appSettingsMenuOption);
236+
}
237+
})
238+
.then(() => {
234239
resetProtocolDropdown({
235240
currentApiIntercepts: registeredApiIntercepts,
236241
});
237-
} else {
238-
// Navigate to Settings -> Application-Settings before selecting Diagnostics
239-
cy.menu(settingsMenuOption, appSettingsMenuOption);
240-
resetProtocolDropdown({
241-
currentApiIntercepts: registeredApiIntercepts,
242-
});
243-
}
244-
});
242+
});
245243
});
246244
});
247245

@@ -273,22 +271,20 @@ describe('Automate Collect logs Edit form operations', () => {
273271
});
274272

275273
after(() => {
276-
cy?.url()?.then((url) => {
277-
// Ensures navigation to Settings -> Application-Settings in the UI
278-
if (url?.includes(componentRouteUrl)) {
274+
cy.url()
275+
?.then((url) => {
276+
// Ensures navigation to Settings -> Application-Settings in the UI
277+
if (!url?.includes(componentRouteUrl)) {
278+
// Navigate to Settings -> Application-Settings before cleanup
279+
cy.menu(settingsMenuOption, appSettingsMenuOption);
280+
}
281+
})
282+
.then(() => {
279283
resetProtocolDropdown({
280284
currentApiIntercepts: registeredApiIntercepts,
281285
selectServerListItem: false,
282286
});
283-
} else {
284-
// Navigate to Settings -> Application-Settings before selecting Diagnostics
285-
cy.menu(settingsMenuOption, appSettingsMenuOption);
286-
resetProtocolDropdown({
287-
currentApiIntercepts: registeredApiIntercepts,
288-
selectServerListItem: false,
289-
});
290-
}
291-
});
287+
});
292288
});
293289
});
294290
});

0 commit comments

Comments
 (0)