From 018bf8df1f09db928ac39dc2693611bb9f30762d Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Mon, 19 Aug 2019 11:05:22 +0200 Subject: [PATCH 1/3] All BO classes should inherit from BObasePage --- tests/puppeteer/pages/BO/customer.js | 4 ++-- tests/puppeteer/pages/BO/dashboard.js | 4 ++-- tests/puppeteer/pages/BO/login.js | 4 ++-- tests/puppeteer/pages/BO/order.js | 4 ++-- tests/puppeteer/pages/BO/product.js | 4 ++-- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/puppeteer/pages/BO/customer.js b/tests/puppeteer/pages/BO/customer.js index db4c048e77693..6f86ed8bbf944 100644 --- a/tests/puppeteer/pages/BO/customer.js +++ b/tests/puppeteer/pages/BO/customer.js @@ -1,6 +1,6 @@ -const CommonPage = require('../commonPage'); +const BOBasePage = require('../BO/BObasePage'); -module.exports = class Customer extends CommonPage { +module.exports = class Customer extends BOBasePage { constructor(page) { super(page); diff --git a/tests/puppeteer/pages/BO/dashboard.js b/tests/puppeteer/pages/BO/dashboard.js index e2bf82392af10..218a2c4b397f6 100644 --- a/tests/puppeteer/pages/BO/dashboard.js +++ b/tests/puppeteer/pages/BO/dashboard.js @@ -1,6 +1,6 @@ -const CommonPage = require('../commonPage'); +const BOBasePage = require('../BO/BObasePage'); -module.exports = class Dashboard extends CommonPage { +module.exports = class Dashboard extends BOBasePage { constructor(page) { super(page); diff --git a/tests/puppeteer/pages/BO/login.js b/tests/puppeteer/pages/BO/login.js index a573e7b7c12ca..39f4c4bf164cf 100644 --- a/tests/puppeteer/pages/BO/login.js +++ b/tests/puppeteer/pages/BO/login.js @@ -1,6 +1,6 @@ -const CommonPage = require('../commonPage'); +const BOBasePage = require('../BO/BObasePage'); -module.exports = class Login extends CommonPage { +module.exports = class Login extends BOBasePage { constructor(page) { super(page); diff --git a/tests/puppeteer/pages/BO/order.js b/tests/puppeteer/pages/BO/order.js index c203564d3cac9..b60d091fbc4f9 100644 --- a/tests/puppeteer/pages/BO/order.js +++ b/tests/puppeteer/pages/BO/order.js @@ -1,6 +1,6 @@ -const CommonPage = require('../commonPage'); +const BOBasePage = require('../BO/BObasePage'); -module.exports = class Order extends CommonPage { +module.exports = class Order extends BOBasePage { constructor(page) { super(page); diff --git a/tests/puppeteer/pages/BO/product.js b/tests/puppeteer/pages/BO/product.js index 341927e207a79..e8404902e363b 100644 --- a/tests/puppeteer/pages/BO/product.js +++ b/tests/puppeteer/pages/BO/product.js @@ -1,6 +1,6 @@ -const CommonPage = require('../commonPage'); +const BOBasePage = require('../BO/BObasePage'); -module.exports = class Product extends CommonPage { +module.exports = class Product extends BOBasePage { constructor(page) { super(page); From 75817efd1ebbd39222e4b6a68bdbb58e8133b73b Mon Sep 17 00:00:00 2001 From: Boubker BRIBRI Date: Mon, 19 Aug 2019 11:51:56 +0200 Subject: [PATCH 2/3] Fix eslint errors with max-len equal to 120 --- tests/puppeteer/.eslintrc.js | 3 ++- tests/puppeteer/campaigns/linkchecker.js | 6 +++++- tests/puppeteer/campaigns/smoke/crawlingBO.js | 2 +- tests/puppeteer/pages/Install/install.js | 18 +++++++++--------- tests/puppeteer/pages/commonPage.js | 6 +++--- 5 files changed, 20 insertions(+), 15 deletions(-) diff --git a/tests/puppeteer/.eslintrc.js b/tests/puppeteer/.eslintrc.js index 0a5f05bdb3e37..ac7fcebed43fc 100755 --- a/tests/puppeteer/.eslintrc.js +++ b/tests/puppeteer/.eslintrc.js @@ -16,6 +16,7 @@ module.exports = { sourceType: 'module', }, rules: { - 'no-plusplus': [2, { allowForLoopAfterthoughts: true }] + 'no-plusplus': [2, { allowForLoopAfterthoughts: true }], + "max-len": [2, {"code": 120}] }, }; diff --git a/tests/puppeteer/campaigns/linkchecker.js b/tests/puppeteer/campaigns/linkchecker.js index d61d72143faf7..dc67471140d31 100755 --- a/tests/puppeteer/campaigns/linkchecker.js +++ b/tests/puppeteer/campaigns/linkchecker.js @@ -127,7 +127,11 @@ const run = async () => { const curDate = new Date(); - const filename = `report_${curDate.toJSON().slice(0, 10)}_${curDate.getHours()}${curDate.getMinutes()}${curDate.getSeconds()}.json`; + const dateString = curDate.toJSON().slice(0, 10); + const hours = curDate.getHours(); + const minutes = curDate.getMinutes(); + const seconds = curDate.getSeconds(); + const filename = `report_${dateString}_${hours}${minutes}${seconds}.json`; // Create folder reports if not exist if (!fs.existsSync(reportPath)) { fs.mkdirSync(reportPath); diff --git a/tests/puppeteer/campaigns/smoke/crawlingBO.js b/tests/puppeteer/campaigns/smoke/crawlingBO.js index 2a77e55d6765e..826616de73aab 100644 --- a/tests/puppeteer/campaigns/smoke/crawlingBO.js +++ b/tests/puppeteer/campaigns/smoke/crawlingBO.js @@ -3,7 +3,7 @@ const LoginPage = require('../../pages/BO/login'); const DashboardPage = require('../../pages/BO/dashboard'); const BOBasePage = require('../../pages/BO/BObasePage'); const OrderPage = require('../../pages/BO/order'); -const ProductPage= require('../../pages/BO/product'); +const ProductPage = require('../../pages/BO/product'); const CustomerPage = require('../../pages/BO/customer'); let page; diff --git a/tests/puppeteer/pages/Install/install.js b/tests/puppeteer/pages/Install/install.js index 7e52e2f3f6bef..d5ecbfd338548 100755 --- a/tests/puppeteer/pages/Install/install.js +++ b/tests/puppeteer/pages/Install/install.js @@ -48,15 +48,15 @@ module.exports = class Install extends CommonPage { // Selectors for Final step this.installationProgressBar = '#install_process_form #progress_bar .installing'; - this.generateSettingsFileStep = "#process_step_generateSettingsFile"; - this.installDatabaseStep = "#process_step_installDatabase"; - this.installDefaultDataStep = "#process_step_installDefaultData"; - this.populateDatabaseStep = "#process_step_populateDatabase"; - this.configureShopStep = "#process_step_configureShop"; - this.installModulesStep = "#process_step_installModules"; - this.installModulesAddons = "#process_step_installModulesAddons"; - this.installThemeStep = "#process_step_installTheme"; - this.installFixturesStep = "#process_step_installFixtures"; + this.generateSettingsFileStep = '#process_step_generateSettingsFile'; + this.installDatabaseStep = '#process_step_installDatabase'; + this.installDefaultDataStep = '#process_step_installDefaultData'; + this.populateDatabaseStep = '#process_step_populateDatabase'; + this.configureShopStep = '#process_step_configureShop'; + this.installModulesStep = '#process_step_installModules'; + this.installModulesAddons = '#process_step_installModulesAddons'; + this.installThemeStep = '#process_step_installTheme'; + this.installFixturesStep = '#process_step_installFixtures'; this.finalStepPageTitle = '#install_process_success h2'; this.discoverFoButton = '#foBlock'; diff --git a/tests/puppeteer/pages/commonPage.js b/tests/puppeteer/pages/commonPage.js index 92e055b0fed40..4acb1ee49f2ba 100755 --- a/tests/puppeteer/pages/commonPage.js +++ b/tests/puppeteer/pages/commonPage.js @@ -81,11 +81,11 @@ module.exports = class CommonPage { switch (parameter) { case 'equal': await this.page.$eval(selector, el => el.innerText) - .then(text => expect(text.replace(/\s+/g, ' ').trim()).to.equal(textToCheckWith)); + .then(text => global.expect(text.replace(/\s+/g, ' ').trim()).to.equal(textToCheckWith)); break; case 'contain': await this.page.$eval(selector, el => el.innerText) - .then(text => expect(text).to.contain(textToCheckWith)); + .then(text => global.expect(text).to.contain(textToCheckWith)); break; default: // do nothing @@ -103,6 +103,6 @@ module.exports = class CommonPage { await this.page.waitForSelector(selector); const value = await this.page.$eval(selector, (el, attribute) => el .getAttribute(attribute), attribute); - expect(value).to.be.equal(textToCheckWith); + global.expect(value).to.be.equal(textToCheckWith); } }; From 6cae9b55cb95198159a0aeda192d9f9ccb4f9fa5 Mon Sep 17 00:00:00 2001 From: boubkerbribri <48441421+boubkerbribri@users.noreply.github.com> Date: Mon, 19 Aug 2019 13:32:01 +0200 Subject: [PATCH 3/3] Update eslintrc file Co-Authored-By: GoT --- tests/puppeteer/.eslintrc.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/puppeteer/.eslintrc.js b/tests/puppeteer/.eslintrc.js index ac7fcebed43fc..f8a5a88e528b7 100755 --- a/tests/puppeteer/.eslintrc.js +++ b/tests/puppeteer/.eslintrc.js @@ -17,6 +17,6 @@ module.exports = { }, rules: { 'no-plusplus': [2, { allowForLoopAfterthoughts: true }], - "max-len": [2, {"code": 120}] + 'max-len': [2, {code: 120}] }, };