Fix code quality issues: update Cypress tests to use custom commands, fix workflow files, update documentation

This commit is contained in:
2025-04-22 22:10:55 +01:00
parent 953bf3f6bb
commit f3d6bd2434
6 changed files with 36 additions and 48 deletions

View File

@@ -11,36 +11,34 @@ describe('WordPress Playground Single Site Tests', () => {
});
it('Can access the admin area', () => {
// Visit the admin dashboard
cy.visit('/wp-admin/');
// Fill in the login form if needed
cy.get('body').then(($body) => {
if ($body.hasClass('login')) {
cy.get('#user_login').type('admin');
cy.get('#user_pass').type('password');
cy.get('#wp-submit').click();
}
});
// Use the custom login command
cy.loginAsAdmin();
// Check if we're logged in
cy.get('#wpadminbar').should('exist');
});
it('Plugin is activated', () => {
// Use the custom login command
cy.loginAsAdmin();
// Navigate to plugins page
cy.visit('/wp-admin/plugins.php');
// Check if the plugin is active
cy.contains('Plugin Toggle').should('exist');
cy.contains('Kadence Blocks').should('exist');
cy.contains('tr', 'Plugin Toggle').find('.deactivate').should('exist');
cy.contains('tr', 'Kadence Blocks').find('.deactivate').should('exist');
});
it('Plugin settings page loads correctly', () => {
// Use the custom login command
cy.loginAsAdmin();
// Navigate to the plugin settings page
cy.visit('/wp-admin/options-general.php');
// Check if the settings page exists
cy.get('#wpbody-content').should('exist');
cy.get('h1').should('be.visible');
});
});