From 221ea39d12e299f09fa1cb349e61dee9ed491231 Mon Sep 17 00:00:00 2001 From: Opeyemi Ibrahim Date: Fri, 20 Sep 2024 14:02:07 +0100 Subject: [PATCH] modify scenario steps --- backstop.json | 34 ---------------------------------- config/wp.config.sample.ts | 6 +++--- src/features/ll-lcp.feature | 10 +++++++--- src/support/steps/imagify.ts | 2 +- utils/commands.ts | 2 +- 5 files changed, 12 insertions(+), 42 deletions(-) delete mode 100644 backstop.json diff --git a/backstop.json b/backstop.json deleted file mode 100644 index 4f94cd8..0000000 --- a/backstop.json +++ /dev/null @@ -1,34 +0,0 @@ -{ - "id": "wpr_vr_test", - "viewports": [ - { - "name": "desktop", - "width": 1920, - "height": 1080 - } - ], - "scenarios": [ - ], - "paths": { - "bitmaps_reference": "backstop_data/bitmaps_reference", - "bitmaps_test": "backstop_data/bitmaps_test", - "engine_scripts": "backstop_data/engine_scripts", - "html_report": "backstop_data/html_report", - "ci_report": "backstop_data/ci_report" - }, - "report": [ - "browser" - ], - "engine": "puppeteer", - "engineOptions": { - "args": [ - "--no-sandbox" - ], - "headless": false, - "timeout": 0 - }, - "asyncCaptureLimit": 5, - "asyncCompareLimit": 50, - "debug": false, - "debugWindow": false -} \ No newline at end of file diff --git a/config/wp.config.sample.ts b/config/wp.config.sample.ts index 7c1da9f..b85fb2e 100755 --- a/config/wp.config.sample.ts +++ b/config/wp.config.sample.ts @@ -16,13 +16,13 @@ const WP_ADMIN_USER = { } as const; /** - * The default Imagify settings informations + * The default Imagify settings information * * @constant - * @type {{ API_KEY: string }} + * @type {{ apiKey: string }} */ const IMAGIFY_INFOS = { - API_KEY: '' + apiKey: '' } as const; /** diff --git a/src/features/ll-lcp.feature b/src/features/ll-lcp.feature index de25c0a..78be984 100644 --- a/src/features/ll-lcp.feature +++ b/src/features/ll-lcp.feature @@ -9,18 +9,22 @@ Feature: Lazyload with LCP And I save settings 'media' 'lazyloadCssBgImg' Scenario: Should Exclude LCP/ATF from Lazyload - Given I visit page 'lcp_with_imagify' with browser dimension 1600 x 700 + When I log out + And I visit the urls for 'desktop' When I am logged in And I clear cache + And I visit the urls for 'desktop' Then lcp image markup is not written to LL format # And ATF image markup is not written to LL format Scenario: Should exclude next-gen lcp/atf from LL - Given plugin is installed 'imagify' - And plugin is activated + Given I install plugin 'imagify' + And plugin 'imagify' is activated + When I am logged in And I go to 'wp-admin/options-general.php?page=imagify' And I save imagify API key And display next-gen is enabled on imagify + And I visit page 'lcp_with_imagify' with browser dimension 1600 x 700 # And page 'lcp_with_imagify' with images having next-gen avif, webp, avif/webp, no next gen is visited # I didn't get that When I clear cache And I visit page 'lcp_with_imagify' with browser dimension 1600 x 700 diff --git a/src/support/steps/imagify.ts b/src/support/steps/imagify.ts index 3d5ba1d..2a8af98 100644 --- a/src/support/steps/imagify.ts +++ b/src/support/steps/imagify.ts @@ -17,7 +17,7 @@ Given('I save imagify API key', async function (this: ICustomWorld) { if (apiKeyInput) { // Fill the API key input field with the API key from the config - await this.page.fill('input#api_key', IMAGIFY_INFOS.API_KEY); + await this.page.fill('input#api_key', IMAGIFY_INFOS.apiKey); // Click the submit button to save the changes await this.page.click('div.submit.imagify-clearfix input#submit'); diff --git a/utils/commands.ts b/utils/commands.ts index 175c9b5..91c9ac3 100644 --- a/utils/commands.ts +++ b/utils/commands.ts @@ -230,7 +230,7 @@ export async function rm(destination: string): Promise { */ export async function activatePlugin(name: string): Promise { await wp(`plugin activate ${name}`) - const status: boolean = await wp(`plugin is-active ${name}`); + const status: boolean = await wp(`plugin is-active ${name}`);console.log(status) if(!status) { throw new Error(`Plugin - ${name} is not active`); }