Scenario: Shouldnot display the CPCSS banner to admin 2 if it was dismissed by admin 1
Given I have an unexpired account
And turn on 'CPCSS'
Then I must see the banner 'We highly recommend the updated Remove Unused CSS for a better CSS optimization. Load CSS Asynchronously is always available as a back-up.'
When click on 'Turn on Remove Unused CSS'
Then I must see the banner 'The Remove Unused CSS service is processing your pages'
When I connect as 'admin2'
And I go '/wp-admin/options-general.php?page=wprocket#file_optimization'
Then I must not see the banner 'We highly recommend the updated Remove Unused CSS for a better CSS optimization. Load CSS Asynchronously is always available as a back-up.'
Currently, at connect as admin2 , we are using the default credentials in config file
/**
* Performs Wordpress login action.
*
* @param user - Optional username for login. If not provided, a default user will be used.
* @return {Promise<void>}
*/
public auth = async (user: string | null = null): Promise<void> => {
if (!this.page.url().includes('wp-login.php')) {
await this.visitPage('wp-admin');
}
if (!await this.page.locator('#user_login').isVisible()) {
return;
}
// Check if the user argument is provided, and login accordingly
if (user !== null) {
await this.wpAdminLogin(user); // Assuming wpAdminLogin can accept a user argument
} else {
// If no user is provided, log in as a default user
await this.wpAdminLogin(); // Default login (possibly using a predefined admin)
}
}
Scenario:
Currently, at connect as admin2 , we are using the default credentials in config file
Suggested solution 1- In config file we define admin2 username and password 2- In https://github.com/wp-media/wp-rocket-e2e/blob/develop/utils/page-utils.ts#L336 we rewrite the function to accept user as argument and still can take nothing , for example
3- In https://github.com/wp-media/wp-rocket-e2e/blob/e43c0ea4fab6c17ef930ba8f7f46f5ddf94a1078/utils/page-utils.ts#L78, we modify the function to take user i/p then we use from config either default user or user 2 as per passed argument for example: