-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
421 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import path from "path"; | ||
import {promises as fs} from "fs"; | ||
|
||
/** | ||
* Moves test results to a destination directory with optional renaming | ||
* | ||
* @param {string} testTag Tag name of the report generated. | ||
* @returns Promise<string> Path where the folder was moved to | ||
*/ | ||
export async function moveTestReport(testTag: string): Promise<string> { | ||
const SOURCE_FOLDER = 'test-results'; | ||
const destinationDir = '/var/shared/rocket-e2e-reports'; | ||
|
||
// Validate source folder exists | ||
try { | ||
await fs.access(SOURCE_FOLDER); | ||
} catch (error) { | ||
throw new Error(`Source folder '${SOURCE_FOLDER}' does not exist`); | ||
} | ||
|
||
// Ensure destination directory exists | ||
try { | ||
await fs.access(destinationDir); | ||
} catch (error) { | ||
throw new Error(`Destination directory '${destinationDir}' does not exist`); | ||
} | ||
|
||
const newTestReportPath = path.join(destinationDir, testTag); | ||
|
||
try { | ||
await fs.rename(SOURCE_FOLDER, newTestReportPath); | ||
|
||
return newTestReportPath; | ||
} catch (error) { | ||
throw new Error(`Failed to move folder: ${error.message}`); | ||
} | ||
} | ||
|
||
(async (): Promise<void> => { | ||
try { | ||
const tag = process.env.npm_config_tag; | ||
|
||
//If tag is not provided, then the report shouldn't be moved or renamed. | ||
if(! tag) { | ||
process.exit(1); | ||
} | ||
|
||
await moveTestReport(tag); | ||
} catch (err) { | ||
console.error(`Failed to execute the script: ${err.message}`); | ||
process.exit(1); | ||
} | ||
|
||
process.exit(0); | ||
})(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
@lcp @delaylcp @setup | ||
Feature: Lazyload with LCP | ||
|
||
Background: | ||
Given I am logged in | ||
And plugin is installed 'new_release' | ||
And plugin 'wp-rocket' is activated | ||
When I go to 'wp-admin/options-general.php?page=wprocket#dashboard' | ||
And I save settings 'media' 'lazyloadCssBgImg' | ||
And I save settings 'media' 'lazyload' | ||
And I save settings 'media' 'lazyloadIframes' | ||
And I save settings 'media' 'lazyloadYoutube' | ||
|
||
Scenario: Should Exclude LCP/ATF from Lazyload | ||
When I log out | ||
And I visit the urls for 'desktop' | ||
When I am logged in | ||
And I clear cache | ||
And I log out | ||
And I visit the urls and check for lazyload | ||
Then lcp and atf images are not written to LL format | ||
|
||
Scenario: Should exclude next-gen lcp/atf from LL | ||
Given I install plugin 'imagify' | ||
And plugin 'imagify' is activated | ||
When I am logged in | ||
And Imagify is set up | ||
When I log out | ||
And I visit page 'lcp_with_imagify' and check for lcp | ||
When I am logged in | ||
And I clear cache | ||
And I log out | ||
And I visit the 'lcp_with_imagify' and check lcp-atf are not lazyloaded | ||
Then lcp and atf images are not written to LL format | ||
|
||
Scenario: Should exclude Imagify next-gen lcp/atf from LL | ||
When I am logged in | ||
And display next-gen is enabled on imagify | ||
When I log out | ||
And I visit page 'lcp_with_imagify' and check for lcp | ||
When I am logged in | ||
And I clear cache | ||
And I log out | ||
And I visit the 'lcp_with_imagify' and check lcp-atf are not lazyloaded | ||
Then lcp and atf images are not written to LL format | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { ICustomWorld } from "../../common/custom-world"; | ||
|
||
import { Given } from '@cucumber/cucumber'; | ||
import { IMAGIFY_INFOS } from "../../../config/wp.config"; | ||
import {expect} from "@playwright/test"; | ||
|
||
Given('Imagify is set up', async function (this: ICustomWorld) { | ||
await this.utils.gotoImagify(); | ||
|
||
// Check if the API key input field exists on the page | ||
const apiKeyInput = await this.page.$('input#api_key'); | ||
|
||
if (apiKeyInput) { | ||
// Fill the API key input field with the API key from the config | ||
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'); | ||
} | ||
}); | ||
Given('display next-gen is enabled on imagify', async function (this: ICustomWorld) { | ||
// Go to Imagify setting page | ||
await this.utils.gotoImagify(); | ||
|
||
// Check the 'Display images in Next-Gen format on the site' checkbox | ||
await this.page.click('label[for="imagify_display_nextgen"]'); | ||
|
||
// Click the submit button to save the changes | ||
await this.page.click('input#submit'); | ||
|
||
await expect(this.page.getByText('Settings saved.')).toBeVisible(); | ||
}); |
Oops, something went wrong.