Skip to content

Commit

Permalink
Use new functions to check for wpr related error in debug.log before …
Browse files Browse the repository at this point in the history
…renaming log file
  • Loading branch information
jeawhanlee committed Jan 7, 2025
1 parent b499161 commit 87fa01d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/support/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ import { ChromiumBrowser, chromium } from '@playwright/test';
import { Sections } from '../common/sections';
import { selectors as pluginSelectors } from "./../common/selectors";
import { PageUtils } from "../../utils/page-utils";
import { deleteFolder } from "../../utils/helpers";
import { deleteFolder, isWprRelatedError } from "../../utils/helpers";
import {WP_SSH_ROOT_DIR,} from "../../config/wp.config";
import { After, AfterAll, Before, BeforeAll, Status, setDefaultTimeout } from "@cucumber/cucumber";
import {rename, exists, rm, testSshConnection, installRemotePlugin, activatePlugin, uninstallPlugin} from "../../utils/commands";
import {rename, exists, rm, testSshConnection, installRemotePlugin, activatePlugin, uninstallPlugin, readFile} from "../../utils/commands";
// import {configurations, getWPDir} from "../../utils/configurations";

/**
Expand Down Expand Up @@ -167,8 +167,10 @@ After(async function (this: ICustomWorld, { pickle, result }) {

const debugLogPath = `${WP_SSH_ROOT_DIR}wp-content/debug.log`;
const debugLogExists = await exists(debugLogPath);
const debugLogContents = await readFile(debugLogPath);
const wprRelatedError = await isWprRelatedError(debugLogContents);

if (debugLogExists && previousScenarioName) {
if (debugLogExists && previousScenarioName && wprRelatedError) {
// Close up white spaces.
previousScenarioName = previousScenarioName.toLowerCase();
previousScenarioName = previousScenarioName.replaceAll(' ', '-');
Expand Down

0 comments on commit 87fa01d

Please sign in to comment.