[bitnami/wordpress] Wordpress version update to 5.9. + tests unification (#9008)

* Unified the Wordpress tests. Added version changed tests

Signed-off-by: Aleksandra Lukic <alukic@vmware.com>

* Removed the test suite wrapper

Signed-off-by: Aleksandra Lukic <alukic@vmware.com>

* Unified the test descriptions

Signed-off-by: Aleksandra Lukic <alukic@vmware.com>
This commit is contained in:
superaleks
2022-02-15 13:03:41 +01:00
committed by GitHub
parent cfc4902a15
commit eb6fee1cb7
7 changed files with 103 additions and 168 deletions
@@ -1,17 +0,0 @@
/// <reference types="cypress" />
describe('Admin page', () => {
beforeEach(() => {
cy.login();
cy.visit('wp-admin/options-general.php')
})
it('checks the blog name', () => {
cy.get('#blogname').should('have.value', Cypress.env('wordpressBlogname'));
})
it('checks the user email', () => {
cy.get('#new_admin_email').should('have.value', Cypress.env('wordpressEmail'));
})
})
@@ -1,25 +0,0 @@
/// <reference types="cypress" />
describe('Edit page ', () => {
beforeEach(() => {
cy.login();
cy.visit('/wp-admin/index.php')
})
it('allows editing the site.', () => {
cy.get('#welcome-panel .load-customize')
.should('exist')
.should('have.text', 'Customize Your Site')
.click();
cy.url().should('include', '/wp-admin/customize.php');
})
it('/edit.php allows editing posts', () => {
cy.visit('/wp-admin/edit.php');
cy.get('#bulk-action-selector-top').should('exist');
cy.get('#post-1 .row-title').should('exist').click();
cy.url().should('include', '/post.php?post=1&action=edit');
cy.get('#editor').should('exist');
})
})
@@ -1,40 +0,0 @@
/// <reference types="cypress" />
describe('Login-logout test', () => {
beforeEach(() => {
cy.clearCookies();
cy.visit('/wp-login.php')
})
it('allows login to a valid user.', () => {
cy.login();
cy.get('#login_error').should('not.exist')
})
it('disallows login to an invalid user.', () => {
cy.fixture('user').then((user) => {
cy.get('#user_login').type(user.username).should('have.value', user.username);
cy.get('#user_pass').type(user.password).should('have.value', user.password);
})
cy.get('#wp-submit').click();
cy.fixture('user').then((user) => {
cy.get('#login_error').should('contain.text', `The username ${user.username} is not registered on this site.`);
})
})
it('disallows login to a valid user with wrong password.', () => {
cy.get('#user_login').type(Cypress.env('username')).should('have.value', Cypress.env('username'));
cy.fixture('user').then((user) => {
cy.get('#user_pass').type(user.password).should('have.value', user.password);
})
cy.get('#wp-submit').click();
cy.get('#login_error').should('be.visible');
})
it('allows to log out.', () => {
cy.login();
cy.get("#wp-admin-bar-logout .ab-item").click({ force: true });
cy.get('.message').contains('logged out');
})
})
@@ -1,40 +0,0 @@
/// <reference types="cypress" />
describe('Hello World post', () => {
beforeEach(() => {
cy.visit('/')
})
it('exists.', () => {
cy.get('#post-1 .entry-title a').should('exist');
})
it('contains placeholder content.', () => {
cy.get('#post-1 .entry-title a').click();
cy.fixture('helloworld').then((hw) => {
cy.get('.entry-title').should('have.text', hw.title);
cy.get('.entry-content').should('contain.text', hw.content);
})
})
it('contains sample comment.', () => {
cy.get('#post-1 .entry-title a').click();
cy.get('.comment-list').should('have.length', 1);
cy.fixture('helloworld').then((hw) => {
cy.get('#comment-1 .comment-author').should('contain.text', hw.commenter);
})
})
it('has comment box.', () => {
cy.get('#post-1 .entry-title a').click();
cy.fixture('helloworld').then((hw) => {
cy.get('#comment').type(hw.comment).should('have.value', hw.comment);
})
cy.fixture('user').then((user) => {
cy.get('#author').type(user.username).should('have.value', user.username);
cy.get('#email').type(user.email).should('have.value', user.email);
})
cy.get('#submit').click();
})
})
@@ -1,34 +0,0 @@
/// <reference types="cypress" />
describe('SMTP config test', () => {
beforeEach(() => {
cy.login();
cy.visit('wp-admin/admin.php?page=wp-mail-smtp');
})
it('checks for presence of WP Mail SMTP', () => {
cy.get('div').contains('WP Mail SMTP').should('be.visible');
})
it('checks for configuration of WP Mail test', () => {
cy.visit('wp-admin/admin.php?page=wp-mail-smtp-tools&tab=test');
cy.get('#wp-mail-smtp-setting-test_email').should('have.value', Cypress.env('wordpressEmail'))
})
it('checks for configuration of mail server', () => {
cy.get('#wp-mail-smtp-setting-smtp-host').should('have.value', Cypress.env('smtpMailServer'));
})
it('checks for configuration of SMTP port', () => {
cy.get('#wp-mail-smtp-setting-smtp-port').should('have.value', Cypress.env('smtpPort'))
})
it('checks for configuration of SMTP username', () => {
cy.get('#wp-mail-smtp-setting-smtp-user').should('have.value', Cypress.env('smtpUser'))
})
it('checks for configuration of the names emails are sent from', () => {
cy.get('#wp-mail-smtp-setting-from_name').should('have.value', `${Cypress.env('wordpressFirstName')} ${Cypress.env('wordpressLastName')}`);
})
})
@@ -1,12 +0,0 @@
/// <reference types="cypress" />
describe('Automatic update configuration test', () => {
beforeEach(() => {
cy.login();
})
it('checks the value of auto update status', () => {
cy.visit("wp-admin/update-core.php");
cy.get('.auto-update-status').should('contain.text', 'This site is automatically kept up to date with maintenance and security releases of WordPress only.');
})
})
@@ -0,0 +1,103 @@
/// <reference types="cypress" />
it('contains the sample blogpost and a comment', () => {
cy.visit('/');
cy.get('.wp-block-query').should('exist');
cy.get('.wp-block-post-title a').click();
cy.fixture('helloworld').then((hw) => {
cy.get('.wp-block-post-title').should('have.text', hw.title);
cy.get('.wp-block-post-content').should('contain.text', hw.content);
})
cy.get('.wp-block-post-title').click();
cy.get('.commentlist').should('have.length', 1);
cy.fixture('helloworld').then((hw) => {
cy.get('.comment-author').should('contain.text', hw.commenter)
cy.fixture('helloworld').then((hw) => {
cy.get('#comment').type(hw.comment).should('have.value', hw.comment);
})
cy.fixture('user').then((user) => {
cy.get('#author').type(user.username).should('have.value', user.username);
cy.get('#email').type(user.email).should('have.value', user.email);
})
cy.get('#submit').click();
})
})
it('disallows login to an invalid user', () => {
cy.clearCookies();
cy.visit('/wp-login.php')
cy.fixture('user').then((user) => {
cy.get('#user_login').type(user.username).should('have.value', user.username);
cy.get('#user_pass').type(user.password).should('have.value', user.password);
})
cy.get('#wp-submit').click();
cy.fixture('user').then((user) => {
cy.get('#login_error').should('contain.text', `The username ${user.username} is not registered on this site.`);
})
})
it('disallows login to a valid user with wrong password', () => {
cy.clearCookies();
cy.visit('/wp-login.php')
cy.get('#user_login').type(Cypress.env('username')).should('have.value', Cypress.env('username'));
cy.fixture('user').then((user) => {
cy.get('#user_pass').type(user.password).should('have.value', user.password);
})
cy.get('#wp-submit').click();
cy.get('#login_error').should('contain.text', `Error: The password you entered for the username ${Cypress.env('username')} is incorrect. Lost your password?`);
})
it('checks the blog name and user email configuration', () => {
cy.login();
cy.visit('/wp-admin/options-general.php')
cy.get('#new_admin_email').should('have.value', Cypress.env('wordpressEmail'));
cy.get('#blogname').should('have.value', Cypress.env('wordpressBlogname'));
})
it('checks if admin can edit a site', () => {
cy.login();
cy.visit('/wp-admin/index.php')
cy.contains('Open site editor').click()
cy.url().should('include', '/wp-admin/site-editor.php');
})
it('checks if admin can edit a post', () => {
cy.login();
cy.visit('/wp-admin/edit.php');
cy.get('#bulk-action-selector-top').should('exist');
cy.get('#post-1 .row-title').should('exist').click();
cy.url().should('include', '/post.php?post=1&action=edit');
cy.get('#editor').should('exist');
})
it('checks the SMTP configuration', () => {
cy.login();
cy.visit('/wp-admin/admin.php?page=wp-mail-smtp');
cy.get('div').contains('WP Mail SMTP').should('be.visible');
cy.get('#wp-mail-smtp-setting-smtp-host').should('have.value', Cypress.env('smtpMailServer'));
cy.get('#wp-mail-smtp-setting-smtp-port').should('have.value', Cypress.env('smtpPort'));
cy.get('#wp-mail-smtp-setting-smtp-user').should('have.value', Cypress.env('smtpUser'));
cy.get('#wp-mail-smtp-setting-from_name').should('have.value', `${Cypress.env('wordpressFirstName')} ${Cypress.env('wordpressLastName')}`);
})
it('checks the value of auto update status', () => {
cy.login();
cy.visit("/wp-admin/update-core.php");
cy.get('.auto-update-status').should('contain.text', 'This site is automatically kept up to date with maintenance and security releases of WordPress only.');
})
it('allows to log out', () => {
cy.login();
cy.get("#wp-admin-bar-logout .ab-item").click({
force: true
});
cy.get('.message').contains('logged out');
})