From f196ccff9c67c250db39c09c46e73bb191a6aaca Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Fri, 7 Jun 2024 18:04:48 +0100 Subject: [PATCH] :feat: Review modifications --#103 --- src/features/lcp-beacon-script.feature | 1 - src/support/steps/steps.ts | 9 +-------- utils/commands.ts | 16 +++------------- 3 files changed, 4 insertions(+), 22 deletions(-) diff --git a/src/features/lcp-beacon-script.feature b/src/features/lcp-beacon-script.feature index 8db6314..2b5878e 100644 --- a/src/features/lcp-beacon-script.feature +++ b/src/features/lcp-beacon-script.feature @@ -16,7 +16,6 @@ Feature: Beacon script captures the right images. Scenario: Beacon captures expected images in mobile Given I install plugin 'https://github.com/wp-media/wp-rocket-e2e-test-helper/raw/main/helper-plugin/force-wp-mobile.zip' And plugin 'force-wp-mobile' is activated - And plugin 'force-wp-mobile' is-active When I log out And I visit the urls for 'mobile' And plugin 'force-wp-mobile' is deactivated diff --git a/src/support/steps/steps.ts b/src/support/steps/steps.ts index 0544b04..d6a34a1 100644 --- a/src/support/steps/steps.ts +++ b/src/support/steps/steps.ts @@ -12,7 +12,7 @@ import {expect} from "@playwright/test"; import {AfterAll, BeforeAll} from "@cucumber/cucumber"; import wp, { - activatePlugin, checkPluginStatus, + activatePlugin, cp, generateUsers, resetWP, @@ -66,13 +66,6 @@ Given('plugin {word} is activated', async function (plugin) { await activatePlugin(plugin) }); -/** - * Check if a plugin is active. - */ -Given('plugin {word} is-active', async function (plugin) { - await checkPluginStatus(plugin) -}); - /** * Executes the step to assert the visibility of a banner with specific text. */ diff --git a/utils/commands.ts b/utils/commands.ts index df552d0..9f72e61 100644 --- a/utils/commands.ts +++ b/utils/commands.ts @@ -224,25 +224,15 @@ export async function rm(destination: string): Promise { * @returns {Promise} - A Promise that resolves when the activation is completed. */ export async function activatePlugin(name: string): Promise { - await wp(`plugin activate ${name}`) -} - -/** - * Check if a WordPress plugin is active using the WP-CLI command. - * - * @function - * @name checkPluginStatus - * @async - * @param {string} name - The name of the plugin to check. - * @returns {Promise} - A Promise that resolves when the activation is completed. - */ -export async function checkPluginStatus(name: string): Promise { + await wp(`plugin activate ${name}`) const status: boolean = await wp(`plugin is-active ${name}`); if(!status) { throw new Error('Plugin is not active') } } + + /** * Install a WordPress plugin from a remote zip file using the WP-CLI command. *