Skip to content

Commit fd4c3e3

Browse files
test(end-to-end): Remove useless witForNavigation
1 parent 7cc7711 commit fd4c3e3

File tree

4 files changed

+0
-19
lines changed

4 files changed

+0
-19
lines changed

tests/e2e-ddev/__tests__/1-activate-plugin.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ const {
99
} = require("../utils/constants");
1010

1111
const {
12-
waitForNavigation,
1312
goToAdmin,
1413
onLoginPageLoginAsAdmin,
1514
wait,
@@ -32,7 +31,6 @@ describe(`Setup CrowdSec plugin`, () => {
3231
await page.click('[aria-label="Activate CrowdSec"]');
3332
}
3433

35-
await waitForNavigation;
3634
await expect(page).toHaveText("#message", "Plugin activated.");
3735
});
3836
});

tests/e2e-ddev/__tests__/4-live-mode-cache.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
/* eslint-disable no-undef */
22
const {
33
wait,
4-
waitForNavigation,
54
goToAdmin,
65
onAdminGoToAdvancedPage,
76
onAdminSaveSettings,
@@ -29,7 +28,6 @@ describe(`Run in Live mode`, () => {
2928
await goToAdmin();
3029
await onAdminGoToAdvancedPage();
3130
await page.click("#crowdsec_prune_cache");
32-
await waitForNavigation;
3331

3432
await expect(page).toHaveText(
3533
"#wpbody-content > div.wrap > div.notice.notice-success",
@@ -56,7 +54,6 @@ describe(`Run in Live mode`, () => {
5654
await dialog.accept();
5755
});
5856
await page.click("#crowdsec_clear_cache");
59-
await waitForNavigation;
6057

6158
await expect(page).toHaveText(
6259
"#wpbody-content > div.wrap > div.notice.notice-success",

tests/e2e-ddev/__tests__/5-stream-mode.js

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
/* eslint-disable no-undef */
22
const {
3-
waitForNavigation,
43
goToAdmin,
54
onAdminGoToAdvancedPage,
65
onAdminGoToSettingsPage,
@@ -49,7 +48,6 @@ describe(`Run in Stream mode`, () => {
4948
await goToAdmin();
5049
await onAdminGoToAdvancedPage();
5150
await page.click("#crowdsec_refresh_cache");
52-
await waitForNavigation;
5351

5452
await expect(page).toHaveText(
5553
"#wpbody-content > div.wrap > div.notice.notice-success",
@@ -80,7 +78,6 @@ describe(`Run in Stream mode`, () => {
8078
await goToAdmin();
8179
await onAdminGoToAdvancedPage();
8280
await page.click("#crowdsec_refresh_cache");
83-
await waitForNavigation;
8481

8582
await expect(page).toHaveText(
8683
"#wpbody-content > div.wrap > div.notice.notice-success",

tests/e2e-ddev/utils/helpers.js

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,24 +16,19 @@ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
1616

1717
jest.setTimeout(TIMEOUT);
1818

19-
const waitForNavigation = page.waitForNavigation();
20-
2119
const goToAdmin = async () => {
2220
await page.goto(ADMIN_URL);
23-
await waitForNavigation;
2421
};
2522

2623
const goToPublicPage = async () => {
2724
await page.goto(`${BASE_URL}`);
28-
await waitForNavigation;
2925
};
3026

3127
const onAdminGoToSettingsPage = async () => {
3228
// CrowdSec Menu
3329
await page.click(
3430
"#adminmenuwrap > #adminmenu > #toplevel_page_crowdsec_plugin > .wp-has-submenu > .wp-menu-name",
3531
);
36-
await waitForNavigation;
3732
};
3833

3934
const onAdminGoToAdvancedPage = async () => {
@@ -42,7 +37,6 @@ const onAdminGoToAdvancedPage = async () => {
4237
await page.click(
4338
"#toplevel_page_crowdsec_plugin > ul > li:nth-child(4) > a",
4439
);
45-
await waitForNavigation;
4640
await wait(1000);
4741
await expect(page).toMatchTitle(/Advanced/);
4842
};
@@ -53,7 +47,6 @@ const onAdminGoToThemePage = async () => {
5347
await page.click(
5448
"#toplevel_page_crowdsec_plugin > ul > li:nth-child(3) > a",
5549
);
56-
await waitForNavigation;
5750
await wait(1000);
5851

5952
await expect(page).toMatchTitle(/Theme customization/);
@@ -64,12 +57,10 @@ const onLoginPageLoginAsAdmin = async () => {
6457
await page.fill("#user_pass", ADMIN_PASSWORD);
6558
await page.waitForSelector("#wp-submit");
6659
await page.click("#wp-submit");
67-
await waitForNavigation;
6860
};
6961

7062
const onAdminSaveSettings = async (check = true) => {
7163
await page.click("[type=submit]");
72-
await waitForNavigation;
7364

7465
if (check) {
7566
await expect(page).toHaveText(
@@ -201,7 +192,6 @@ const removeAllDecisions = async () => {
201192

202193
const onCaptchaPageRefreshCaptchaImage = async () => {
203194
await page.click("#refresh_link");
204-
await waitForNavigation;
205195
};
206196

207197
const forceCronRun = async () => {
@@ -251,7 +241,6 @@ const setDefaultConfig = async () => {
251241
module.exports = {
252242
addDecision,
253243
wait,
254-
waitForNavigation,
255244
goToAdmin,
256245
goToPublicPage,
257246
onAdminGoToSettingsPage,

0 commit comments

Comments
 (0)