Skip to content

Commit

Permalink
Merge pull request #14825 from SimonGrn/fix_pom_bo
Browse files Browse the repository at this point in the history
Fix some minor problems on the "crawling BO" smoke test
  • Loading branch information
matthieu-rolland committed Jul 23, 2019
2 parents 88eb860 + 852190b commit e02ac5f
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 15 deletions.
11 changes: 4 additions & 7 deletions tests/puppeteer/pages/BO/BO_commonPage.js
Expand Up @@ -4,8 +4,6 @@ module.exports = class BO_COMMONPAGE extends CommonPage {
constructor(page) {
super(page);

this.pageTitle = 'Dashboard •';

// top navbar
this.headerLogoImage = '#header_logo';
this.userProfileIcon = '#employee_infos';
Expand All @@ -14,13 +12,13 @@ module.exports = class BO_COMMONPAGE extends CommonPage {
// left navbar
// SELL
this.ordersParentLink = 'li#subtab-AdminParentOrders';
this.ordersLink = '#subtab-AdminOrders>a';
this.ordersLink = '#subtab-AdminOrders';

this.productsParentLink = 'li#subtab-AdminCatalog';
this.productsLink = '#subtab-AdminProducts>a';
this.productsLink = '#subtab-AdminProducts';

this.customersParentLink = 'li#subtab-AdminParentCustomer';
this.customersLink = '#subtab-AdminCustomers>a';
this.customersLink = '#subtab-AdminCustomers';

// welcome module
this.onboardingCloseButton = 'button.onboarding-button-shut-down';
Expand All @@ -32,7 +30,6 @@ module.exports = class BO_COMMONPAGE extends CommonPage {
*/
/**
* Open a subMenu if closed and click on a sublink
* @param blockSelector
* @param parentSelector
* @param linkSelector
* @returns {Promise<void>}
Expand All @@ -46,7 +43,7 @@ module.exports = class BO_COMMONPAGE extends CommonPage {
await this.page.waitForSelector(`${parentSelector}.open`, {visible: true});
await this.page.click(linkSelector);
}
this.page.waitFor(500);
await this.page.waitForSelector(`${linkSelector}.-active`, {visible: true});
}

/**
Expand Down
2 changes: 1 addition & 1 deletion tests/puppeteer/pages/BO/BO_dashboard.js
Expand Up @@ -4,7 +4,7 @@ module.exports = class BO_DASHBOARD extends CommonPage {
constructor(page) {
super(page);

this.pageTitle = 'PrestaShop';
this.pageTitle = 'Dashboard • ';
}

/*
Expand Down
2 changes: 1 addition & 1 deletion tests/puppeteer/pages/BO/BO_login.js
Expand Up @@ -4,7 +4,7 @@ module.exports = class BO_LOGIN extends CommonPage {
constructor(page) {
super(page);

this.pageTitle = 'Dashboard • PrestaShop';
this.pageTitle = 'PrestaShop';

this.emailInput = '#email';
this.passwordInput = '#passwd';
Expand Down
10 changes: 7 additions & 3 deletions tests/puppeteer/test/smoke/crawlingBO.js
Expand Up @@ -24,7 +24,11 @@ const init = async () => {
BO_CUSTOMERS = await (new BO_CUSTOMERS_PAGE(page));
};

// connect to the BO
/*
Connect to the BO
Crawl a few key pages
Logout from the BO
*/
global.scenario('Crawl into BO et check a few key pages', async () => {
test('should login into BO', async () => {
await BO_LOGIN.goTo(global.URL_BO);
Expand Down Expand Up @@ -55,7 +59,7 @@ global.scenario('Crawl into BO et check a few key pages', async () => {
test('should logout from the BO', async () => {
// await BO_LOGIN.goTo(global.URL_BO);
await BO_COMMON.logoutBO();
const pageTitle = await BO_DASHBOARD.getPageTitle();
await global.expect(pageTitle).to.contains(BO_DASHBOARD.pageTitle);
const pageTitle = await BO_LOGIN.getPageTitle();
await global.expect(pageTitle).to.contains(BO_LOGIN.pageTitle);
});
}, init, true);
8 changes: 6 additions & 2 deletions tests/puppeteer/test/smoke/main.js
@@ -1,12 +1,16 @@
// importing pages
const BO_LOGIN_PAGE = require('../../pages/BO/BO_login');
const BO_DASHBOARD_PAGE = require('../../pages/BO/BO_dashboard');

let page;
let BO_LOGIN;
let BO_DASHBOARD;

// creating pages objects in a function
const init = async () => {
page = await global.browser.newPage();
BO_LOGIN = await (new BO_LOGIN_PAGE(page));
BO_DASHBOARD = await (new BO_DASHBOARD_PAGE(page));
};


Expand All @@ -19,7 +23,7 @@ global.scenario('should go to the BO', async () => {
await BO_LOGIN.login(global.EMAIL, global.PASSWD);
});
test('should be on the dashboard', async () => {
const pageTitle = await BO_LOGIN.getPageTitle();
await global.expect(pageTitle).to.equal(BO_LOGIN.pageTitle);
const pageTitle = await BO_DASHBOARD.getPageTitle();
await global.expect(pageTitle).to.equal(BO_DASHBOARD.pageTitle);
});
}, init, true);
2 changes: 1 addition & 1 deletion tests/puppeteer/test/utils/globals.js
Expand Up @@ -3,7 +3,7 @@ global.URL_BO = process.env.URL_BO || `${global.URL_FO}admin-dev/`;
global.URL_INSTALL = process.env.URL_INSTALL || `${global.URL_FO}install-dev/`;
global.EMAIL = process.env.LOGIN || 'demo@prestashop.com';
global.PASSWD = process.env.PASSWD || 'prestashop_demo';
global.HEADLESS = process.env.HEADLESS || false;
global.HEADLESS = process.env.HEADLESS || true;
global.browser = null;
global.SHOPNAME = process.env.SHOPNAME || 'Prestashop';
global.db_user = process.env.DB_USER || 'root';
Expand Down

0 comments on commit e02ac5f

Please sign in to comment.