1010 * @requires {@link ../../../utils/configurations }
1111 */
1212import { expect } from "@playwright/test" ;
13- import wp , {
13+ import {
1414 activatePlugin ,
1515 setTransient
1616} from "../../../utils/commands" ;
1717import { ICustomWorld } from "../../common/custom-world" ;
1818import { configurations } from "../../../utils/configurations" ;
1919import { match } from "ts-pattern" ;
20-
21- const { Given, When, Then } = require ( "@cucumber/cucumber" ) ;
20+ import { Given , When , Then } from "@cucumber/cucumber" ;
2221
2322/**
2423 * Executes the step to set up a WP account based on the provided status.
@@ -32,6 +31,7 @@ Given('I have an {word} account', { timeout: 60 * 1000 }, async function (this:
3231 return
3332 }
3433
34+ /* eslint-disable @typescript-eslint/naming-convention */
3535 await setTransient ( 'wp_rocket_customer_data' , JSON . stringify ( {
3636 'ID' : 1 ,
3737 'firstname' : 'Rocket' ,
@@ -51,6 +51,7 @@ Given('I have an {word} account', { timeout: 60 * 1000 }, async function (this:
5151 'upgrade_infinite_url' : 'https://example.org/upgrade_infinite_url'
5252 } ) . replaceAll ( '"' , '\\"' )
5353 . replaceAll ( '}' , '\\}' ) )
54+ /* eslint-enable @typescript-eslint/naming-convention */
5455
5556 await this . page . reload ( ) ;
5657} ) ;
@@ -69,6 +70,14 @@ Then('I must see the banner {string}', async function (this: ICustomWorld, text:
6970 await expect ( this . page . getByText ( text ) ) . toBeVisible ( { timeout : 15000 } ) ;
7071} ) ;
7172
73+ /**
74+ * Executes the step to assert the visibility of a banner with specific selector.
75+ */
76+ Then ( 'I must see the banner using selector {string}' , async function ( this : ICustomWorld , selector : string ) {
77+ await expect ( this . page . locator ( selector ) ) . toBeVisible ( { timeout : 15000 } ) ;
78+ } ) ;
79+
80+
7281/**
7382 * Executes the step to assert the visibility of a banner in iframe with specific text.
7483 */
@@ -156,7 +165,7 @@ When('I go {string}', async function (this: ICustomWorld, url: string) {
156165 */
157166When ( 'I connect as {string}' , async function ( this : ICustomWorld , user : string ) {
158167 await this . utils . wpAdminLogout ( ) ;
159- await this . utils . auth ( 'admin2' ) ;
168+ await this . utils . auth ( user ) ;
160169} ) ;
161170
162171/**
0 commit comments