Fix code quality issues and improve test framework

This commit is contained in:
2025-04-21 21:23:23 +01:00
parent ed160ed51b
commit 051bc763f8
11 changed files with 155 additions and 75 deletions

View File

@@ -0,0 +1,20 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
/**
* Custom command to login as admin
*/
Cypress.Commands.add('loginAsAdmin', () => {
cy.visit('/wp-admin');
cy.get('#user_login').type('admin');
cy.get('#user_pass').type('password');
cy.get('#wp-submit').click();
cy.get('body.wp-admin').should('exist');
});

17
cypress/support/e2e.js Normal file
View File

@@ -0,0 +1,17 @@
// ***********************************************************
// This example support/e2e.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
// Import commands.js using ES2015 syntax:
import './commands';