Skip to content

Commit 0e7439e

Browse files
Restructured after hooks
1 parent e360439 commit 0e7439e

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
@@ -193,7 +193,6 @@ describe('Automate Collect logs Edit form operations', () => {
193193
beforeEach(() => {
194194
registeredApiIntercepts = {};
195195
cy.login();
196-
cy.wait(500);
197196
// Navigate to Application settings and Select Diagnostics
198197
cy.menu(settingsMenuOption, appSettingsMenuOption);
199198
interceptAndAwaitApi({
@@ -229,20 +228,19 @@ describe('Automate Collect logs Edit form operations', () => {
229228
});
230229

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

@@ -274,22 +272,20 @@ describe('Automate Collect logs Edit form operations', () => {
274272
});
275273

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

0 commit comments

Comments
 (0)