Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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 - Manual Adding', function () {
- var username = signInData.adminAccount.username;
- var password = signInData.adminAccount.password;
- var firstCollectionTitle = commonHelper.uniqueProductName('common1');
- var firstCollectionDescription = collectionData.collection.description.first;
- var titleError = collectionData.collection.error.title;
- var urlError = collectionData.collection.error.url;
- var firstImage = 'car.jpg';
- var secondImage = 'bike.png';
- var addCollectionLink = signInData.link + '/collections/create';
- var product = {
- firstTitle: commonHelper.uniqueProductName('common2'),
- type: productData.product.type,
- price: productData.product.price
- };
- describe('add collection without products', function () {
- var unique_value = commonHelper.uniqueValue();
- var title = firstCollectionTitle + 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 () {
- browser.get(addCollectionLink);
- });
- it('should add new collection', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.fillDescription(firstCollectionDescription);
- addCollectionPage.uploadImage(firstImage);
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- commonHelper.waitUntilElementVisible(collectionListPage.collectionImage(title));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(title);
- expect(collectionsPage.txtTitle.isDisplayed()).toBeTruthy();
- });
- it('should open edit page for added collection', function () {
- commonHelper.switchToPreviousTab();
- collectionListPage.editCollection(title);
- });
- it('should show correct text value in fields', function () {
- addCollectionPage.waitForLblAuto();
- expect(addCollectionPage.titleValue()).toEqual(title);
- expect(addCollectionPage.descriptionValue()).toEqual(firstCollectionDescription);
- expect(addCollectionPage.seoValue()).toEqual(title);
- expect(addCollectionPage.urlValue()).toEqual(title.toLowerCase());
- expect(addCollectionPage.eleUploadList.isDisplayed()).toBeTruthy();
- });
- });
- describe('title and url fields are required', function () {
- var unique_value = commonHelper.uniqueValue();
- var title = firstCollectionTitle + 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 () {
- browser.get(addCollectionLink);
- });
- it('should fill collection title field', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should remove text from collection title field', function () {
- addCollectionPage.txtTitle.clear();
- });
- it('should click publish button', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(addCollectionPage.txtErrorMessage.txtTitle)
- });
- it('should show error message for title field', function () {
- expect(addCollectionPage.titleError()).toEqual(titleError);
- });
- it('should clear collection url field', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.txtUrl.clear();
- });
- it('should click publish button', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(addCollectionPage.txtErrorMessage.txtUrl)
- });
- it('should show error message for url field', function () {
- expect(addCollectionPage.urlError()).toEqual(urlError);
- });
- it('should fill collection url field', function () {
- addCollectionPage.fillUrl(title);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(title);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(browser.getCurrentUrl()).toContain(title);
- commonHelper.switchToPreviousTab();
- });
- });
- describe('should not be able to remove title and url from collection and save it', function () {
- var unique_value = commonHelper.uniqueValue();
- var title = firstCollectionTitle + 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 () {
- browser.get(addCollectionLink);
- });
- it('should add new collection', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.fillDescription(firstCollectionDescription);
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- });
- it('should open edit page for added collection', function () {
- collectionListPage.editCollection(title);
- });
- it('should remove text from collection title field', function () {
- addCollectionPage.waitForLblAuto();
- commonHelper.moveMouseOver(addCollectionPage.txtTitle);
- commonHelper.waitUntilElementVisible(addCollectionPage.txtTitle);
- addCollectionPage.txtTitle.clear();
- });
- it('should click publish button', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(addCollectionPage.txtErrorMessage.txtTitle)
- });
- it('should show error message for title field', function () {
- expect(addCollectionPage.titleError()).toEqual(titleError);
- });
- it('should clear collection url field', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.txtUrl.clear();
- });
- it('should click publish button', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(addCollectionPage.txtErrorMessage.txtUrl)
- });
- it('should show error message for url field', function () {
- expect(addCollectionPage.urlError()).toEqual(urlError);
- });
- it('should fill collection url field', function () {
- addCollectionPage.fillUrl(title);
- });
- it('should add new collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- expect(collectionListPage.collectionName(title).isDisplayed()).toBeTruthy();
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(title);
- commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
- expect(browser.getCurrentUrl()).toContain(title);
- commonHelper.switchToPreviousTab();
- });
- });
- describe('set only one image', function () {
- var unique_value = commonHelper.uniqueValue();
- var title = firstCollectionTitle + unique_value;
- var firstImageSource;
- var secondImageSource;
- var firstThumbnailSource;
- var secondThumbnailSource;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should add new collection', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.fillDescription(firstCollectionDescription);
- addCollectionPage.uploadImage(firstImage);
- addCollectionPage.waitForUploading();
- addCollectionPage.eleCollectionImage.getAttribute('style').then(function (value) {
- firstImageSource = value;
- });
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- commonHelper.waitUntilElementVisible(collectionListPage.collectionImage(title));
- expect(collectionListPage.collectionName(title).isDisplayed()).toBeTruthy();
- });
- it('should save thumbnail source', function () {
- collectionListPage.collectionImage(title).getAttribute('style').then(function (value) {
- firstThumbnailSource = value;
- });
- });
- it('should open edit page for added collection', function () {
- collectionListPage.editCollection(title);
- });
- it('should add collection image', function () {
- addCollectionPage.waitForLblAuto();
- addCollectionPage.uploadImage(secondImage);
- addCollectionPage.waitForUploading();
- });
- it('should save source link', function () {
- addCollectionPage.eleCollectionImage.getAttribute('src').then(function (value) {
- secondImageSource = value;
- });
- });
- it('should save collection', function () {
- addCollectionPage.clickPublish();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- commonHelper.waitUntilElementVisible(collectionListPage.collectionImage(title));
- });
- it('should save thumbnail source', function () {
- collectionListPage.collectionImage(title).getAttribute('src').then(function (value) {
- secondThumbnailSource = value;
- });
- });
- it('should add second image for collection', function () {
- expect(firstImageSource).not.toEqual(secondImageSource);
- expect(firstThumbnailSource).not.toEqual(secondThumbnailSource);
- });
- });
- describe('add product manually', function () {
- var unique_value = commonHelper.uniqueValue();
- var collectionTitle = firstCollectionTitle + unique_value;
- var productTitle = product.firstTitle + unique_value;
- beforeAll(function () {
- commonHelper.acceptAlert();
- browser.get(signInData.link);
- });
- afterAll(function () {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', function () {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
- });
- it('should redirect on add product page', function () {
- browser.get(productData.addLink);
- addProductPage.waitForPublishButton();
- });
- it('should add new product', function () {
- addProductPage.selectType(product.type);
- addProductPage.selectFirstCollection();
- addProductPage.fillTitle(productTitle);
- addProductPage.fillPrice(product.price);
- addProductPage.clickPublish();
- commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
- });
- it('should open new collection page', function () {
- browser.get(addCollectionLink);
- });
- it('should fill title and description fields', function () {
- addCollectionPage.fillTitle(collectionTitle);
- addCollectionPage.fillDescription(firstCollectionDescription);
- });
- it('should add manual product', function () {
- addCollectionPage.clickAddProducts();
- addCollectionPage.clickProduct(productTitle);
- addCollectionPage.clickCloseProducts();
- });
- 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('collection save as draft', function () {
- var unique_value = commonHelper.uniqueValue();
- var title = firstCollectionTitle + 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 () {
- browser.get(addCollectionLink);
- });
- it('should add new collection', function () {
- addCollectionPage.fillTitle(title);
- addCollectionPage.fillDescription(firstCollectionDescription);
- addCollectionPage.uploadImage(firstImage);
- addCollectionPage.clickDraft();
- commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(title));
- commonHelper.waitUntilElementVisible(collectionListPage.collectionImage(title));
- });
- it('should show collection page after click on collection link', function () {
- collectionListPage.clickCollection(title);
- expect(collectionsPage.txtTitle.isPresent()).toBeFalsy();
- });
- it('should show publish button', function () {
- commonHelper.switchToPreviousTab();
- expect(collectionListPage.btnPublishAction(title, 'Publish').isDisplayed()).toBeTruthy();
- });
- it('should open edit page for added collection', function () {
- collectionListPage.editCollection(title);
- });
- it('should show correct text value in fields', function () {
- addCollectionPage.waitForLblAuto();
- expect(addCollectionPage.titleValue()).toEqual(title);
- expect(addCollectionPage.descriptionValue()).toEqual(firstCollectionDescription);
- expect(addCollectionPage.seoValue()).toEqual(title);
- expect(addCollectionPage.urlValue()).toEqual(title.toLowerCase());
- expect(addCollectionPage.eleUploadList.isDisplayed()).toBeTruthy();
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement