Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- single_variant/edit_product
- var pageObject = require('./../../../../../services/pages').container.PageObject;
- var signInPage = pageObject.getSignInPage();
- var dashboardPage = pageObject.getDashboardPage();
- var addProductPage = pageObject.getAddProductPage();
- var productListPage = pageObject.getProductListPage();
- var productPage = pageObject.getProductPage();
- var addCollectionPage = pageObject.getAddCollectionPage();
- var collectionListPage = pageObject.getCollectionListPage();
- var collectionsPage = pageObject.getCollectionsPage();
- var homePage = pageObject.getHomePage();
- var checkoutPage = pageObject.getCheckoutPage();
- var ordersPage = pageObject.getOrdersPage();
- var cartPage = pageObject.getCartPage();
- var shippingPage = pageObject.getShippingPage();
- var addShippingZonePage = pageObject.getAddShippingZonePage();
- var shippingData = require('./../../../../../data/admin/settings/shipping');
- var coreData = require('./../../../../../data/admin/core/index');
- var signInData = require('./../../../../../data/admin/sign_in/index');
- var productData = require('./../../../../../data/admin/product/index');
- var commonHelper = require('./../../../../../services/helpers/common.helper.js');
- describe('Edit Single Variant Product', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var unique_value = commonHelper.uniqueValue();
- var type = productData.product.type;
- var price = productData.product.price;
- var comparePrice = productData.product.comparePrice;
- var weight = productData.product.weight;
- var tag = productData.product.tag;
- var sku = productData.product.sku;
- var vendor = productData.product.vendor;
- var tabName = productData.product.tabName;
- var firstImage = 'car.jpg';
- var secondImage = 'bike.png';
- var thirdImage = 'laptop.jpg';
- var cardNumber = coreData.cardNumber;
- var cardName = coreData.cardName;
- var cardDate = coreData.cardDate;
- var cardCVV = coreData.cardCVV;
- var emailAddress = unique_value + '@mailinator.com';
- var country = coreData.country;
- var firstName = coreData.firstName;
- var lastName = coreData.lastName;
- var streetAddress = coreData.streetAddress;
- var suite = coreData.suite;
- var city = coreData.city;
- var zip = coreData.zip;
- var phone = coreData.phone;
- var name = shippingData.zone.name.first + unique_value;
- var description = shippingData.zone.description.first;
- var rate = '$10.00';
- describe('single variant product edit type', function () {
- var title = commonHelper.uniqueProductName('edits1') + unique_value;
- var secondType = type + 'edit';
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit type', function () {
- addProductPage.selectType(secondType);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show success notification after edit', function () {
- commonHelper.waitUntilElementVisible(dashboardPage.eleAlertMessage);
- expect(dashboardPage.alertMessage()).toEqual("Product \"" + title + "\" updated successfully");
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should show correct selected type', function () {
- expect(addProductPage.selectedType()).toEqual(secondType);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- });
- describe('single variant product edit collections', function () {
- var title = commonHelper.uniqueProductName('edits2') + unique_value;
- var firstCollectionTitle = 'edits1' + unique_value;
- var secondCollectionTitle = 'edits2' + 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 new collection page', function () {
- dashboardPage.openAddCollectionPage();
- });
- it('should add first collection', function () {
- addCollectionPage.fillTitle(firstCollectionTitle);
- addCollectionPage.fillDescription('simple description');
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectCollection(firstCollectionTitle);
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open new collection page', function () {
- dashboardPage.openAddCollectionPage();
- });
- it('should add second collection', function () {
- addCollectionPage.fillTitle(secondCollectionTitle);
- addCollectionPage.fillDescription('simple description');
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
- });
- it('should open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open edit page for added product', function () {
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit collection', function () {
- addProductPage.clickDeleteCollection(firstCollectionTitle);
- addProductPage.selectCollection(secondCollectionTitle);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should show correct selected collection', function () {
- expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- });
- it('should show add to cart button', function () {
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- });
- it('should show correct product price', function () {
- expect(productPage.productPrice()).toEqual(price.replace('$', ''));
- });
- it('should show correct product name', function () {
- expect(productPage.productTitle()).toEqual(title);
- commonHelper.switchToPreviousTab();
- });
- it('should open collection list page', function () {
- dashboardPage.openCollectionListPage();
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(secondCollectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('single variant product edit multiple collections', function () {
- var title = commonHelper.uniqueProductName('edits3') + unique_value;
- var firstCollectionTitle = 'editsingle3' + unique_value;
- var secondCollectionTitle = 'editsingle4' + 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 new collection page', function () {
- dashboardPage.openAddCollectionPage();
- });
- it('should add first collection', function () {
- addCollectionPage.fillTitle(firstCollectionTitle);
- addCollectionPage.fillDescription('simple description');
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectCollection(firstCollectionTitle);
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open new collection page', function () {
- dashboardPage.openAddCollectionPage();
- });
- it('should add second collection', function () {
- addCollectionPage.fillTitle(secondCollectionTitle);
- addCollectionPage.fillDescription('simple description');
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
- });
- it('should open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should open edit page for added product', function () {
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit collection', function () {
- addProductPage.selectCollection(secondCollectionTitle);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should show correct selected collections', function () {
- expect(addProductPage.eleSelectedCollection(firstCollectionTitle).isDisplayed()).toBeTruthy();
- expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- });
- it('should show add to cart button', function () {
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- });
- it('should show correct product price', function () {
- expect(productPage.productPrice()).toEqual(price.replace('$', ''));
- });
- it('should show correct product name', function () {
- expect(productPage.productTitle()).toEqual(title);
- commonHelper.switchToPreviousTab();
- });
- it('should open collection list page', function () {
- dashboardPage.openCollectionListPage();
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(secondCollectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(firstCollectionTitle);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('single variant product edit description', function () {
- var title = commonHelper.uniqueProductName('edits4') + unique_value;
- var firstDescription = 'first description';
- var secondDescription = 'second description';
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should fill new product form', function () {
- addProductPage.fillDescription(firstDescription);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- });
- it('should show correct description', function () {
- expect(productPage.productDescription()).toContain(tabName);
- expect(productPage.productDescription()).toContain(firstDescription);
- });
- it('should open edit page for added product', function () {
- commonHelper.switchToPreviousTab();
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit description', function () {
- addProductPage.fillDescription(secondDescription);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- });
- it('should show correct description', function () {
- expect(productPage.productDescription()).toContain(tabName);
- expect(productPage.productDescription()).toContain(secondDescription);
- commonHelper.switchToPreviousTab();
- });
- });
- describe('single variant product edit price and compare price', function () {
- var title = commonHelper.uniqueProductName('edits5') + unique_value;
- var secondPrice ='$20.00';
- var secondComparePrice = '$30.00';
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- addProductPage.fillComparePrice(comparePrice);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- });
- it('should show correct product price', function () {
- expect(productPage.productPrice()).toEqual(price.replace('$', ''));
- });
- it('should show correct product compare price', function () {
- expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
- });
- it('should open edit page for added product', function () {
- commonHelper.switchToPreviousTab();
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should add price and compare prise', function () {
- addProductPage.fillPrice(secondPrice);
- addProductPage.fillComparePrice(secondComparePrice);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(title);
- });
- it('should show correct product price', function () {
- expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
- });
- it('should show correct product compare price', function () {
- expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
- });
- });
- describe('single variant product edit - shipping weight, tags, sku', function () {
- var title = commonHelper.uniqueProductName('edits6') + unique_value;
- var firstTag = 'FirstTag' + unique_value;
- var secondTag = 'SecondTag' + unique_value;
- var secondShippingWeight = '5';
- var secondSku = 'KUV-OK-LR-23-ER-T43';
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- addProductPage.fillSku(sku);
- addProductPage.addTag(firstTag);
- addProductPage.fillShippingWeight(weight);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit weight, tag and sku', function () {
- addProductPage.fillShippingWeight(secondShippingWeight);
- addProductPage.fillSku(secondSku);
- addProductPage.clickDeleteCollection(firstTag);
- addProductPage.addTag(secondTag);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for edited product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should show correct tag', function () {
- expect(addProductPage.eleSelectedCollection(secondTag).isDisplayed()).toBeTruthy();
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- });
- describe('single variant product edit image order', function () {
- var title = commonHelper.uniqueProductName('edits7') + unique_value;
- var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- addProductPage.uploadImage(1, firstImage);
- addProductPage.uploadImage(1, secondImage);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save first thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- firstThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save first main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- firstProductImage = value;
- });
- });
- it('should edit product', function () {
- commonHelper.switchToPreviousTab();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should change order for images', function () {
- addProductPage.dragAndDropImage(1, 2);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save second thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- secondThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save second main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- secondProductImage = value;
- });
- commonHelper.switchToPreviousTab();
- });
- it('should see image changes', function () {
- expect(firstThumbnail).not.toEqual(secondThumbnail);
- expect(firstProductImage).not.toEqual(secondProductImage);
- });
- });
- describe('single variant product add some images', function () {
- var title = commonHelper.uniqueProductName('edits8') + unique_value;
- var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- addProductPage.uploadImage(1, firstImage);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save first thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- firstThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save first main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- firstProductImage = value;
- });
- });
- it('should edit product', function () {
- commonHelper.switchToPreviousTab();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should add image', function () {
- addProductPage.uploadImage(1, thirdImage);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save second thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- secondThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save second main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- secondProductImage = value;
- });
- });
- it('should show correct number of thumbs', function () {
- commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
- commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
- browser.sleep(1000);
- expect(productPage.allThumbs.count()).toEqual(2);
- });
- it('should not see image changes', function () {
- commonHelper.switchToPreviousTab();
- expect(firstThumbnail).toEqual(secondThumbnail);
- expect(firstProductImage).toEqual(secondProductImage);
- });
- });
- describe('single variant product delete and change all images', function () {
- var title = commonHelper.uniqueProductName('edits9') + unique_value;
- var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- addProductPage.uploadImage(1, firstImage);
- addProductPage.uploadImage(1, secondImage);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save first thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- firstThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save first main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- firstProductImage = value;
- });
- });
- it('should edit product', function () {
- commonHelper.switchToPreviousTab();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should delete images', function () {
- addProductPage.deleteImage(2);
- addProductPage.deleteImage(1);
- });
- it('should add new image', function () {
- addProductPage.uploadImage(1, thirdImage);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should save second thumbnail source', function () {
- commonHelper.waitUntilElementVisible(productListPage.productImage(title));
- productListPage.productImage(title).getAttribute('style').then(function (value) {
- secondThumbnail = value;
- });
- });
- it('should open product page', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should save second main image source', function () {
- productPage.eleProductImage.getAttribute('src').then(function (value) {
- secondProductImage = value;
- });
- commonHelper.switchToPreviousTab();
- });
- it('should see image changes', function () {
- expect(firstThumbnail).not.toEqual(secondThumbnail);
- expect(firstProductImage).not.toEqual(secondProductImage);
- });
- });
- describe('single variant product edit page SEO title', function () {
- var title = commonHelper.uniqueProductName('edits10') + unique_value;
- var seoTitle = 'seo';
- 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit seo title', function () {
- addProductPage.fillSeoTitle(seoTitle);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open product page and show correct seo title', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- expect(productPage.productTitle()).toEqual(title);
- expect(homePage.pixelCode('head', seoTitle).isPresent()).toBeTruthy();
- commonHelper.switchToPreviousTab();
- });
- });
- describe('single variant product edit page SEO url', function () {
- var title = commonHelper.uniqueProductName('edits11') + unique_value;
- var url = commonHelper.uniqueProductName('edits12') + 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 fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(title);
- addProductPage.fillPrice(price);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open edit page for added product', function () {
- productListPage.editProduct(title);
- addProductPage.waitForSaveButton();
- });
- it('should edit url', function () {
- addProductPage.fillUrl(url);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
- });
- it('should open product page with correct link', function () {
- productListPage.clickProduct(title);
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- expect(productPage.productTitle()).toEqual(title);
- expect(browser.getCurrentUrl()).toContain(url.toLowerCase());
- commonHelper.switchToPreviousTab();
- });
- });
- describe('checking for edit single variant product and checking effect on existing orders with it', function () {
- var productTitle = commonHelper.uniqueProductName('edits13') + unique_value;
- var secondProductTitle = commonHelper.uniqueProductName('edits14') + unique_value;
- var secondPrice = '$30.00';
- var secondComparePrice = '$35.00';
- var orderNumber;
- 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 shipping page', function () {
- dashboardPage.openShippingPage();
- });
- it('should delete all zones', function check(done) {
- commonHelper.waitUntilElementInvisible(shippingPage.imgLoader);
- shippingPage.allShippings.count().then(function(result) {
- if(result == 0) {
- done();
- } else {
- shippingPage.allShippings.get(0).getText().then(function (value) {
- shippingPage.openForEdit(value);
- addShippingZonePage.clickDeleteZone();
- });
- check(done);
- }
- })
- }, 30000);
- it('should open new zone page', function () {
- shippingPage.clickAddZone();
- addShippingZonePage.waitForSaveButton();
- });
- it('should add new zone', function () {
- addShippingZonePage.setZoneName(name);
- addShippingZonePage.setShippingRate(rate.replace('$', ''));
- addShippingZonePage.setServiceDescription(description);
- addShippingZonePage.setCountry(country);
- addShippingZonePage.clickSave();
- });
- it('should contain new shipping zone', function() {
- commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should fill new product form', function () {
- addProductPage.selectType(type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(price);
- addProductPage.fillMetaDescription(description);
- addProductPage.fillComparePrice(comparePrice);
- addProductPage.fillShippingWeight(weight);
- addProductPage.selectVendor(vendor);
- addProductPage.addTag(tag);
- addProductPage.uploadImage(1, firstImage);
- addProductPage.uploadImage(1, secondImage);
- });
- it('should publish product', function () {
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(productTitle);
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- });
- it('should click add to cart button', function () {
- productPage.clickAddToCart();
- commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
- });
- it('should click checkout button', function () {
- cartPage.clickCheckout();
- commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
- });
- it('should fill email address', function () {
- checkoutPage.fillEmailAddress(emailAddress);
- });
- it('should fill contact information form', function () {
- checkoutPage.selectCountry(country);
- checkoutPage.selectState(city);
- checkoutPage.fillCity(city);
- checkoutPage.fillZip(zip);
- commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
- checkoutPage.fillFirstName(firstName);
- checkoutPage.fillLastName(lastName);
- checkoutPage.fillStreetAddress(streetAddress);
- checkoutPage.fillSuite(suite);
- checkoutPage.fillPhone(phone);
- });
- it('should fill payment form', function () {
- checkoutPage.fillCardNumberField(cardNumber);
- checkoutPage.fillCardNameField(cardName);
- checkoutPage.fillCardDateField(cardDate);
- checkoutPage.fillCVVField(cardCVV);
- });
- it('should show correct prices', function () {
- commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
- expect(checkoutPage.shippingPrice()).toEqual('$10.00');
- expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
- expect(checkoutPage.taxes()).toEqual('$0.00');
- expect(checkoutPage.totalPrice()).toEqual('$35.00');
- });
- it('should click complete order', function () {
- checkoutPage.clickCompleteOrder();
- commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
- });
- it('should save order number', function () {
- checkoutPage.txtOrder.getText().then(function (value) {
- orderNumber = value.split(' ')[1];
- });
- });
- it('should redirect on admin dashboard page', function () {
- browser.get(signInData.link);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should open orders list', function () {
- dashboardPage.openOrdersPage();
- commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
- });
- it('should open needed order', function () {
- ordersPage.clickOrderEntry(orderNumber);
- commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
- });
- it('should show correct product name', function () {
- expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
- });
- it('should show product image', function () {
- expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
- });
- it('should show correct order price', function () {
- commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
- expect(ordersPage.subtotalPrice()).toEqual('$25.00');
- expect(ordersPage.shippingPrice()).toEqual('$10.00');
- expect(ordersPage.taxes()).toEqual('$0.00');
- expect(ordersPage.totalPrice()).toEqual('$35.00');
- });
- it('should open products list page', function () {
- dashboardPage.openProductListPage();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open edit product', function () {
- productListPage.editProduct(productTitle);
- addProductPage.waitForSaveButton();
- });
- it('should edit product prices and title', function () {
- addProductPage.fillTitle(secondProductTitle);
- addProductPage.fillPrice(secondPrice);
- addProductPage.fillComparePrice(secondComparePrice);
- });
- it('should delete old pictures', function () {
- addProductPage.deleteImage(1);
- addProductPage.deleteImage(1);
- });
- it('should add another pictures', function () {
- addProductPage.uploadImage(1, thirdImage);
- addProductPage.uploadImage(1, firstImage);
- });
- it('should save product', function () {
- addProductPage.clickSave();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
- });
- it('should redirect on admin dashboard page', function () {
- browser.get(signInData.link);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should open orders list', function () {
- dashboardPage.openOrdersPage();
- commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
- });
- it('should show last order in the first row', function () {
- expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
- });
- it('should open needed order', function () {
- ordersPage.clickOrderEntry(orderNumber);
- commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
- });
- it('should show correct product name', function () {
- expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
- });
- it('should show product image', function () {
- expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
- });
- it('should show correct order price', function () {
- commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
- expect(ordersPage.subtotalPrice()).toEqual(price);
- expect(ordersPage.shippingPrice()).toEqual('$10.00');
- expect(ordersPage.taxes()).toEqual('$0.00');
- expect(ordersPage.totalPrice()).toEqual('$35.00');
- });
- it('should open products list page', function () {
- dashboardPage.openProductListPage();
- });
- it('should show product page after click on product link', function () {
- productListPage.clickProduct(secondProductTitle);
- });
- it('should show main product image', function () {
- commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- commonHelper.waitUntilElementVisible(productPage.eleProductImage);
- });
- it('should show correct product price', function () {
- expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
- });
- it('should show correct product compare price', function () {
- expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
- });
- it('should show correct product name', function () {
- expect(productPage.productTitle()).toEqual(secondProductTitle);
- });
- it('should show correct number of thumbs', function () {
- commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
- commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
- browser.sleep(1000);
- expect(productPage.allThumbs.count()).toEqual(2);
- });
- it('should select 1 product', function () {
- productPage.clickUp(1);
- });
- it('should click add to cart button', function () {
- productPage.clickAddToCart();
- commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
- });
- it('should show correct total price in cart', function () {
- expect(cartPage.totalPrice()).toEqual('30.00');
- });
- it('should click checkout button', function () {
- cartPage.clickCheckout();
- commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
- });
- it('should show correct product', function () {
- expect(checkoutPage.productName(secondProductTitle).isDisplayed()).toBeTruthy();
- });
- it('should show product images', function () {
- expect(checkoutPage.productImage(secondProductTitle).isDisplayed()).toBeTruthy();
- });
- it('should show correct prices for products', function () {
- expect(checkoutPage.productPrice(secondProductTitle)).toEqual('$30.00 x 1');
- });
- it('should show correct subtotals for products', function () {
- expect(checkoutPage.productSubtotal(secondProductTitle)).toEqual('$30.00');
- });
- });
- // describe('checking for edit single variant product and checking effect on Ρart and checkout on fes', function () {
- //
- // var productTitle = commonHelper.uniqueProductName('edits15') + unique_value;
- //
- // var firstPrice = '$10.00';
- // var firstComparePrice = '$10.00';
- // var secondPrice = '$20.00';
- // var secondComparePrice = '$20.00';
- // var thirdPrice = '$30.00';
- // var thirdComparePrice = '$30.00';
- //
- // var orderNumber;
- //
- // 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 shipping page', function () {
- // dashboardPage.openShippingPage();
- // });
- //
- // it('should delete all zones', function check(done) {
- // commonHelper.waitUntilElementInvisible(shippingPage.imgLoader);
- // shippingPage.allShippings.count().then(function (result) {
- // if (result == 0) {
- // done();
- // } else {
- // shippingPage.allShippings.get(0).getText().then(function (value) {
- // shippingPage.openForEdit(value);
- // addShippingZonePage.clickDeleteZone();
- // });
- // check(done);
- // }
- // })
- // }, 30000);
- //
- // it('should open new zone page', function () {
- // shippingPage.clickAddZone();
- // addShippingZonePage.waitForSaveButton();
- // });
- //
- // it('should add new zone', function () {
- // addShippingZonePage.setZoneName(name);
- // addShippingZonePage.setShippingRate(rate.replace('$', ''));
- // addShippingZonePage.setServiceDescription(description);
- // addShippingZonePage.setCountry(country);
- // addShippingZonePage.clickSave();
- // });
- //
- // it('should contain new shipping zone', function () {
- // commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
- // });
- //
- // it('should redirect on add product page', function () {
- // browser.get(productData.addLink);
- // addProductPage.waitForPublishButton();
- // });
- // });
- //
- // it('should fill new product form', function () {
- // addProductPage.selectType(type);
- // addProductPage.selectFirstCollection();
- // addProductPage.fillTitle(productTitle);
- // addProductPage.fillPrice(firstPrice);
- // addProductPage.fillMetaDescription(description);
- // addProductPage.fillComparePrice(firstComparePrice);
- // addProductPage.fillShippingWeight(weight);
- // addProductPage.addTag(tag);
- // addProductPage.uploadImage(1, firstImage);
- // addProductPage.uploadImage(1, secondImage);
- // });
- //
- // it('should publish product', function () {
- // addProductPage.clickPublish();
- // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- // });
- //
- // it('should show product page after click on product link', function () {
- // productListPage.clickProduct(productTitle);
- // commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
- // });
- //
- // it('should click add to cart button', function () {
- // productPage.clickAddToCart();
- // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
- // });
- //
- // it('should go to previous tab', function () {
- // commonHelper.switchToPreviousWithoutClose();
- // });
- //
- // it('should edit product', function () {
- // productListPage.editProduct(productTitle);
- // addProductPage.waitForSaveButton();
- // });
- //
- // it('should fill second prices', function () {
- // addProductPage.fillPrice(secondPrice);
- // addProductPage.fillComparePrice(secondComparePrice);
- // });
- //
- // it('should save product', function () {
- // addProductPage.clickSave();
- // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- // });
- //
- // it('should go to next tab', function () {
- // commonHelper.switchToNextTab()
- // });
- //
- // it('should click checkout button', function () {
- // cartPage.clickCheckout();
- // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
- // });
- //
- // it('should show correct price for product', function () {
- // expect(checkoutPage.productPrice(productTitle)).toEqual('$20.00 x 1');
- // });
- //
- // it('should show correct subtotal for product', function () {
- // expect(checkoutPage.productSubtotal(productTitle)).toEqual('$20.00');
- // });
- //
- // it('should go to previous tab', function () {
- // commonHelper.switchToPreviousWithoutClose();
- // });
- //
- // it('should edit product', function () {
- // productListPage.editProduct(productTitle);
- // addProductPage.waitForSaveButton();
- // });
- //
- // it('should fill third prices', function () {
- // addProductPage.fillPrice(thirdPrice);
- // addProductPage.fillComparePrice(thirdComparePrice);
- // });
- //
- // it('should save product', function () {
- // addProductPage.clickSave();
- // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- // });
- //
- // it('should go to next tab', function () {
- // commonHelper.switchToNextTab();
- // });
- //
- // it('should fill email address', function () {
- // checkoutPage.fillEmailAddress(emailAddress);
- // });
- //
- // it('should fill contact information form', function () {
- // checkoutPage.selectCountry(country);
- // checkoutPage.selectState(city);
- // checkoutPage.fillCity(city);
- // checkoutPage.fillZip(zip);
- // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
- // checkoutPage.fillFirstName(firstName);
- // checkoutPage.fillLastName(lastName);
- // checkoutPage.fillStreetAddress(streetAddress);
- // checkoutPage.fillSuite(suite);
- // checkoutPage.fillPhone(phone);
- // });
- //
- // it('should fill payment form', function () {
- // checkoutPage.fillCardNumberField(cardNumber);
- // checkoutPage.fillCardNameField(cardName);
- // checkoutPage.fillCardDateField(cardDate);
- // checkoutPage.fillCVVField(cardCVV);
- // });
- //
- // it('should show correct prices', function () {
- // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
- // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
- // expect(checkoutPage.subtotalPrice()).toEqual('$30.00');
- // expect(checkoutPage.taxes()).toEqual('$0.00');
- // expect(checkoutPage.totalPrice()).toEqual('$30.00');
- // });
- //
- // it('should click complete order', function () {
- // checkoutPage.clickCompleteOrder();
- // });
- //
- // it('should show error message', function () {
- // browser.sleep(1000);
- // expect(checkoutPage.chkErrorMessage()).toEqual('Products in your cart have been updated by the store owner, please refresh the page to review the changes');
- // });
- //
- // it('should click complete order', function () {
- // checkoutPage.clickCompleteOrder();
- // commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
- // });
- //
- // it('should save order number', function () {
- // checkoutPage.txtOrder.getText().then(function (value) {
- // orderNumber = value.split(' ')[1];
- // });
- // });
- //
- // it('should redirect on admin dashboard page', function () {
- // browser.get(signInData.link);
- // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- // });
- //
- // it('should open orders list', function () {
- // dashboardPage.openOrdersPage();
- // commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
- // });
- //
- // it('should show last order in the first row', function () {
- // expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
- // });
- //
- // it('should open needed order', function () {
- // ordersPage.clickOrderEntry(orderNumber);
- // commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
- // });
- //
- // it('should show new correct products', function () {
- // expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
- // });
- //
- // it('should show product image', function () {
- // expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
- // });
- //
- // it('should show correct order price', function () {
- // commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
- // expect(ordersPage.subtotalPrice()).toEqual('$30.00');
- // expect(ordersPage.shippingPrice()).toEqual('$10.00');
- // expect(ordersPage.taxes()).toEqual('$0.00');
- // expect(ordersPage.totalPrice()).toEqual('$40.00');
- // });
- // });
- });
Add Comment
Please, Sign In to add comment