Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- by_price.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- var coreData = require('./../../../../../../data/admin/core/index');
- describe('Add Collection - Auto Adding - By Price', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('price1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('price2'),
- type: productData.product.type,
- firstPrice: productData.product.price
- };
- describe('check price metric', function () {
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should select condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product price');
- });
- it('should show correct price placeholder', function () {
- expect(addCollectionPage.txtConditionValuePlaceholder()).toEqual('$');
- });
- it('should select condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- });
- it('should not show price placeholder', function () {
- expect(addCollectionPage.plhPrice('$').isPresent()).toBeFalsy();
- });
- });
- describe('auto-add product by product price is equal', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product price');
- addCollectionPage.selectConditionRule(0, 'is equal to');
- addCollectionPage.fillConditionValue(0, '$25.00');
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product price is not equal', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product price');
- addCollectionPage.selectConditionRule(0, 'is not equal to');
- addCollectionPage.fillConditionValue(0, '$35.00');
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product price is greater then', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product price');
- addCollectionPage.selectConditionRule(0, 'is greater then');
- addCollectionPage.fillConditionValue(0, '$15.00');
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product price is less then', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product price');
- addCollectionPage.selectConditionRule(0, 'is less then');
- addCollectionPage.fillConditionValue(0, '$35.00');
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_tag.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Tag', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('tag1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('tag2'),
- type: productData.product.type,
- tag: productData.product.tag,
- price: productData.product.price
- };
- describe('auto-add product by product tag does not contain', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productTag = 'mouse' + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.selectVendor(productTag);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product tag');
- addCollectionPage.selectConditionRule(0, 'does not contain');
- addCollectionPage.fillConditionValue(0, product.tag);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product tag is exactly', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productTag = product.tag + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.addTag(productTag);
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product tag');
- addCollectionPage.selectConditionRule(0, 'is exactly');
- addCollectionPage.fillConditionValue(0, productTag);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product tag starts with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productTag = firstCollectionTitle + product.tag;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.addTag(productTag);
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product tag');
- addCollectionPage.selectConditionRule(0, 'starts with');
- addCollectionPage.fillConditionValue(0, firstCollectionTitle);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product tag ends with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productTag = product.tag + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.addTag(productTag);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product tag');
- addCollectionPage.selectConditionRule(0, 'ends with');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product tag contains', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productTag = product.type + unique_value + 'contains';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.addTag(productTag);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product tag');
- addCollectionPage.selectConditionRule(0, 'contains');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_title.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Title', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('title1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('title2'),
- secondTitle: commonHelper.uniqueProductName('title3'),
- type: productData.product.type,
- price: productData.product.price
- };
- describe('auto-add product by product title does not contain', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = 'book' + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- addCollectionPage.selectConditionRule(0, 'does not contain');
- addCollectionPage.fillConditionValue(0, product.firstTitle);
- });
- it('should add new condition', function () {
- addCollectionPage.clickAddCondition();
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(1, 'Product title');
- addCollectionPage.selectConditionRule(1, 'does not contain');
- addCollectionPage.fillConditionValue(1, product.secondTitle);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product title is exactly', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- addCollectionPage.selectConditionRule(0, 'is exactly');
- addCollectionPage.fillConditionValue(0, productTitle);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product title starts with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = unique_value + product.firstTitle;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- addCollectionPage.selectConditionRule(0, 'starts with');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product title ends with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- addCollectionPage.selectConditionRule(0, 'ends with');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product title contains', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value + 'contains';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- addCollectionPage.selectConditionRule(0, 'contains');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_type.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Type', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('type1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('type2'),
- type: productData.product.type,
- price: productData.product.price
- };
- describe('auto-add product by product type does not contain', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productType = 'cups' + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(productType);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product type');
- addCollectionPage.selectConditionRule(0, 'does not contain');
- addCollectionPage.fillConditionValue(0, product.type);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product type is exactly', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productType = product.type + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(productType);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product type');
- addCollectionPage.selectConditionRule(0, 'is exactly');
- addCollectionPage.fillConditionValue(0, productType);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product type starts with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productType = firstCollectionTitle + product.type;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(productType);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product type');
- addCollectionPage.selectConditionRule(0, 'starts with');
- addCollectionPage.fillConditionValue(0, firstCollectionTitle);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product type ends with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productType = product.type + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(productType);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product type');
- addCollectionPage.selectConditionRule(0, 'ends with');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product type contains', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productType = product.type + unique_value + 'contains';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(productType);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product type');
- addCollectionPage.selectConditionRule(0, 'contains');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_varian.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Variant', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('variant1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('variant2'),
- type: productData.product.type,
- price: productData.product.price,
- firstColor: productData.product.color.first,
- secondColor: productData.product.color.second,
- firstSize: productData.product.size.first,
- secondSize: productData.product.size.second,
- firstVariant: productData.product.color.first + ' / ' + productData.product.size.first
- };
- describe('auto-add product by product variant does not contain', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVariant = product.firstColor + '1';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.clickMulti();
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillOptionTitle(0, 'Color');
- addProductPage.fillOptionValue(0, product.firstColor);
- addProductPage.fillOptionValue(0, product.secondColor);
- addProductPage.fillOptionTitle(1, 'Size');
- addProductPage.fillOptionValue(1, product.firstSize);
- addProductPage.fillOptionValue(1, product.secondSize);
- addProductPage.fillVariantPrice(product.firstVariant ,product.price);
- addProductPage.clickVariantPriceAutofill(product.firstVariant);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Variant option value');
- addCollectionPage.selectConditionRule(0, 'does not contain');
- addCollectionPage.fillConditionValue(0, productVariant);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product variant is exactly', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.clickMulti();
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillOptionTitle(0, 'Color');
- addProductPage.fillOptionValue(0, product.firstColor);
- addProductPage.fillOptionValue(0, product.secondColor);
- addProductPage.fillOptionTitle(1, 'Size');
- addProductPage.fillOptionValue(1, product.firstSize);
- addProductPage.fillOptionValue(1, product.secondSize);
- addProductPage.fillVariantPrice(product.firstVariant ,product.price);
- addProductPage.clickVariantPriceAutofill(product.firstVariant);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Variant option value');
- addCollectionPage.selectConditionRule(0, 'is exactly');
- addCollectionPage.fillConditionValue(0, product.firstSize);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product variant starts with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVariant = 'Re';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.clickMulti();
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillOptionTitle(0, 'Color');
- addProductPage.fillOptionValue(0, product.firstColor);
- addProductPage.fillOptionValue(0, product.secondColor);
- addProductPage.fillOptionTitle(1, 'Size');
- addProductPage.fillOptionValue(1, product.firstSize);
- addProductPage.fillOptionValue(1, product.secondSize);
- addProductPage.fillVariantPrice(product.firstVariant ,product.price);
- addProductPage.clickVariantPriceAutofill(product.firstVariant);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Variant option value');
- addCollectionPage.selectConditionRule(0, 'starts with');
- addCollectionPage.fillConditionValue(0, productVariant);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product variant ends with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVariant = 'all';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.clickMulti();
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillOptionTitle(0, 'Color');
- addProductPage.fillOptionValue(0, product.firstColor);
- addProductPage.fillOptionValue(0, product.secondColor);
- addProductPage.fillOptionTitle(1, 'Size');
- addProductPage.fillOptionValue(1, product.firstSize);
- addProductPage.fillOptionValue(1, product.secondSize);
- addProductPage.fillVariantPrice(product.firstVariant ,product.price);
- addProductPage.clickVariantPriceAutofill(product.firstVariant);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Variant option value');
- addCollectionPage.selectConditionRule(0, 'ends with');
- addCollectionPage.fillConditionValue(0, productVariant);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product variant contains', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.clickMulti();
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillOptionTitle(0, 'Color');
- addProductPage.fillOptionValue(0, product.firstColor);
- addProductPage.fillOptionValue(0, product.secondColor);
- addProductPage.fillOptionTitle(1, 'Size');
- addProductPage.fillOptionValue(1, product.firstSize);
- addProductPage.fillOptionValue(1, product.secondSize);
- addProductPage.fillVariantPrice(product.firstVariant ,product.price);
- addProductPage.clickVariantPriceAutofill(product.firstVariant);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Variant option value');
- addCollectionPage.selectConditionRule(0, 'contains');
- addCollectionPage.fillConditionValue(0, product.secondColor);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_vendor.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Vendor', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('vendor1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('vendor2'),
- type: productData.product.type,
- vendor: productData.product.vendor,
- price: productData.product.price
- };
- describe('auto-add product by product vendor does not contain', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVendor = 'glass' + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.selectVendor(productVendor);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product vendor');
- addCollectionPage.selectConditionRule(0, 'does not contain');
- addCollectionPage.fillConditionValue(0, product.vendor);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product vendor is exactly', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVendor = product.vendor + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.selectVendor(productVendor);
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product vendor');
- addCollectionPage.selectConditionRule(0, 'is exactly');
- addCollectionPage.fillConditionValue(0, productVendor);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product vendor starts with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVendor = firstCollectionTitle + product.vendor;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.selectVendor(productVendor);
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product vendor');
- addCollectionPage.selectConditionRule(0, 'starts with');
- addCollectionPage.fillConditionValue(0, firstCollectionTitle);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product vendor ends with', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVendor = product.tag + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.selectVendor(productVendor);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product vendor');
- addCollectionPage.selectConditionRule(0, 'ends with');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by product vendor contains', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- var productVendor = product.type + unique_value + 'contains';
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.selectVendor(productVendor);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product vendor');
- addCollectionPage.selectConditionRule(0, 'contains');
- addCollectionPage.fillConditionValue(0, unique_value);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
- by_weight.spec.js
- var pageObject = require('./../../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var signInData = require('./../../../../../../data/admin/sign_in/index');
- var collectionData = require('./../../../../../../data/admin/collection/index');
- var productData = require('./../../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
- describe('Add Collection - Auto Adding - By Weight', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('weight1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('weight2'),
- type: productData.product.type,
- firstWeight: productData.product.weight,
- secondWeight: '1',
- thirdWeight: '3',
- firstPrice: productData.product.price
- };
- describe('check weight metric', function () {
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should select condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Weight');
- });
- it('should show correct price placeholder', function () {
- expect(addCollectionPage.txtConditionWeightPlaceholder()).toEqual('kg');
- });
- it('should select condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Product title');
- });
- it('should not show price placeholder', function () {
- expect(addCollectionPage.plhWeight('kg').isPresent()).toBeFalsy();
- });
- });
- describe('auto-add product by weight is equal', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.fillShippingWeight(product.firstWeight);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Weight');
- addCollectionPage.selectConditionRule(0, 'is equal to');
- addCollectionPage.fillConditionValue(0, product.firstWeight);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should go to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by weight is not equal', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.fillShippingWeight(product.firstWeight);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Weight');
- addCollectionPage.selectConditionRule(0, 'is not equal to');
- addCollectionPage.fillConditionValue(0, product.secondWeight);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by weight is greater then', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.fillShippingWeight(product.firstWeight);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Weight');
- addCollectionPage.selectConditionRule(0, 'is greater then');
- addCollectionPage.fillConditionValue(0, product.secondWeight);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('auto-add product by weight is less then', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.firstPrice);
- addProductPage.fillShippingWeight(product.firstWeight);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should click auto add product radio button', function () {
- addCollectionPage.clickAddAuto();
- commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
- });
- it('should add condition', function () {
- addCollectionPage.selectConditionVariant(0, 'Weight');
- addCollectionPage.selectConditionRule(0, 'is less then');
- addCollectionPage.fillConditionValue(0, product.thirdWeight);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(collectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- });
- it('should see product', function check(done) {
- collectionsPage.allProducts(productTitle).count().then(function(result){
- if(result == 1){
- done();
- }else {
- collectionsPage.clickPaginationButton('Next');
- check(done);
- }
- })
- });
- it('should switch to previous tab', function () {
- commonHelper.switchToPreviousTab();
- });
- });
- });
- ---------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement