Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- app_product.po.js
- var commonHelper = require('./../../helpers/common.helper');
- var AddProductPage = function () {
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- // Selectors
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- var image = '[data-ng-repeat="item in vm.images"]';
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- // Elements
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- // Main section ------------------------------------------------------------
- this.selType = element(by.model('vm.product.type'));
- this.selVendor = element(by.model('vm.product.vendor'));
- this.selCollections = element(by.model('vm.product.collections'));
- this.txtTitle = element(by.model('vm.product.title'));
- this.txtPrice = element(by.model('vm.product.price'));
- this.txtSku = element(by.model('vm.product.sku'));
- this.txtTags = $('input[placeholder="Enter tags"]');
- this.txtComparePrice = element(by.model('vm.product.compare_price'));
- this.txtShippingWeight = element(by.model('vm.product.shipping_weight'));
- this.select2FirstResult = element.all(by.repeater('item in $select.items')).first();
- this.select2Choice = element(by.binding('$item.title'));
- this.radMulti = $('[for="variant-multi"]');
- this.radSingle = $('[for="variant-single"]');
- // Variants section --------------------------------------------------------
- this.btnAddOption = $('[ng-click="vm.optionsControl.add()"]');
- this.eleAddEditThumbnailsForm = $('[name="ThumbnailForm"]');
- this.btnSubmitThumbnail = this.eleAddEditThumbnailsForm.$('[type="submit"]');
- // Images section ----------------------------------------------------------
- this.images = $$(image);
- // SEO section -------------------------------------------------------------
- this.txtSeoTitle = element(by.model('vm.product.seo_title'));
- this.txtMetaDescription = element(by.model('vm.product.seo_meta'));
- this.txtUrl = element(by.model('vm.product.seo_url'));
- // Other elements ----------------------------------------------------------
- this.imgLoader = $('[loading="!vm.queriesAreReady"] .chq-loader-image');
- this.btnPublish = $('[ng-click="vm.product.is_draft = false"]');
- this.btnDraft = $('[ng-click="vm.product.is_draft = true"]');
- this.btnSave = $('button[ng-if="vm.product.id"]');
- this.btnSaveAsTemplate = $('[ng-click="vm.submitControl.open()"]');
- this.chkAnother = $('[ng-model="vm.createAnother"]+label');
- this.btnDeleteProduct = $('[ng-click="vm.delete()"]');
- this.btnConfirm = $('[data-ng-click="confirm()"]');
- // Template section --------------------------------------------------------
- this.txtTemplateTitle = element(by.model('vm.product.template_name'));
- this.btnSaveTemplate = $('[ng-click="vm.templateSave = true;"]');
- this.selTemplate = $('[placeholder="Use template"]');
- this.imgTemplateLoader = $('.bottom-buttons [src*="loader"]');
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- // Functions
- //--------------------------------------------------------------------------
- //--------------------------------------------------------------------------
- // Main section ------------------------------------------------------------
- this.selectType = function(name) {
- this.selType.click();
- var txtSelect2 = $('[style="opacity: 1;"] .select2-input');
- commonHelper.waitUntilElementVisible(txtSelect2);
- txtSelect2.sendKeys(name);
- var el = $$('.ui-select-choices-row-inner span').first();
- browser.sleep(1000);
- el.click();
- };
- this.fillType = function(value) {
- this.selType.clear();
- this.selType.sendKeys(value);
- };
- this.selectedType = function() {
- return this.selType.getText();
- };
- this.selectFirstCollection = function() {
- this.selCollections.click();
- commonHelper.waitUntilElementVisible(this.select2FirstResult);
- this.select2FirstResult.click();
- };
- this.selectCollection = function(name) {
- commonHelper.waitUntilElementVisible(this.selCollections);
- this.selCollections.click();
- var txtSelect2 = this.selCollections.$('.select2-input');
- commonHelper.waitUntilElementVisible(txtSelect2);
- txtSelect2.sendKeys(name);
- var el = $$('.ui-select-choices-row-inner>span').first();
- browser.sleep(500);
- el.click();
- };
- this.fillDescription = function(value) {
- var driver = browser.driver;
- var iframe = by.css('.cke_wysiwyg_frame');
- var el = driver.findElement(iframe);
- browser.switchTo().frame(el);
- var body = driver.findElement(by.tagName('body'));
- body.clear();
- body.sendKeys(value);
- browser.switchTo().defaultContent();
- };
- this.btnDeleteCollection = function(name) {
- return this.eleSelectedCollection(name).$('[ng-click="$selectMultiple.removeChoice($index)"]');
- };
- this.clickDeleteCollection = function(name) {
- this.btnDeleteCollection(name).click();
- commonHelper.waitUntilElementIsNotPresent(this.eleSelectedCollection(name));
- };
- this.deleteTab = function () {
- element(by.css('a[class^="ui-select-match-close"]')).click()
- };
- this.fillTitle = function(name) {
- commonHelper.waitUntilElementVisible(this.txtTitle);
- this.txtTitle.clear();
- this.txtTitle.sendKeys(name);
- };
- this.fillPrice = function(value) {
- this.txtPrice.clear();
- this.txtPrice.sendKeys(value);
- };
- this.fillComparePrice = function(value) {
- this.txtComparePrice.clear();
- this.txtComparePrice.sendKeys(value);
- };
- this.fillShippingWeight = function(value) {
- this.txtShippingWeight.clear();
- this.txtShippingWeight.sendKeys(value);
- };
- this.fillSku = function(value) {
- this.txtSku.clear();
- this.txtSku.sendKeys(value);
- };
- this.fillVendor = function(value) {
- this.selVendor.clear();
- this.selVendor.sendKeys(value);
- };
- this.selectVendor = function(name) {
- this.selVendor.click();
- var txtSelect2 = $('[style="opacity: 1;"] .select2-input');
- commonHelper.waitUntilElementVisible(txtSelect2);
- txtSelect2.sendKeys(name);
- var el = $$('.ui-select-choices-row-inner span').first();
- browser.sleep(1000);
- el.click();
- };
- this.eleSelectedCollection = function(name) {
- return element(by.cssContainingText('[ng-repeat*="$item in $select.selected"]', name))
- };
- this.clickMulti = function() {
- commonHelper.waitUntilElementVisible(this.radMulti);
- this.radMulti.click();
- };
- this.clickSingle = function() {
- this.radSingle.click();
- };
- this.addTag = function(value) {
- var tagsField = this.txtTags;
- var option = element(by.cssContainingText('.ui-select-highlight', value));
- tagsField.sendKeys(value);
- option.isPresent().then(function(result) {
- if(result) {
- option.click();
- } else {
- tagsField.sendKeys(protractor.Key.ENTER);
- }
- });
- commonHelper.waitUntilElementVisible(this.eleSelectedCollection(value));
- };
- // Variants section --------------------------------------------------------
- this.eleOptionSection = function(index) {
- return element.all(by.repeater('item in vm.product.options')).get(index);
- };
- this.variantEntry = function(name) {
- return element(by.cssContainingText('[ng-repeat="item in vm.product.variants"]', name))
- };
- this.txtOptionTitle = function(index) {
- return this.eleOptionSection(index).element(by.model('item.title'));
- };
- this.fillOptionTitle = function(index, value) {
- this.txtOptionTitle(index).clear();
- this.txtOptionTitle(index).sendKeys(value);
- };
- this.chkProductLook = function(index) {
- return this.eleOptionSection(index).$('[ng-model="item.changes_look"]+label');
- };
- this.chkDefaultVariant = function(name) {
- return this.variantEntry(name).$('[ng-model="item.default"]+label');
- };
- this.radSwitchOff = function(name) {
- return this.variantEntry(name).$('.bootstrap-switch-label');
- };
- this.clickProductLookCheckbox = function(index) {
- this.chkProductLook(index).click();
- };
- this.clickDefaultVariantCheckbox = function(name) {
- this.chkDefaultVariant(name).click();
- };
- this.clickSwitchOff = function(name) {
- this.radSwitchOff(name).click();
- };
- this.txtOptionValue = function(index) {
- return this.eleOptionSection(index).$('[ng-model="item.values"] input');
- };
- this.fillOptionValue = function(index, value) {
- this.txtOptionValue(index).sendKeys(value);
- this.txtOptionValue(index).sendKeys(protractor.Key.ENTER);
- };
- this.btnDeleteOption = function(index) {
- return this.eleOptionSection(index).$('.btn-delete');
- };
- this.clickDeleteOption = function(index) {
- this.btnDeleteOption(index).click();
- };
- this.clickAddOption = function() {
- this.btnAddOption.click();
- };
- this.txtVariantPrice = function(name) {
- return this.variantEntry(name).element(by.model('item.price'));
- };
- this.fillVariantPrice = function(name, value) {
- commonHelper.waitUntilElementPresent(this.variantEntry(name));
- this.txtVariantPrice(name).clear();
- this.txtVariantPrice(name).sendKeys(value);
- };
- this.btnVariantPriceAutofill = function(name) {
- return this.variantEntry(name).$('[ng-click="vm.variantControl.priceFill(\'price\', item.price)"]');
- };
- this.clickVariantPriceAutofill = function(name) {
- this.btnVariantPriceAutofill(name).click()
- };
- this.btnVariantComparePriceAutofill = function(name) {
- return this.variantEntry(name).$('[ng-click="vm.variantControl.priceFill(\'compare_price\', item.compare_price)"]');
- };
- this.clickVariantComparePriceAutofill = function(name) {
- this.btnVariantComparePriceAutofill(name).click()
- };
- this.txtVariantComparePrice = function(name) {
- return this.variantEntry(name).element(by.model('item.compare_price'));
- };
- this.fillVariantComparePrice = function(name, value) {
- commonHelper.waitUntilElementPresent(this.variantEntry(name));
- this.txtVariantComparePrice(name).clear();
- this.txtVariantComparePrice(name).sendKeys(value);
- };
- this.txtVariantSku = function(name) {
- return this.variantEntry(name).element(by.model('item.sku'));
- };
- this.fillVariantSku = function(name, value) {
- this.txtVariantSku(name).clear();
- this.txtVariantSku(name).sendKeys(value);
- };
- this.eleSelectedOptionValue = function(index, name) {
- return this.eleOptionSection(index).element(by.cssContainingText('[ng-repeat*="$item in $select.selected"]', name))
- };
- // Add / Edit thumbnails subsection ----------------------------------------
- this.radThumbnailSelector = function(index) {
- return this.eleOptionSection(index).$('[ng-class="{\'active\': item._isThumbOption}"] span');
- };
- this.clickThumbnailSelectorRadio = function(index) {
- this.radThumbnailSelector(index).click();
- };
- this.radTextDropdown = function(index) {
- return this.eleOptionSection(index).$('[ng-class="{\'active\': !item._isThumbOption}"] span');
- };
- this.clickTextDropdownRadio = function(index) {
- this.radTextDropdown(index).click();
- };
- this.btnAddThumbnails = function(index) {
- return this.eleOptionSection(index).$('[ng-click="vm.optionsControl.editThumbnails( item )"]');
- };
- this.clickAddThumbnails = function(index) {
- this.btnAddThumbnails(index).click();
- commonHelper.waitUntilElementVisible(this.btnSubmitThumbnail);
- };
- this.clickSubmitThumbnail = function() {
- this.btnSubmitThumbnail.click();
- };
- this.thumbnailCard = function(name) {
- var items = element.all(by.repeater('item in vm.thumbnails')).filter(function(item) {
- return item.element(by.binding('item.value')).getText().then(function(_name) {
- return _name === name;
- });
- });
- return items.first();
- };
- this.txtColorCode = function(name) {
- return this.thumbnailCard(name).element(by.model('ngModel'));
- };
- this.fillColorCode = function(name, value) {
- this.txtColorCode(name).clear();
- this.txtColorCode(name).sendKeys(value);
- };
- this.radSwatchImage = function(name) {
- return this.thumbnailCard(name).$('[ng-click="item._isColor = false"]');
- };
- this.radColorCode = function(name) {
- return this.thumbnailCard(name).$('[ng-click="item._isColor = true"]');
- };
- this.clickSwatchImage = function(name) {
- this.radSwatchImage(name).click();
- };
- this.clickColorCode = function(name) {
- this.radColorCode(name).click();
- };
- this.eleSwatchImage = function(name) {
- return this.thumbnailCard(name).$('.image-container_image');
- };
- // Images section ----------------------------------------------------------
- this.attachmentInputField = function(index) {
- return $$('[type="file"]').get(index);
- };
- this.uploadImage = function(index, name) {
- var path = require('path');
- var fileToUpload = '../../../data/admin/testfiles/' + name,
- absolutePath = path.resolve(__dirname, fileToUpload);
- this.attachmentInputField(index - 1).sendKeys(absolutePath);
- };
- this.imageSectionName = function(name) {
- var items = element.all(by.repeater('item in vm.product._imagesVariants')).filter(function(item) {
- return item.element(by.binding('vm.variantControl.getName(item)')).getText().then(function(_name) {
- return _name === name;
- });
- });
- return items.first();
- };
- this.eleImages = function(name) {
- return this.imageSectionName(name).$$(image);
- };
- this.dragAndDropImage = function(from, to) {
- browser.actions().mouseDown($$(image + ' .dragger').get(from - 1)).perform();
- commonHelper.moveMouse();
- browser.actions().mouseUp($$(image + ' ._number').get(to - 1)).perform();
- };
- this.deleteImage = function(index) {
- commonHelper.moveMouseOver($$(image).get(index - 1));
- $$(image + ' .image-delete').get(index - 1).click();
- };
- // SEO section -------------------------------------------------------------
- this.fillSeoTitle = function(value) {
- this.txtSeoTitle.clear();
- this.txtSeoTitle.sendKeys(value);
- };
- this.fillMetaDescription = function(value) {
- this.txtMetaDescription.clear();
- this.txtMetaDescription.sendKeys(value);
- };
- this.fillUrl = function(value) {
- this.txtUrl.clear();
- this.txtUrl.sendKeys(value);
- };
- // Other functions ---------------------------------------------------------
- this.clickPublish = function() {
- commonHelper.moveMouseOver(this.btnPublish);
- commonHelper.waitUntilElementVisible(this.btnPublish);
- this.btnPublish.click();
- };
- this.clickDraft = function() {
- commonHelper.moveMouseOver(this.btnDraft);
- this.btnDraft.click();
- };
- this.clickSave = function() {
- commonHelper.moveMouseOver(this.btnSave);
- commonHelper.waitUntilElementVisible(this.btnSave);
- this.btnSave.click();
- };
- this.clickSaveAsTemplate = function() {
- commonHelper.moveMouseOver(this.btnSaveAsTemplate);
- commonHelper.waitUntilElementVisible(this.btnSaveAsTemplate);
- this.btnSaveAsTemplate.click();
- };
- this.waitForPublishButton = function() {
- commonHelper.waitUntilElementPresent(this.btnPublish);
- browser.sleep(1000);
- this.waitForPageLoading();
- };
- this.waitForSaveButton = function() {
- commonHelper.waitUntilElementPresent(this.btnSave);
- browser.sleep(1000);
- this.waitForPageLoading();
- };
- this.waitForPageLoading = function() {
- commonHelper.waitUntilElementInvisible(this.imgLoader);
- };
- this.checkAnother = function() {
- this.chkAnother.click();
- };
- this.clickDeleteProduct = function() {
- this.btnDeleteProduct.click();
- };
- this.clickConfirm = function() {
- commonHelper.waitUntilElementVisible(this.btnConfirm);
- this.btnConfirm.click();
- };
- // Template section --------------------------------------------------------
- this.fillTemplateTitle = function(value) {
- this.txtTemplateTitle.clear();
- this.txtTemplateTitle.sendKeys(value);
- };
- this.clickSaveTemplate = function() {
- commonHelper.moveMouseOver(this.btnSaveTemplate);
- commonHelper.waitUntilElementVisible(this.btnSaveTemplate);
- this.btnSaveTemplate.click();
- };
- this.selectTemplate = function(name) {
- commonHelper.waitUntilElementVisible(this.selTemplate);
- this.selTemplate.click();
- var el = element(by.cssContainingText('[repeat="item.id as item in vm.templateSelect"]', name));
- commonHelper.waitUntilElementVisible(el);
- el.click();
- };
- };
- module.exports = AddProductPage;
- ________________________________________________________
- 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');
- 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 product = {
- firstTitle: commonHelper.uniqueProductName('price2'),
- type: productData.product.type,
- firstPrice: productData.product.price
- };
- 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 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.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, '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);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- 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 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.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, '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);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- 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 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.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, '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);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- 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 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.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, '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);
- expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- });
- __________________________________________________________________________
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement