-
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.
Merge pull request #45 from wp-media/test/42-smoke-regression-test-fo…
…r-delayjs-script Closes #42: Smoke/Regression test for delayjs script
- Loading branch information
Showing
14 changed files
with
303 additions
and
25 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
module.exports = async (page) => { | ||
let target; | ||
|
||
const theme = process.env.THEME ? process.env.THEME : ''; | ||
|
||
if (theme === '') { | ||
return; | ||
} | ||
|
||
switch (theme) { | ||
case 'genesis-sample-develop': | ||
target = '#genesis-mobile-nav-primary'; | ||
break; | ||
case 'flatsome': | ||
target = '[data-open="#main-menu"]'; | ||
break; | ||
case 'Divi': | ||
target = '#et_mobile_nav_menu'; | ||
break; | ||
case 'astra': | ||
target = '.ast-mobile-menu-trigger-minimal'; | ||
break; | ||
} | ||
|
||
await page.click(target); | ||
await page.waitForTimeout(2000); | ||
}; | ||
|
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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,39 @@ | ||
@delayjs @setup | ||
Feature: No Regression with delayjs script udpate | ||
|
||
Background: | ||
Given I am logged in | ||
And plugin is installed 'new_release' | ||
And plugin is activated | ||
And I go to 'wp-admin/options-general.php?page=wprocket#dashboard' | ||
And I save settings 'fileOptimization' 'delayJs' | ||
|
||
Scenario: Shouldn't cause console error when enabling Delay JS with theme | ||
When theme is activated | ||
And I log out | ||
And I visit site url | ||
And move the mouse | ||
Then no error in the console different than nowprocket page '' | ||
|
||
Scenario: Should the mobile menu work While Delay JS is enabled | ||
When theme is activated | ||
Then I must not see any visual regression 'delayJsMobile' | ||
|
||
Scenario: Should links be clickable While Delay JS is enabled | ||
When I save settings 'cache' 'mobileDeviceCache' | ||
And I save settings 'cache' 'mobileDeviceSeparateCache' | ||
When theme is activated | ||
And I log out | ||
And visit page '' in mobile view | ||
And expand mobile menu | ||
And I click on link | ||
Then page navigated to the new page 'https://e2e.rocketlabsqa.ovh/about-us' | ||
|
||
Scenario: Shouldn't cause console error when enabling Delay JS with WPML | ||
When I go to 'wp-admin/plugins.php' | ||
And activate 'wpml-multilingual-cms' plugin | ||
And I go to 'wp-admin/admin.php?page=sitepress-multilingual-cms/menu/languages.php' | ||
And wpml directory is enabled | ||
And I log out | ||
And I visit site url | ||
Then no error in the console different than nowprocket page 'ar' |
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,38 @@ | ||
/** | ||
* @fileoverview | ||
* This module contains Cucumber step definitions using Playwright for performing actions with Delayjs option enabled on WP Rocket. | ||
* | ||
* | ||
* | ||
* @requires {@link ../../common/custom-world} | ||
* @requires {@link @cucumber/cucumber} | ||
*/ | ||
import { ICustomWorld } from "../../common/custom-world"; | ||
import { When, Given } from '@cucumber/cucumber'; | ||
|
||
/** | ||
* Executes the step to move the mouse. | ||
*/ | ||
When('move the mouse', async function (this: ICustomWorld) { | ||
await this.page.mouse.down(); | ||
await this.page.mouse.up(); | ||
}); | ||
|
||
/** | ||
* Executes the step to click on about us link. | ||
*/ | ||
When('I click on link', async function (this:ICustomWorld) { | ||
await this.page.getByRole('link', { name: 'About Us' }).click() | ||
}); | ||
|
||
/** | ||
* Save directory for wpml language setting | ||
*/ | ||
Given('wpml directory is enabled', async function(this:ICustomWorld) { | ||
await this.page.waitForSelector('#lang-sec-2'); | ||
await this.page.locator('input[name="icl_language_negotiation_type"]').nth(0).check() | ||
|
||
await this.page.locator('input[type="submit"]').nth(0).click(); | ||
|
||
await this.page.waitForLoadState('load', { timeout: 30000 }); | ||
}); |
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
Oops, something went wrong.