Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closes #57: Test that beacon script captures right image on template #64

Merged
81 changes: 79 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"test:delayjs:flatsome": "THEME=flatsome $npm_package_config_testCommand --tags @delayjs",
"test:delayjs:divi": "THEME=Divi $npm_package_config_testCommand --tags @delayjs",
"test:delayjs:astra": "THEME=astra $npm_package_config_testCommand --tags @delayjs",
"test:lcp": "$npm_package_config_testCommand --tags @lcp",
"test:test": "$npm_package_config_testCommand --tags @test",
"wp-env": "wp-env"
},
Expand Down Expand Up @@ -50,7 +51,9 @@
},
"homepage": "https://github.com/wp-media/wp-rocket-e2e#readme",
"dependencies": {
"@types/axios": "^0.14.0",
"@types/ssh2": "^1.11.13",
"axios": "^1.6.8",
"backstopjs": "^6.2.2",
"json-diff": "^1.0.6",
"node-ssh": "^13.1.0",
Expand Down
2 changes: 1 addition & 1 deletion src/features/delay-js.feature
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Feature: No Regression with delayjs script udpate
And I save settings 'cache' 'mobileDeviceSeparateCache'
When theme is activated
And I log out
And visit page '' in mobile view
And I visit '' 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'
Expand Down
35 changes: 35 additions & 0 deletions src/features/lcp-beacon-script.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
@lcp @setup
Feature: Beacon script captures the right images.

Background:
Given I am logged in
And plugin is installed 'new_release'
And plugin is activated

Scenario: Beacon captures expected images in desktop
When I log out
And I visit the following urls in 'desktop'
| path | urls | atfs |
| lcp_bg_inline_template | https://e2e.rocketlabsqa.ovh/lcp_bg_inline_template/ | /wp-content/rocket-test-data/images/lcp/testjpeg.jpeg |
jeawhanlee marked this conversation as resolved.
Show resolved Hide resolved
| lcp_bg_samestyle_template | https://e2e.rocketlabsqa.ovh/lcp_bg_samestyle_template/ | wp-content/rocket-test-data/images/lcp/testjpg.jpg |
| lcp_img_loadedbydynamicjs_template | https://e2e.rocketlabsqa.ovh/lcp_img_loadedbydynamicjs_template/ | http://www.google.com/intl/en_com/images/logo_plain.png |
| lcp_img_loadedbyjs_template | https://e2e.rocketlabsqa.ovh/lcp_img_loadedbyjs_template/ | /test.png, https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/istockphoto-1184692500-612x612.webp |
| lcp_with_space_after_title | https://e2e.rocketlabsqa.ovh/lcp_with_space_after_title/ | https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/test_inline2.jpeg |
| lcp_test_template | https://e2e.rocketlabsqa.ovh/lcp_test_template/ | https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/lipsum_logo.jpg |
| lcp_bg_responsive_webkit_template | https://e2e.rocketlabsqa.ovh/lcp_bg_responsive_webkit_template | https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/image/test3.webp, /wp-content/rocket-test-data/images/lcp/testwebp.webp |
| lcp_regular_image_template | https://e2e.rocketlabsqa.ovh/lcp_regular_image_template/ | /test.png, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/test_inline2.jpeg, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/Przechwytywanie.PNG, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/file_example_JPG_100kB.jpg |
Then lcp and atf should be as expected in 'desktop'

Scenario: Beacon captures expected images in mobile
When I log out
And I visit the following urls in 'mobile'
| path | urls | atfs |
| lcp_bg_inline_template | https://e2e.rocketlabsqa.ovh/lcp_bg_inline_template/ | /wp-content/rocket-test-data/images/test_inline2.jpeg |
| lcp_bg_samestyle_template | https://e2e.rocketlabsqa.ovh/lcp_bg_samestyle_template/ | https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/lcp/testavif.avif |
| lcp_img_loadedbydynamicjs_template | https://e2e.rocketlabsqa.ovh/lcp_img_loadedbydynamicjs_template/ | http://www.google.com/intl/en_com/images/logo_plain.png |
| lcp_img_loadedbyjs_template | https://e2e.rocketlabsqa.ovh/lcp_img_loadedbyjs_template/ | /test.png, https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/istockphoto-1184692500-612x612.webp |
| lcp_with_space_after_title | https://e2e.rocketlabsqa.ovh/lcp_with_space_after_title/ | https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/test_inline2.jpeg |
| lcp_test_template | https://e2e.rocketlabsqa.ovh/lcp_test_template/ | /wp-content/rocket-test-data/images/test_internal2.jpg, https://new.rocketlabsqa.ovh/wp-content/rocket-test-data/images/lipsum_logo.jpg |
| lcp_bg_responsive_webkit_template | https://e2e.rocketlabsqa.ovh/lcp_bg_responsive_webkit_template | https://rocketlabsqa.ovh/wp-content/rocket-test-data/images/fixtheissue.jpg |
| lcp_regular_image_template | https://e2e.rocketlabsqa.ovh/lcp_regular_image_template/ | /test.png, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/test_inline2.jpeg, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/lcp/testPng.png, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/Przechwytywanie.PNG, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/file_example_JPG_100kB.jpg, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/img_nature.jpg, https://e2e.rocketlabsqa.ovh/wp-content/rocket-test-data/images/mountain.webp |
Then lcp and atf should be as expected in 'mobile'
2 changes: 1 addition & 1 deletion src/support/steps/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ When('theme is activated', async function (this:ICustomWorld) {
/**
* Executes the step visit a page in mobile view.
*/
When('visit page {string} in mobile view', async function (this:ICustomWorld, page) {
When('I visit {string} in mobile view', async function (this:ICustomWorld, page) {
await this.page.setViewportSize({
width: 500,
height: 480,
Expand Down
Loading
Loading