Skip to content

Commit

Permalink
Modify health check functions, remove unused feature
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Jun 20, 2024
1 parent 8079e52 commit b2580cd
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 17 deletions.
33 changes: 24 additions & 9 deletions healthcheck.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import chalk from "chalk";
import wp from "./utils/commands";
import { PageUtils } from './utils/page-utils';
import { WP_BASE_URL } from "./config/wp.config";
import { chromium, Browser, Page } from 'playwright';
import {PageUtils} from './utils/page-utils';
import {WP_BASE_URL} from "./config/wp.config";
import {chromium as chrome, expect, Page} from '@playwright/test';
import {Sections} from "./src/common/sections";
import {selectors as pluginSelectors} from "./src/common/selectors";

Expand All @@ -27,23 +27,38 @@ export async function checkWPStatus(): Promise<void> {
console.log(chalk.blue('-------------------------'));
}


async function setupBrowser(headless: boolean = false):Promise<Page> {
const browser = await chrome.launch({ headless });
const context = await browser.newContext();

return await context.newPage();
}

export async function openE2EPage(): Promise<void> {
const browser: Browser = await chromium.launch({ headless: false });
const page: Page = await browser.newPage();
await page.goto(WP_BASE_URL);
await page.waitForLoadState('load', { timeout: 30000 });
const page = await setupBrowser(false);

await page.goto(WP_BASE_URL);
}

export async function auth(): Promise<void> {
const page = await setupBrowser(false);
const sections = new Sections(page, pluginSelectors);
const utils = new PageUtils(page, sections);

}
await utils.auth()
page.on('response', async (response) => {
expect(response.status()).not.toEqual(500);
expect(response.status()).not.toEqual(404);
});

await utils.wpAdminLogout()
}

(async (): Promise<void> => {
await checkWPStatus();
await openE2EPage();

await auth();

process.exit(0);
})();
8 changes: 0 additions & 8 deletions src/features/setup.feature

This file was deleted.

0 comments on commit b2580cd

Please sign in to comment.