From 729e7083aee7f8f371b2aedeabb6a598767be413 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 17 Dec 2018 15:19:34 -0400 Subject: [PATCH 1/6] move front end tests to front-end folder --- tests/e2e-tests/{ => front-end}/cart-page.js | 0 tests/e2e-tests/{ => front-end}/checkout-page.js | 0 tests/e2e-tests/{ => front-end}/my-account-page.js | 0 tests/e2e-tests/{ => front-end}/single-product.js | 0 4 files changed, 0 insertions(+), 0 deletions(-) rename tests/e2e-tests/{ => front-end}/cart-page.js (100%) rename tests/e2e-tests/{ => front-end}/checkout-page.js (100%) rename tests/e2e-tests/{ => front-end}/my-account-page.js (100%) rename tests/e2e-tests/{ => front-end}/single-product.js (100%) diff --git a/tests/e2e-tests/cart-page.js b/tests/e2e-tests/front-end/cart-page.js similarity index 100% rename from tests/e2e-tests/cart-page.js rename to tests/e2e-tests/front-end/cart-page.js diff --git a/tests/e2e-tests/checkout-page.js b/tests/e2e-tests/front-end/checkout-page.js similarity index 100% rename from tests/e2e-tests/checkout-page.js rename to tests/e2e-tests/front-end/checkout-page.js diff --git a/tests/e2e-tests/my-account-page.js b/tests/e2e-tests/front-end/my-account-page.js similarity index 100% rename from tests/e2e-tests/my-account-page.js rename to tests/e2e-tests/front-end/my-account-page.js diff --git a/tests/e2e-tests/single-product.js b/tests/e2e-tests/front-end/single-product.js similarity index 100% rename from tests/e2e-tests/single-product.js rename to tests/e2e-tests/front-end/single-product.js From 3ab427f8bf5d5df2fd10494fa02fbd5cd4b25dc9 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 17 Dec 2018 15:22:36 -0400 Subject: [PATCH 2/6] add config-theme.js to test that a functional supported theme is active --- tests/e2e-tests/config-theme.js | 55 +++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 tests/e2e-tests/config-theme.js diff --git a/tests/e2e-tests/config-theme.js b/tests/e2e-tests/config-theme.js new file mode 100644 index 00000000000..0d6c6952c55 --- /dev/null +++ b/tests/e2e-tests/config-theme.js @@ -0,0 +1,55 @@ +import config from 'config'; +import chai from 'chai'; +import chaiAsPromised from 'chai-as-promised'; +import test from 'selenium-webdriver/testing'; +import { WebDriverManager, WebDriverHelper as helper } from 'wp-e2e-webdriver'; +import { WPLogin, WPAdmin } from 'wp-e2e-page-objects'; + +chai.use( chaiAsPromised ); +const assert = chai.assert; + +let manager; +let driver; + +test.describe( 'Check for functional theme', function() { + // open browser + test.before( function() { + this.timeout( config.get( 'startBrowserTimeoutMs' ) ); + + manager = new WebDriverManager( 'chrome', { baseUrl: config.get( 'url' ) } ); + driver = manager.getDriver(); + + helper.clearCookiesAndDeleteLocalStorage( driver ); + } ); + + this.timeout( config.get( 'mochaTimeoutMs' ) ); + + // login + test.before( () => { + const wpLogin = new WPLogin( driver, { url: manager.getPageUrl( '/wp-login.php' ) } ); + wpLogin.login( config.get( 'users.admin.username' ), config.get( 'users.admin.password' ) ); + } ); + + // Check theme status after conditionally attempting to revert to the default theme + test.it( 'have working theme', () => { + const themesArgs = { url: manager.getPageUrl( '/wp-admin/themes.php' ), visit: true }; + const themes = new WPAdmin( driver, themesArgs ); + + driver.navigate().refresh(); + assert.eventually.notEqual( themes.hasNotice( 'The active theme is broken.' ) ); + assert.eventually.notEqual( themes.hasNotice( 'No themes found.' ) ); + assert.eventually.notEqual( themes.hasNotice( 'ERROR:' ) ); + } ); + + // take screenshot + test.afterEach( function() { + if ( this.currentTest.state === 'failed' ) { + helper.takeScreenshot( manager, this.currentTest ); + } + } ); + + // quit browser + test.after( () => { + manager.quitBrowser(); + } ); +} ); From 603dd8cfcd8991a472f6cfc8cb6831cd5be32ce9 Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Mon, 17 Dec 2018 16:05:53 -0400 Subject: [PATCH 3/6] remove redundant form update in cart page tests --- tests/e2e-tests/front-end/cart-page.js | 1 - 1 file changed, 1 deletion(-) diff --git a/tests/e2e-tests/front-end/cart-page.js b/tests/e2e-tests/front-end/cart-page.js index 970a0644864..a0fd6cb1436 100644 --- a/tests/e2e-tests/front-end/cart-page.js +++ b/tests/e2e-tests/front-end/cart-page.js @@ -51,7 +51,6 @@ test.describe( 'Cart page', function() { test.it( 'should updates qty when updated via qty input', () => { const cartPage = new CartPage( driver, { url: manager.getPageUrl( '/cart' ) } ); cartPage.getItem( 'Album', { qty: 2 } ).setQty( 4 ); - cartPage.update(); cartPage.getItem( 'Polo', { qty: 1 } ).setQty( 3 ); cartPage.update(); From e2f34928d304a511074f2f562ed63db75c4b89ec Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 18 Dec 2018 14:23:11 -0400 Subject: [PATCH 4/6] update checkout flow for 3.5.0 --- tests/e2e-tests/front-end/checkout-page.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/tests/e2e-tests/front-end/checkout-page.js b/tests/e2e-tests/front-end/checkout-page.js index cae53389982..347a4973434 100644 --- a/tests/e2e-tests/front-end/checkout-page.js +++ b/tests/e2e-tests/front-end/checkout-page.js @@ -143,10 +143,8 @@ test.describe( 'Checkout Page', function() { checkoutPage.placeOrder(); Helper.waitTillUIBlockNotPresent( driver ); - const orderReceivedPage = new CheckoutOrderReceivedPage( driver, { visit: false } ); - assert.eventually.ok( - orderReceivedPage.hasText( 'Order received' ) + checkoutPage.hasText( 'Order received' ) ); } ); From 6079e1f541b45e2ea1bf56506546316f321ac27d Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 18 Dec 2018 16:02:57 -0400 Subject: [PATCH 5/6] ensure WP database is upgraded for current WP version --- tests/e2e-tests/{config-theme.js => config-setup.js} | 7 +++++++ 1 file changed, 7 insertions(+) rename tests/e2e-tests/{config-theme.js => config-setup.js} (86%) diff --git a/tests/e2e-tests/config-theme.js b/tests/e2e-tests/config-setup.js similarity index 86% rename from tests/e2e-tests/config-theme.js rename to tests/e2e-tests/config-setup.js index 0d6c6952c55..e39b9cab2d9 100644 --- a/tests/e2e-tests/config-theme.js +++ b/tests/e2e-tests/config-setup.js @@ -30,6 +30,13 @@ test.describe( 'Check for functional theme', function() { wpLogin.login( config.get( 'users.admin.username' ), config.get( 'users.admin.password' ) ); } ); + // Update the database to the current version of WP + test.it( 'update WordPress database', () => { + const updateArgs = { url: manager.getPageUrl( '/wp-admin/upgrade.php?step=upgrade_db' ), visit: true }; + const themes = new WPAdmin( driver, updateArgs ); + + } ); + // Check theme status after conditionally attempting to revert to the default theme test.it( 'have working theme', () => { const themesArgs = { url: manager.getPageUrl( '/wp-admin/themes.php' ), visit: true }; From e04b0fff316c97ca5e0e8b5f1c38ca749d0fdd6d Mon Sep 17 00:00:00 2001 From: Ron Rennick Date: Tue, 18 Dec 2018 16:22:19 -0400 Subject: [PATCH 6/6] use a more appropriate description for new installation tests --- tests/e2e-tests/config-setup.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/e2e-tests/config-setup.js b/tests/e2e-tests/config-setup.js index e39b9cab2d9..630a61c4bd3 100644 --- a/tests/e2e-tests/config-setup.js +++ b/tests/e2e-tests/config-setup.js @@ -11,7 +11,7 @@ const assert = chai.assert; let manager; let driver; -test.describe( 'Check for functional theme', function() { +test.describe( 'Check for functional WordPress installation', function() { // open browser test.before( function() { this.timeout( config.get( 'startBrowserTimeoutMs' ) ); @@ -33,7 +33,7 @@ test.describe( 'Check for functional theme', function() { // Update the database to the current version of WP test.it( 'update WordPress database', () => { const updateArgs = { url: manager.getPageUrl( '/wp-admin/upgrade.php?step=upgrade_db' ), visit: true }; - const themes = new WPAdmin( driver, updateArgs ); + const update = new WPAdmin( driver, updateArgs ); } );