Skip to content

Commit

Permalink
Add new step for LRC templates -- #137
Browse files Browse the repository at this point in the history
  • Loading branch information
Khadreal committed Sep 18, 2024
1 parent 9106400 commit ec253de
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
14 changes: 14 additions & 0 deletions src/features/lrc-visual-regression.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
@setup @lrc
Feature: LRC Visual Regression Test on Live Template

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'

Scenario: Shouldn't have any visual regression when visiting
When I log out
And I visit lrc live templates
And I am logged in
And I clear cache
19 changes: 18 additions & 1 deletion src/support/steps/general.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { expect } from "@playwright/test";
import { ICustomWorld } from "../../common/custom-world";

import { Given, When, Then } from '@cucumber/cucumber';
import { WP_BASE_URL } from '../../../config/wp.config';
import {SCENARIO_URLS, WP_BASE_URL} from '../../../config/wp.config';
import { createReference, compareReference } from "../../../utils/helpers";
import type { Section } from "../../../utils/types";
import { Page } from '@playwright/test';
Expand Down Expand Up @@ -262,6 +262,23 @@ When('I visit page {string} with browser dimension {int} x {int}', async functio
await this.utils.visitPage(page);
});

/**
* Executes the step to visit page in a specific browser dimension.
*/
When('I visit lrc live templates', async function (this:ICustomWorld) {
await this.page.setViewportSize({
width: 1600,
height: 700,
});
const liveUrl = SCENARIO_URLS;

for (const key in liveUrl) {
if(liveUrl[key].type === 'lrc') {
await this.utils.visitPage(liveUrl[key].path);
}
}
});

/**
* Executes the step to scroll to the bottom of the page.
*/
Expand Down

0 comments on commit ec253de

Please sign in to comment.