Skip to content

Commit

Permalink
test(end-to-end): Remove useless witForNavigation
Browse files Browse the repository at this point in the history
  • Loading branch information
julienloizelet committed Dec 19, 2022
1 parent 7cc7711 commit fd4c3e3
Show file tree
Hide file tree
Showing 4 changed files with 0 additions and 19 deletions.
2 changes: 0 additions & 2 deletions tests/e2e-ddev/__tests__/1-activate-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ const {
} = require("../utils/constants");

const {
waitForNavigation,
goToAdmin,
onLoginPageLoginAsAdmin,
wait,
Expand All @@ -32,7 +31,6 @@ describe(`Setup CrowdSec plugin`, () => {
await page.click('[aria-label="Activate CrowdSec"]');
}

await waitForNavigation;
await expect(page).toHaveText("#message", "Plugin activated.");
});
});
3 changes: 0 additions & 3 deletions tests/e2e-ddev/__tests__/4-live-mode-cache.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
/* eslint-disable no-undef */
const {
wait,
waitForNavigation,
goToAdmin,
onAdminGoToAdvancedPage,
onAdminSaveSettings,
Expand Down Expand Up @@ -29,7 +28,6 @@ describe(`Run in Live mode`, () => {
await goToAdmin();
await onAdminGoToAdvancedPage();
await page.click("#crowdsec_prune_cache");
await waitForNavigation;

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

await expect(page).toHaveText(
"#wpbody-content > div.wrap > div.notice.notice-success",
Expand Down
3 changes: 0 additions & 3 deletions tests/e2e-ddev/__tests__/5-stream-mode.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable no-undef */
const {
waitForNavigation,
goToAdmin,
onAdminGoToAdvancedPage,
onAdminGoToSettingsPage,
Expand Down Expand Up @@ -49,7 +48,6 @@ describe(`Run in Stream mode`, () => {
await goToAdmin();
await onAdminGoToAdvancedPage();
await page.click("#crowdsec_refresh_cache");
await waitForNavigation;

await expect(page).toHaveText(
"#wpbody-content > div.wrap > div.notice.notice-success",
Expand Down Expand Up @@ -80,7 +78,6 @@ describe(`Run in Stream mode`, () => {
await goToAdmin();
await onAdminGoToAdvancedPage();
await page.click("#crowdsec_refresh_cache");
await waitForNavigation;

await expect(page).toHaveText(
"#wpbody-content > div.wrap > div.notice.notice-success",
Expand Down
11 changes: 0 additions & 11 deletions tests/e2e-ddev/utils/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,24 +16,19 @@ const wait = (ms) => new Promise((resolve) => setTimeout(resolve, ms));

jest.setTimeout(TIMEOUT);

const waitForNavigation = page.waitForNavigation();

const goToAdmin = async () => {
await page.goto(ADMIN_URL);
await waitForNavigation;
};

const goToPublicPage = async () => {
await page.goto(`${BASE_URL}`);
await waitForNavigation;
};

const onAdminGoToSettingsPage = async () => {
// CrowdSec Menu
await page.click(
"#adminmenuwrap > #adminmenu > #toplevel_page_crowdsec_plugin > .wp-has-submenu > .wp-menu-name",
);
await waitForNavigation;
};

const onAdminGoToAdvancedPage = async () => {
Expand All @@ -42,7 +37,6 @@ const onAdminGoToAdvancedPage = async () => {
await page.click(
"#toplevel_page_crowdsec_plugin > ul > li:nth-child(4) > a",
);
await waitForNavigation;
await wait(1000);
await expect(page).toMatchTitle(/Advanced/);
};
Expand All @@ -53,7 +47,6 @@ const onAdminGoToThemePage = async () => {
await page.click(
"#toplevel_page_crowdsec_plugin > ul > li:nth-child(3) > a",
);
await waitForNavigation;
await wait(1000);

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

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

if (check) {
await expect(page).toHaveText(
Expand Down Expand Up @@ -201,7 +192,6 @@ const removeAllDecisions = async () => {

const onCaptchaPageRefreshCaptchaImage = async () => {
await page.click("#refresh_link");
await waitForNavigation;
};

const forceCronRun = async () => {
Expand Down Expand Up @@ -251,7 +241,6 @@ const setDefaultConfig = async () => {
module.exports = {
addDecision,
wait,
waitForNavigation,
goToAdmin,
goToPublicPage,
onAdminGoToSettingsPage,
Expand Down

0 comments on commit fd4c3e3

Please sign in to comment.