Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- by_variant.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 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 open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open new product page', function () {
- productListPage.clickAddProduct();
- 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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 open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open new product page', function () {
- productListPage.clickAddProduct();
- 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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 open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open new product page', function () {
- productListPage.clickAddProduct();
- 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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 open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open new product page', function () {
- productListPage.clickAddProduct();
- 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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 open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open new product page', function () {
- productListPage.clickAddProduct();
- 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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();
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement