From 80bde4edadef9cc888af8c90e689bb8ca53283e5 Mon Sep 17 00:00:00 2001 From: Michael Lee <38788055+jeawhanlee@users.noreply.github.com> Date: Thu, 21 Nov 2024 10:56:36 +0100 Subject: [PATCH] Closes #168: Tests for Check if content are lazyloaded while scrolling seems always failing for the templates lazyload_css_background_images, ll_bg_css_single_colon and ll_bg_css_double_colon (#169) * Deactivate WPML on setup * Assert that images are in expected array --- src/support/steps/ll-css-bg-image.ts | 3 +-- utils/page-utils.ts | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/support/steps/ll-css-bg-image.ts b/src/support/steps/ll-css-bg-image.ts index 44a08ec..c4aefc9 100644 --- a/src/support/steps/ll-css-bg-image.ts +++ b/src/support/steps/ll-css-bg-image.ts @@ -179,6 +179,5 @@ Then('Check {string} input for background images', async function (this: ICustom await this.page.locator('input[name="lastName"]').nth(1).fill('Random text') await this.utils.scrollDownBottomOfAPage(); - - expect(images).toEqual(LL_BACKGROUND_IMAGES[page].lazyLoadedImages) + expect(images.every(image => LL_BACKGROUND_IMAGES[page].lazyLoadedImages.includes(image))).toBeTruthy(); }); \ No newline at end of file diff --git a/utils/page-utils.ts b/utils/page-utils.ts index 1c97d3f..86a3889 100644 --- a/utils/page-utils.ts +++ b/utils/page-utils.ts @@ -16,7 +16,7 @@ import { ICustomWorld } from '../src/common/custom-world'; import fs from "fs/promises"; import {WP_BASE_URL, WP_PASSWORD, WP_USERNAME} from '../config/wp.config'; -import { uninstallPlugin, updatePermalinkStructure } from "./commands"; +import { uninstallPlugin, updatePermalinkStructure, deactivatePlugin } from "./commands"; /** * Utility class for interacting with a Playwright Page instance in WordPress testing. @@ -577,6 +577,9 @@ export class PageUtils { // Remove helper plugin. await uninstallPlugin('wp-rocket force-wp-mobile'); + // Deactivate WPML. + await deactivatePlugin('sitepress-multilingual-cms'); + // Reset permalink structure. await updatePermalinkStructure('/%postname%/');