Skip to content

Commit

Permalink
Merge pull request #179 from wp-media/fix/176-error-with-backstop-tes…
Browse files Browse the repository at this point in the history
…t-for-llcssbg-and-lrc

Closes #176: Backstop tests not working as expected for LLCSSBG & LRC tests when run generally
  • Loading branch information
Mai-Saad authored Nov 28, 2024
2 parents aa3d206 + 41e821c commit 2aeba3d
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/features/ll-css-bg-image-double-colon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: C14626 - Should lazyload CSS background images inside internal, and ext
And I save settings 'media' 'lazyloadCssBgImg'

Scenario: Open the page template and compare to nowprocket
Given visual regression reference is generated
Then I must not see any visual regression 'doubleColon'
Then I must not see any error in debug.log
When I log out
Expand Down
3 changes: 2 additions & 1 deletion src/features/ll-css-bg-image-elementor.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Feature: C14412 - Should be compatible with Elementor background

Scenario: Enable LL BG Images and check page template
Given I am logged in
Given visual regression reference is generated
And I am logged in
And plugin is installed 'new_release'
And plugin is activated
When I go to 'wp-admin/options-general.php?page=wprocket#dashboard'
Expand Down
3 changes: 2 additions & 1 deletion src/features/ll-css-bg-image-fallback-js-disabled.feature
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
Feature: C13977 - Should have a fallback for browsers where JavaScript is disabled

Scenario: Open the page template and compare to nowprocket with javascript disabled
Given I am logged in
Given visual regression reference is generated
And I am logged in
And plugin is installed 'new_release'
And plugin is activated
When I go to 'wp-admin/options-general.php?page=wprocket#dashboard'
Expand Down
1 change: 1 addition & 0 deletions src/features/ll-css-bg-image-single-colon.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: C14626 - Should lazyload CSS background images inside internal, and ext
And I save settings 'media' 'lazyloadCssBgImg'

Scenario: Open the page template and compare to nowprocket
Given visual regression reference is generated
Then I must not see any visual regression 'singleColon'
Then I must not see any error in debug.log
When I log out
Expand Down
1 change: 1 addition & 0 deletions src/features/ll-css-bg-image.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: C13969 - Should lazyload CSS background images inside internal, and ext
And I save settings 'media' 'lazyloadCssBgImg'

Scenario: Open the page template and compare to nowprocket
Given visual regression reference is generated
Then I must not see any visual regression 'llcss'
Then I must not see any error in debug.log
When I log out
Expand Down
1 change: 1 addition & 0 deletions src/features/lrc-visual-regression.feature
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Feature: LRC Visual Regression Test on Live Template
And I go to 'wp-admin/options-general.php?page=wprocket#dashboard'

Scenario: Shouldn't have any visual regression when visiting
Given visual regression reference is generated
When I log out
And I visit scenario urls
And I am logged in
Expand Down
2 changes: 2 additions & 0 deletions src/features/wpml-compatibility.feature
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ Feature: C14655 - Should LL Background work on main/sub language
And wpml directory is enabled

Scenario: Open the page with directory lanaguage
When I log out
Then no error in the console different than nowprocket page 'lazyload_css_background_images'
When switch to another language
Then I must not see any error in debug.log

Scenario: Change WPML to query string option
Given wpml query string is enabled
When I log out
Then no error in the console different than nowprocket page 'lazyload_css_background_images'
When switch to another language
Then I must not see any error in debug.log
12 changes: 12 additions & 0 deletions src/support/steps/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ Given('theme {string} is activated', async function (this:ICustomWorld, theme) {
Given('visual regression reference is generated', async function (this:ICustomWorld) {
const tags = this.pickle.tags.map(tag => tag.name);
const tag: string = await getScenarioTag(tags);

// Array of tags to exclude from one time reference generation.
const exclusion = [
'@delayjs'
]

// Bail out if there is already reference for the current tag.
if (process.env.scenario_tag === tag && !exclusion.includes(tag)) {
return;
}

try {
await batchUpdateVRTestUrl({
Expand All @@ -131,6 +141,8 @@ Given('visual regression reference is generated', async function (this:ICustomWo
} catch (error) {
console.error('Backstop reference generation failed: ', error.message);
}

process.env.scenario_tag = tag;
});

/**
Expand Down

0 comments on commit 2aeba3d

Please sign in to comment.