Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 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 () {
- dashboardPage.openAddCollectionPage();
- });
- 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 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.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 () {
- 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, '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 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.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 () {
- 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, '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 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.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 () {
- 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, '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 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.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 () {
- 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, '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();
- });
- });
- });
Add Comment
Please, Sign In to add comment