From 7b3bfbff11dad110b42447c7cfbdb80bfb6c5033 Mon Sep 17 00:00:00 2001 From: Hatem Hadrich Date: Wed, 25 Oct 2017 10:12:46 +0100 Subject: [PATCH] Test preview button (#58) --- test/itg/1.7/globals.webdriverio.js | 3 +- .../scenario/BO/create_product.webdriverio.js | 38 +++++++++++++++++++ 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/test/itg/1.7/globals.webdriverio.js b/test/itg/1.7/globals.webdriverio.js index 7f4cfab..ca66fbd 100644 --- a/test/itg/1.7/globals.webdriverio.js +++ b/test/itg/1.7/globals.webdriverio.js @@ -78,7 +78,8 @@ module.exports = { picture_cover: '.iscover', product_online_toggle: '.switch-input ', catalogue_filter_by_name_input: '//input[@name="filter_column_name"]', - catalogue_submit_filter_button: '//button[@name="products_filter_submit"]' + catalogue_submit_filter_button: '//button[@name="products_filter_submit"]', + preview_button: '//*[@id="product_form_preview_btn"]' }, //Order selector OrderPage:{ diff --git a/test/itg/1.7/scenario/BO/create_product.webdriverio.js b/test/itg/1.7/scenario/BO/create_product.webdriverio.js index 3a931e5..f5db46e 100644 --- a/test/itg/1.7/scenario/BO/create_product.webdriverio.js +++ b/test/itg/1.7/scenario/BO/create_product.webdriverio.js @@ -144,6 +144,25 @@ describe('The Product Creation', function () { this.client.call(done); }); + it('should click on preview button before enabling product', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.AddProductPage.preview_button, 90000) + .click(this.selector.BO.AddProductPage.preview_button) + .windowHandles().then(function (handles) { + return this.switchTab(handles.value[handles.value.length - 1]); + }) + .waitForExist(this.selector.FO.BuyOrderPage.product_name_details, 90000) + .getText(this.selector.FO.BuyOrderPage.product_name_details).then(function (name) { + should(name[1].toLowerCase()).be.equal('test_nodejs_' + product_id) + }) + .pause(3000) + .windowHandles().then(function (handles) { + return this.switchTab(handles.value[0]); + }) + .call(done); + }); + it('should select product online', function (done) { global.fctname = this.test.title; this.client @@ -152,6 +171,25 @@ describe('The Product Creation', function () { .call(done); }); + it('should click on preview button after enabling product', function (done) { + global.fctname = this.test.title; + this.client + .waitForExist(this.selector.BO.AddProductPage.preview_button, 90000) + .click(this.selector.BO.AddProductPage.preview_button) + .windowHandles().then(function (handles) { + return this.switchTab(handles.value[handles.value.length - 1]); + }) + .waitForExist(this.selector.FO.BuyOrderPage.product_name_details, 90000) + .getText(this.selector.FO.BuyOrderPage.product_name_details).then(function (name) { + should(name[1].toLowerCase()).be.equal('test_nodejs_' + product_id) + }) + .pause(3000) + .windowHandles().then(function (handles) { + return this.switchTab(handles.value[0]); + }) + .call(done); + }); + it('should save product', function (done) { global.fctname = this.test.title; this.client