From eb6fee1cb7f4ea593cc46160a7e63ffb9a30e6bc Mon Sep 17 00:00:00 2001 From: superaleks <47592680+superaleks@users.noreply.github.com> Date: Tue, 15 Feb 2022 13:03:41 +0100 Subject: [PATCH] [bitnami/wordpress] Wordpress version update to 5.9. + tests unification (#9008) * Unified the Wordpress tests. Added version changed tests Signed-off-by: Aleksandra Lukic * Removed the test suite wrapper Signed-off-by: Aleksandra Lukic * Unified the test descriptions Signed-off-by: Aleksandra Lukic --- .../cypress/integration/admin_config_spec.js | 17 --- .../cypress/integration/admin_edit_spec.js | 25 ----- .../cypress/integration/login_logout_spec.js | 40 ------- .../integration/sample_blogspot_spec.js | 40 ------- .../cypress/integration/smtp_config_spec.js | 34 ------ .../cypress/integration/update_config_spec.js | 12 -- .../cypress/integration/wordpress_spec.js | 103 ++++++++++++++++++ 7 files changed, 103 insertions(+), 168 deletions(-) delete mode 100644 .vib/wordpress/cypress/cypress/integration/admin_config_spec.js delete mode 100644 .vib/wordpress/cypress/cypress/integration/admin_edit_spec.js delete mode 100644 .vib/wordpress/cypress/cypress/integration/login_logout_spec.js delete mode 100644 .vib/wordpress/cypress/cypress/integration/sample_blogspot_spec.js delete mode 100644 .vib/wordpress/cypress/cypress/integration/smtp_config_spec.js delete mode 100644 .vib/wordpress/cypress/cypress/integration/update_config_spec.js create mode 100644 .vib/wordpress/cypress/cypress/integration/wordpress_spec.js diff --git a/.vib/wordpress/cypress/cypress/integration/admin_config_spec.js b/.vib/wordpress/cypress/cypress/integration/admin_config_spec.js deleted file mode 100644 index cb4562610..000000000 --- a/.vib/wordpress/cypress/cypress/integration/admin_config_spec.js +++ /dev/null @@ -1,17 +0,0 @@ -/// -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')); - }) - -}) diff --git a/.vib/wordpress/cypress/cypress/integration/admin_edit_spec.js b/.vib/wordpress/cypress/cypress/integration/admin_edit_spec.js deleted file mode 100644 index 998c1b291..000000000 --- a/.vib/wordpress/cypress/cypress/integration/admin_edit_spec.js +++ /dev/null @@ -1,25 +0,0 @@ -/// -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'); - }) - -}) diff --git a/.vib/wordpress/cypress/cypress/integration/login_logout_spec.js b/.vib/wordpress/cypress/cypress/integration/login_logout_spec.js deleted file mode 100644 index 428bb387b..000000000 --- a/.vib/wordpress/cypress/cypress/integration/login_logout_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -/// -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'); - }) - -}) diff --git a/.vib/wordpress/cypress/cypress/integration/sample_blogspot_spec.js b/.vib/wordpress/cypress/cypress/integration/sample_blogspot_spec.js deleted file mode 100644 index 786f435c1..000000000 --- a/.vib/wordpress/cypress/cypress/integration/sample_blogspot_spec.js +++ /dev/null @@ -1,40 +0,0 @@ -/// -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(); - }) -}) diff --git a/.vib/wordpress/cypress/cypress/integration/smtp_config_spec.js b/.vib/wordpress/cypress/cypress/integration/smtp_config_spec.js deleted file mode 100644 index 35c864126..000000000 --- a/.vib/wordpress/cypress/cypress/integration/smtp_config_spec.js +++ /dev/null @@ -1,34 +0,0 @@ -/// -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')}`); - }) - -}) diff --git a/.vib/wordpress/cypress/cypress/integration/update_config_spec.js b/.vib/wordpress/cypress/cypress/integration/update_config_spec.js deleted file mode 100644 index a17ec2db6..000000000 --- a/.vib/wordpress/cypress/cypress/integration/update_config_spec.js +++ /dev/null @@ -1,12 +0,0 @@ -/// -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.'); - }) -}) diff --git a/.vib/wordpress/cypress/cypress/integration/wordpress_spec.js b/.vib/wordpress/cypress/cypress/integration/wordpress_spec.js new file mode 100644 index 000000000..7f1244934 --- /dev/null +++ b/.vib/wordpress/cypress/cypress/integration/wordpress_spec.js @@ -0,0 +1,103 @@ +/// + +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'); +}) +