Update to version 0.1.5 with testing setup, multisite compatibility, and npm scripts
This commit is contained in:
9
tests/e2e/cypress.json
Normal file
9
tests/e2e/cypress.json
Normal file
@@ -0,0 +1,9 @@
|
||||
{
|
||||
"baseUrl": "http://localhost:8889",
|
||||
"integrationFolder": "tests/e2e/cypress/integration",
|
||||
"pluginsFile": "tests/e2e/cypress/plugins/index.js",
|
||||
"supportFile": "tests/e2e/cypress/support/index.js",
|
||||
"videosFolder": "tests/e2e/cypress/videos",
|
||||
"screenshotsFolder": "tests/e2e/cypress/screenshots",
|
||||
"fixturesFolder": "tests/e2e/cypress/fixtures"
|
||||
}
|
||||
27
tests/e2e/cypress/integration/basic.spec.js
Normal file
27
tests/e2e/cypress/integration/basic.spec.js
Normal file
@@ -0,0 +1,27 @@
|
||||
/**
|
||||
* Basic e2e test for the plugin.
|
||||
*/
|
||||
describe('Plugin Basic Tests', () => {
|
||||
before(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it('Should activate the plugin', () => {
|
||||
cy.visit('/wp-admin/plugins.php');
|
||||
cy.contains('WP Plugin Starter Template').should('exist');
|
||||
|
||||
// Check if plugin is not active, then activate it
|
||||
cy.get('tr[data-slug="wp-plugin-starter-template-for-ai-coding"]')
|
||||
.then(($tr) => {
|
||||
if ($tr.hasClass('inactive')) {
|
||||
cy.wrap($tr).find('.activate a').click();
|
||||
cy.contains('Plugin activated.').should('exist');
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('Should have the plugin settings page', () => {
|
||||
cy.visit('/wp-admin/options-general.php?page=wp-plugin-starter-template');
|
||||
cy.contains('WP Plugin Starter Template Settings').should('exist');
|
||||
});
|
||||
});
|
||||
10
tests/e2e/cypress/plugins/index.js
Normal file
10
tests/e2e/cypress/plugins/index.js
Normal file
@@ -0,0 +1,10 @@
|
||||
/**
|
||||
* Cypress plugins file.
|
||||
*
|
||||
* @param {Object} on - Cypress events
|
||||
* @param {Object} config - Cypress config
|
||||
* @return {Object} - Modified config
|
||||
*/
|
||||
module.exports = (on, config) => {
|
||||
return config;
|
||||
};
|
||||
12
tests/e2e/cypress/support/commands.js
Normal file
12
tests/e2e/cypress/support/commands.js
Normal file
@@ -0,0 +1,12 @@
|
||||
/**
|
||||
* Custom Cypress commands.
|
||||
*/
|
||||
|
||||
// Login command
|
||||
Cypress.Commands.add('login', (username = 'admin', password = 'password') => {
|
||||
cy.visit('/wp-login.php');
|
||||
cy.get('#user_login').type(username);
|
||||
cy.get('#user_pass').type(password);
|
||||
cy.get('#wp-submit').click();
|
||||
cy.get('body.wp-admin').should('exist');
|
||||
});
|
||||
4
tests/e2e/cypress/support/index.js
Normal file
4
tests/e2e/cypress/support/index.js
Normal file
@@ -0,0 +1,4 @@
|
||||
/**
|
||||
* Import commands.js
|
||||
*/
|
||||
import './commands';
|
||||
Reference in New Issue
Block a user