Guest User

multi_variant/edit_product.spec.js

a guest
Feb 9th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 157.49 KB | None | 0 0
  1. multi_variant/edit_product.spec.js
  2.  
  3. var pageObject = require('./../../../../../services/pages').container.PageObject;
  4. var signInPage = pageObject.getSignInPage();
  5. var dashboardPage = pageObject.getDashboardPage();
  6. var addProductPage = pageObject.getAddProductPage();
  7. var productListPage = pageObject.getProductListPage();
  8. var productPage = pageObject.getProductPage();
  9. var addCollectionPage = pageObject.getAddCollectionPage();
  10. var collectionListPage = pageObject.getCollectionListPage();
  11. var collectionsPage = pageObject.getCollectionsPage();
  12. var homePage = pageObject.getHomePage();
  13. var checkoutPage = pageObject.getCheckoutPage();
  14. var ordersPage = pageObject.getOrdersPage();
  15. var cartPage = pageObject.getCartPage();
  16. var shippingPage = pageObject.getShippingPage();
  17. var addShippingZonePage = pageObject.getAddShippingZonePage();
  18. var signUpPage = pageObject.getSignUpPage();
  19. var paymentProcessingPage = pageObject.getPaymentProcessingPage();
  20. var shippingData = require('./../../../../../data/admin/settings/shipping');
  21. var signInData = require('./../../../../../data/admin/sign_in/index');
  22. var productData = require('./../../../../../data/admin/product/index');
  23. var coreData = require('./../../../../../data/admin/core/index');
  24. var commonHelper = require('./../../../../../services/helpers/common.helper.js');
  25. var collectionData = require('./../../../../../data/admin/collection/index');
  26.  
  27. describe('Edit Multi Variant Product', function () {
  28.  
  29. var username = signInData.adminAccount.username;
  30. var password = signInData.adminAccount.password;
  31. var unique_value = commonHelper.uniqueValue();
  32.  
  33. var type = productData.product.type;
  34. var price = productData.product.price;
  35. var comparePrice = productData.product.comparePrice;
  36. var weight = productData.product.weight;
  37. var tag = productData.product.tag;
  38. var sku = productData.product.sku;
  39. var tabName = productData.product.tabName;
  40. var mainCollectionTitle = 'editm25' + unique_value;
  41. var collectionDescription = collectionData.collection.description.first;
  42.  
  43. var firstImage = 'car.jpg';
  44. var secondImage = 'bike.png';
  45. var thirdImage = 'laptop.jpg';
  46.  
  47. var firstColor = productData.product.color.first;
  48. var secondColor = productData.product.color.second;
  49. var thirdColor = productData.product.color.third;
  50.  
  51. var firstColorCode = productData.product.colorCode.first;
  52. var secondColorCode = productData.product.colorCode.second;
  53.  
  54. var firstSize = productData.product.size.first;
  55. var secondSize = productData.product.size.second;
  56. var thirdSize = productData.product.size.third;
  57.  
  58. var firstStyle = productData.product.style.first;
  59. var secondStyle = productData.product.style.second;
  60.  
  61. var firstMaterial = productData.product.material.first;
  62. var secondMaterial = productData.product.material.second;
  63.  
  64. var firstVariant = firstColor + ' / ' + firstSize;
  65. var secondVariant = firstColor + ' / ' + secondSize;
  66. var thirdVariant = firstColor + ' / ' + thirdSize;
  67. var fourthVariant = secondColor + ' / ' + firstSize;
  68. var fifthVariant = secondColor + ' / ' + secondSize;
  69. var sixthVariant = secondColor + ' / ' + thirdSize;
  70. var seventhVariant = thirdColor + ' / ' + firstSize;
  71. var eighthVariant = thirdColor + ' / ' + secondSize;
  72. var ninthVariant = thirdColor + ' / ' + thirdSize;
  73.  
  74. var cardNumber = coreData.cardNumber;
  75. var cardName = coreData.cardName;
  76. var cardDate = coreData.cardDate;
  77. var cardCVV = coreData.cardCVV;
  78.  
  79. var storeName = coreData.storeName + unique_value;
  80. var mainStoreLink= signInData.link;
  81. var storeLink = 'https://' + storeName + '.' + mainStoreLink.split('.')[1] + '.com';
  82.  
  83. var emailAddress = unique_value + '@mailinator.com';
  84. var country = coreData.country;
  85. var firstName = coreData.firstName;
  86. var lastName = coreData.lastName;
  87. var streetAddress = coreData.streetAddress;
  88. var suite = coreData.suite;
  89. var city = coreData.city;
  90. var zip = coreData.zip;
  91. var phone = coreData.phone;
  92.  
  93. var addProductLink = storeLink + '/admin/products/create';
  94.  
  95. var name = shippingData.zone.name.first + unique_value;
  96. var description = shippingData.zone.description.first;
  97. var rate = '$10.00';
  98.  
  99.  
  100. describe('create new store', function () {
  101.  
  102. beforeAll(function () {
  103. commonHelper.acceptAlert();
  104. browser.get(mainStoreLink);
  105. });
  106.  
  107. afterAll(function () {
  108. commonHelper.clearAllData();
  109. });
  110.  
  111. it('should redirect on dashboard page after login', function () {
  112. signInPage.login(username, password);
  113. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  114. });
  115.  
  116. it('should click build new store', function () {
  117. dashboardPage.clickBuildNewStore();
  118. commonHelper.waitUntilElementVisible(signUpPage.btnStartBuildingStoreNow);
  119. });
  120.  
  121. it('should submit new store form', function () {
  122. signUpPage.fillStoreName(storeName);
  123. signUpPage.fillStoreSubdomain(storeName);
  124. signUpPage.clickStartBuildingStoreNow();
  125. commonHelper.waitUntilElementVisible(signUpPage.btnSignIn);
  126. });
  127.  
  128. it('should click sign-in button', function () {
  129. signUpPage.clickSignIn();
  130. commonHelper.waitUntilElementVisible(signInPage.btnLogin);
  131. });
  132.  
  133. it('should redirect on dashboard page after login', function () {
  134. signInPage.login(username, password);
  135. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  136. });
  137.  
  138. it('should open payment processing page', function () {
  139. dashboardPage.openPaymentProcessingPage();
  140. });
  141.  
  142. it('should activate stripe if not activated', function check(done) {
  143. paymentProcessingPage.btnSelectCurrency.isPresent().then(function(result) {
  144. if(result) {
  145. paymentProcessingPage.clickCurrency('USD');
  146. paymentProcessingPage.clickSelectCurrency();
  147. paymentProcessingPage.clickStripeSetup();
  148. paymentProcessingPage.clickConnectWithStripe();
  149. paymentProcessingPage.clickSkipAccountForm();
  150. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  151. check(done);
  152. } else {
  153. done();
  154. }
  155. })
  156. }, 50000);
  157.  
  158. it('should open shipping page', function () {
  159. dashboardPage.openShippingPage();
  160. });
  161.  
  162. it('should open new zone page', function () {
  163. shippingPage.clickAddZone();
  164. addShippingZonePage.waitForSaveButton();
  165. });
  166.  
  167. it('should add new zone', function () {
  168. addShippingZonePage.setZoneName(name);
  169. addShippingZonePage.setShippingRate(rate.replace('$', ''));
  170. addShippingZonePage.setServiceDescription(description);
  171. addShippingZonePage.setCountry(country);
  172. addShippingZonePage.clickSave();
  173. });
  174.  
  175. it('should contain new shipping zone', function() {
  176. commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
  177. });
  178.  
  179.  
  180. it('should contain new shipping zone', function() {
  181. commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
  182. });
  183.  
  184. it('should open dashboard page', function() {
  185. dashboardPage.openDashboardPage();
  186. });
  187.  
  188. it('should show correct conversion values on dashboard', function () {
  189. commonHelper.waitUntilElementVisible(dashboardPage.txtCartConversion);
  190. expect(dashboardPage.txtCartConversion.getText()).toEqual('0.00%');
  191. expect(dashboardPage.txtCheckoutConversion.getText()).toEqual('0.00%');
  192. expect(dashboardPage.txtPurchasedConversion.getText()).toEqual('0.00%');
  193. });
  194.  
  195. it('should open new collection page', function () {
  196. dashboardPage.openAddCollectionPage();
  197. });
  198.  
  199. it('should add new collection', function () {
  200. addCollectionPage.fillTitle(mainCollectionTitle);
  201. addCollectionPage.fillDescription(collectionDescription);
  202. addCollectionPage.clickPublish();
  203. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(mainCollectionTitle));
  204. });
  205. });
  206.  
  207. describe('multi variant product edit type', function () {
  208.  
  209. var title = commonHelper.uniqueProductName('editm1') + unique_value;
  210. var secondType = type + 'edit';
  211.  
  212. beforeAll(function () {
  213. commonHelper.acceptAlert();
  214. });
  215.  
  216. afterAll(function () {
  217. commonHelper.clearAllData();
  218. });
  219.  
  220. it('should redirect on dashboard page after login', function () {
  221. browser.get(storeLink + '/admin');
  222. signInPage.login(username, password);
  223. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  224. });
  225.  
  226. it('should redirect on add product page', function () {
  227. browser.get(addProductLink);
  228. addProductPage.waitForPublishButton();
  229. });
  230.  
  231. it('should select multi variant option', function () {
  232. addProductPage.clickMulti();
  233. });
  234.  
  235. it('should fill new product form', function () {
  236. addProductPage.fillType(type);
  237. addProductPage.selectFirstCollection();
  238. addProductPage.fillTitle(title);
  239. });
  240.  
  241. it('should add first option', function () {
  242. addProductPage.fillOptionTitle(0, 'Color');
  243. addProductPage.fillOptionValue(0, firstColor);
  244. });
  245.  
  246. it('should add second option', function () {
  247. addProductPage.fillOptionTitle(1, 'Size');
  248. addProductPage.fillOptionValue(1, firstSize);
  249. });
  250.  
  251. it('should fill variant price', function () {
  252. addProductPage.fillVariantPrice(firstVariant, price);
  253. });
  254.  
  255. it('should publish product', function () {
  256. addProductPage.clickPublish();
  257. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  258. });
  259.  
  260. it('should open edit page for added product', function () {
  261. productListPage.editProduct(title);
  262. addProductPage.waitForSaveButton();
  263. });
  264.  
  265. it('should edit type', function () {
  266. addProductPage.selectType(secondType);
  267. });
  268.  
  269. it('should save product', function () {
  270. addProductPage.clickSave();
  271. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  272. });
  273.  
  274. it('should open edit page for added product', function () {
  275. productListPage.editProduct(title);
  276. addProductPage.waitForSaveButton();
  277. });
  278.  
  279. it('should show correct selected type', function () {
  280. expect(addProductPage.selectedType()).toEqual(secondType);
  281. });
  282.  
  283. it('should save product', function () {
  284. addProductPage.clickSave();
  285. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  286. });
  287. });
  288.  
  289. describe('multi variant product edit collections', function () {
  290.  
  291. var title = commonHelper.uniqueProductName('editm2') + unique_value;
  292. var firstCollectionTitle = 'editm1' + unique_value;
  293. var secondCollectionTitle = 'editm2' + unique_value;
  294.  
  295. beforeAll(function () {
  296. commonHelper.acceptAlert();
  297. });
  298.  
  299. afterAll(function () {
  300. commonHelper.clearAllData();
  301. });
  302.  
  303. it('should redirect on dashboard page after login', function () {
  304. browser.get(storeLink + '/admin');
  305. signInPage.login(username, password);
  306. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  307. });
  308.  
  309. it('should open new collection page', function () {
  310. dashboardPage.openAddCollectionPage();
  311. });
  312.  
  313. it('should add first collection', function () {
  314. addCollectionPage.fillTitle(firstCollectionTitle);
  315. addCollectionPage.fillDescription('simple description');
  316. addCollectionPage.clickPublish();
  317. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
  318. });
  319.  
  320. it('should redirect on add product page', function () {
  321. browser.get(addProductLink);
  322. addProductPage.waitForPublishButton();
  323. });
  324.  
  325. it('should select multi variant option', function () {
  326. addProductPage.clickMulti();
  327. });
  328.  
  329. it('should fill new product form', function () {
  330. addProductPage.selectType(type);
  331. addProductPage.selectCollection(firstCollectionTitle);
  332. addProductPage.fillTitle(title);
  333. });
  334.  
  335. it('should add first option', function () {
  336. addProductPage.fillOptionTitle(0, 'Color');
  337. addProductPage.fillOptionValue(0, firstColor);
  338. });
  339.  
  340. it('should add second option', function () {
  341. addProductPage.fillOptionTitle(1, 'Size');
  342. addProductPage.fillOptionValue(1, firstSize);
  343. });
  344.  
  345. it('should fill variant price', function () {
  346. addProductPage.fillVariantPrice(firstVariant, price);
  347. });
  348.  
  349. it('should publish product', function () {
  350. addProductPage.clickPublish();
  351. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  352. });
  353.  
  354. it('should open new collection page', function () {
  355. dashboardPage.openAddCollectionPage();
  356. });
  357.  
  358. it('should add second collection', function () {
  359. addCollectionPage.fillTitle(secondCollectionTitle);
  360. addCollectionPage.fillDescription('simple description');
  361. addCollectionPage.clickPublish();
  362. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
  363. });
  364.  
  365. it('should open products list page', function () {
  366. dashboardPage.openProductListPage();
  367. });
  368.  
  369. it('should open edit page for added product', function () {
  370. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  371. productListPage.editProduct(title);
  372. addProductPage.waitForSaveButton();
  373. });
  374.  
  375. it('should edit collection', function () {
  376. addProductPage.clickDeleteCollection(firstCollectionTitle);
  377. addProductPage.selectCollection(secondCollectionTitle);
  378. });
  379.  
  380. it('should save product', function () {
  381. addProductPage.clickSave();
  382. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  383. });
  384.  
  385. it('should open edit page for added product', function () {
  386. productListPage.editProduct(title);
  387. addProductPage.waitForSaveButton();
  388. });
  389.  
  390. it('should show correct selected collection', function () {
  391. expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
  392. });
  393.  
  394. it('should save product', function () {
  395. addProductPage.clickSave();
  396. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  397. });
  398.  
  399. it('should show product page after click on product link', function () {
  400. productListPage.clickProduct(title);
  401. });
  402.  
  403. it('should show add to cart button', function () {
  404. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  405. });
  406.  
  407. it('should show correct product price', function () {
  408. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  409. });
  410.  
  411. it('should show correct product name', function () {
  412. expect(productPage.productTitle()).toEqual(title);
  413. commonHelper.switchToPreviousTab();
  414. });
  415.  
  416. it('should open collection list page', function () {
  417. dashboardPage.openCollectionListPage();
  418. });
  419.  
  420. it('should show collection page after click on collection link', function () {
  421. collectionListPage.clickCollection(secondCollectionTitle);
  422. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  423.  
  424. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  425.  
  426. commonHelper.switchToPreviousTab();
  427. });
  428. });
  429.  
  430. describe('multi variant product edit multiple collections', function () {
  431.  
  432. var title = commonHelper.uniqueProductName('editm3') + unique_value;
  433. var firstCollectionTitle = 'editm3' + unique_value;
  434. var secondCollectionTitle = 'editm4' + unique_value;
  435.  
  436. beforeAll(function () {
  437. commonHelper.acceptAlert();
  438. });
  439.  
  440. afterAll(function () {
  441. commonHelper.clearAllData();
  442. });
  443.  
  444. it('should redirect on dashboard page after login', function () {
  445. browser.get(storeLink + '/admin');
  446. signInPage.login(username, password);
  447. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  448. });
  449.  
  450. it('should open new collection page', function () {
  451. dashboardPage.openAddCollectionPage();
  452. });
  453.  
  454. it('should add first collection', function () {
  455. addCollectionPage.fillTitle(firstCollectionTitle);
  456. addCollectionPage.fillDescription('simple description');
  457. addCollectionPage.clickPublish();
  458. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
  459. });
  460.  
  461. it('should redirect on add product page', function () {
  462. browser.get(addProductLink);
  463. addProductPage.waitForPublishButton();
  464. });
  465.  
  466. it('should select multi variant option', function () {
  467. addProductPage.clickMulti();
  468. });
  469.  
  470. it('should fill new product form', function () {
  471. addProductPage.selectType(type);
  472. addProductPage.selectCollection(firstCollectionTitle);
  473. addProductPage.fillTitle(title);
  474. });
  475.  
  476. it('should add first option', function () {
  477. addProductPage.fillOptionTitle(0, 'Color');
  478. addProductPage.fillOptionValue(0, firstColor);
  479. });
  480.  
  481. it('should add second option', function () {
  482. addProductPage.fillOptionTitle(1, 'Size');
  483. addProductPage.fillOptionValue(1, firstSize);
  484. });
  485.  
  486. it('should fill variant price', function () {
  487. addProductPage.fillVariantPrice(firstVariant, price);
  488. });
  489.  
  490. it('should publish product', function () {
  491. addProductPage.clickPublish();
  492. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  493. });
  494.  
  495. it('should open new collection page', function () {
  496. dashboardPage.openAddCollectionPage();
  497. });
  498.  
  499. it('should add second collection', function () {
  500. addCollectionPage.fillTitle(secondCollectionTitle);
  501. addCollectionPage.fillDescription('simple description');
  502. addCollectionPage.clickPublish();
  503. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
  504. });
  505.  
  506. it('should open products list page', function () {
  507. dashboardPage.openProductListPage();
  508. });
  509.  
  510. it('should open edit page for added product', function () {
  511. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  512. productListPage.editProduct(title);
  513. addProductPage.waitForSaveButton();
  514. });
  515.  
  516. it('should edit collection', function () {
  517. addProductPage.selectCollection(secondCollectionTitle);
  518. });
  519.  
  520. it('should save product', function () {
  521. addProductPage.clickSave();
  522. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  523. });
  524.  
  525. it('should open edit page for added product', function () {
  526. productListPage.editProduct(title);
  527. addProductPage.waitForSaveButton();
  528. });
  529.  
  530. it('should show correct selected collection', function () {
  531. expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
  532. });
  533.  
  534. it('should save product', function () {
  535. addProductPage.clickSave();
  536. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  537. });
  538.  
  539. it('should open edit page for added product', function () {
  540. productListPage.editProduct(title);
  541. addProductPage.waitForSaveButton();
  542. });
  543.  
  544. it('should show correct selected collection', function () {
  545. expect(addProductPage.eleSelectedCollection(firstCollectionTitle).isDisplayed()).toBeTruthy();
  546. expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
  547. });
  548.  
  549. it('should save product', function () {
  550. addProductPage.clickSave();
  551. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  552. });
  553.  
  554. it('should show product page after click on product link', function () {
  555. productListPage.clickProduct(title);
  556. });
  557.  
  558. it('should show add to cart button', function () {
  559. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  560. });
  561.  
  562. it('should show correct product price', function () {
  563. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  564. });
  565.  
  566. it('should show correct product name', function () {
  567. expect(productPage.productTitle()).toEqual(title);
  568. commonHelper.switchToPreviousTab();
  569. });
  570.  
  571. it('should open collection list page', function () {
  572. dashboardPage.openCollectionListPage();
  573. });
  574.  
  575. it('should show collection page after click on second collection link', function () {
  576. collectionListPage.clickCollection(secondCollectionTitle);
  577. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  578.  
  579. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  580.  
  581. commonHelper.switchToPreviousTab();
  582. });
  583.  
  584. it('should show collection page after click on first collection link', function () {
  585. collectionListPage.clickCollection(firstCollectionTitle);
  586. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  587.  
  588. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  589.  
  590. commonHelper.switchToPreviousTab();
  591. });
  592. });
  593.  
  594. describe('multi variant product edit - shipping weight, tags, sku', function () {
  595.  
  596. var title = commonHelper.uniqueProductName('editm4') + unique_value;
  597. var firstTag = 'FirstTag' + unique_value;
  598. var secondTag = 'SecondTag' + unique_value;
  599. var secondShippingWeight = '5';
  600. var secondSku = 'KUV-OK-LR-23-ER-T43';
  601.  
  602. beforeAll(function () {
  603. commonHelper.acceptAlert();
  604. });
  605.  
  606. afterAll(function () {
  607. commonHelper.clearAllData();
  608. });
  609.  
  610. it('should redirect on dashboard page after login', function () {
  611. browser.get(storeLink + '/admin');
  612. signInPage.login(username, password);
  613. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  614. });
  615.  
  616. it('should redirect on add product page', function () {
  617. browser.get(addProductLink);
  618. addProductPage.waitForPublishButton();
  619. });
  620.  
  621. it('should select multi variant option', function () {
  622. addProductPage.clickMulti();
  623. });
  624.  
  625. it('should fill new product form', function () {
  626. addProductPage.selectType(type);
  627. addProductPage.selectFirstCollection();
  628. addProductPage.fillTitle(title);
  629. addProductPage.addTag(firstTag);
  630. addProductPage.fillShippingWeight(weight);
  631. });
  632.  
  633. it('should add first option', function () {
  634. addProductPage.fillOptionTitle(0, 'Color');
  635. addProductPage.fillOptionValue(0, firstColor);
  636. });
  637.  
  638. it('should add second option', function () {
  639. addProductPage.fillOptionTitle(1, 'Size');
  640. addProductPage.fillOptionValue(1, firstSize);
  641. });
  642.  
  643. it('should fill variant price', function () {
  644. addProductPage.fillVariantPrice(firstVariant, price);
  645. addProductPage.fillVariantSku(firstVariant, sku);
  646. });
  647.  
  648. it('should publish product', function () {
  649. addProductPage.clickPublish();
  650. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  651. });
  652.  
  653. it('should open edit page for added product', function () {
  654. productListPage.editProduct(title);
  655. addProductPage.waitForSaveButton();
  656. });
  657.  
  658. it('should edit weight, tag and sku', function () {
  659. addProductPage.fillShippingWeight(secondShippingWeight);
  660. addProductPage.clickDeleteCollection(firstTag);
  661. addProductPage.addTag(secondTag);
  662. addProductPage.fillVariantSku(firstVariant, secondSku);
  663. });
  664.  
  665. it('should save product', function () {
  666. addProductPage.clickSave();
  667. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  668. });
  669.  
  670. it('should open edit page for added product', function () {
  671. productListPage.editProduct(title);
  672. addProductPage.waitForSaveButton();
  673. });
  674.  
  675. it('should show correct tag', function () {
  676. expect(addProductPage.eleSelectedCollection(secondTag).isDisplayed()).toBeTruthy();
  677. });
  678.  
  679. it('should save product', function () {
  680. addProductPage.clickSave();
  681. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  682. });
  683. });
  684.  
  685. describe('multi variant product edit page SEO title', function () {
  686.  
  687. var title = commonHelper.uniqueProductName('editm5') + unique_value;
  688. var seoTitle = 'seo';
  689.  
  690. beforeAll(function () {
  691. commonHelper.acceptAlert();
  692. });
  693.  
  694. afterAll(function () {
  695. commonHelper.clearAllData();
  696. });
  697.  
  698. it('should redirect on dashboard page after login', function () {
  699. browser.get(storeLink + '/admin');
  700. signInPage.login(username, password);
  701. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  702. });
  703.  
  704. it('should redirect on add product page', function () {
  705. browser.get(addProductLink);
  706. addProductPage.waitForPublishButton();
  707. });
  708.  
  709. it('should select multi variant option', function () {
  710. addProductPage.clickMulti();
  711. });
  712.  
  713. it('should fill new product form', function () {
  714. addProductPage.selectType(type);
  715. addProductPage.selectFirstCollection();
  716. addProductPage.fillTitle(title);
  717. });
  718.  
  719. it('should add first option', function () {
  720. addProductPage.fillOptionTitle(0, 'Color');
  721. addProductPage.fillOptionValue(0, firstColor);
  722. });
  723.  
  724. it('should add second option', function () {
  725. addProductPage.fillOptionTitle(1, 'Size');
  726. addProductPage.fillOptionValue(1, firstSize);
  727. });
  728.  
  729. it('should fill variant price', function () {
  730. addProductPage.fillVariantPrice(firstVariant, price);
  731. });
  732.  
  733. it('should publish product', function () {
  734. addProductPage.clickPublish();
  735. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  736. });
  737.  
  738. it('should open edit page for added product', function () {
  739. productListPage.editProduct(title);
  740. addProductPage.waitForSaveButton();
  741. });
  742.  
  743. it('should edit seo title', function () {
  744. addProductPage.fillSeoTitle(seoTitle);
  745. });
  746.  
  747. it('should save product', function () {
  748. addProductPage.clickSave();
  749. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  750. });
  751.  
  752. it('should open product page and show correct title, seo title on product page', function () {
  753. productListPage.clickProduct(title);
  754. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  755.  
  756. expect(productPage.productTitle()).toEqual(title);
  757. expect(homePage.pixelCode('head', seoTitle).isPresent()).toBeTruthy();
  758.  
  759. commonHelper.switchToPreviousTab();
  760. });
  761. });
  762.  
  763. describe('multi variant product edit page SEO url', function () {
  764.  
  765. var title = commonHelper.uniqueProductName('editm6') + unique_value;
  766. var url = commonHelper.uniqueProductName('editm7') + unique_value;
  767.  
  768. beforeAll(function () {
  769. commonHelper.acceptAlert();
  770. });
  771.  
  772. afterAll(function () {
  773. commonHelper.clearAllData();
  774. });
  775.  
  776. it('should redirect on dashboard page after login', function () {
  777. browser.get(storeLink + '/admin');
  778. signInPage.login(username, password);
  779. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  780. });
  781.  
  782. it('should redirect on add product page', function () {
  783. browser.get(addProductLink);
  784. addProductPage.waitForPublishButton();
  785. });
  786.  
  787. it('should select multi variant option', function () {
  788. addProductPage.clickMulti();
  789. });
  790.  
  791. it('should fill new product form', function () {
  792. addProductPage.selectType(type);
  793. addProductPage.selectFirstCollection();
  794. addProductPage.fillTitle(title);
  795. });
  796.  
  797. it('should add first option', function () {
  798. addProductPage.fillOptionTitle(0, 'Color');
  799. addProductPage.fillOptionValue(0, firstColor);
  800. });
  801.  
  802. it('should add second option', function () {
  803. addProductPage.fillOptionTitle(1, 'Size');
  804. addProductPage.fillOptionValue(1, firstSize);
  805. });
  806.  
  807. it('should fill variant price', function () {
  808. addProductPage.fillVariantPrice(firstVariant, price);
  809. });
  810.  
  811. it('should publish product', function () {
  812. addProductPage.clickPublish();
  813. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  814. });
  815.  
  816. it('should open edit page for added product', function () {
  817. productListPage.editProduct(title);
  818. addProductPage.waitForSaveButton();
  819. });
  820.  
  821. it('should edit url', function () {
  822. addProductPage.fillUrl(url);
  823. });
  824.  
  825. it('should save product', function () {
  826. addProductPage.clickSave();
  827. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  828. });
  829.  
  830. it('should open product page with correct link', function () {
  831. productListPage.clickProduct(title);
  832. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  833.  
  834. expect(productPage.productTitle()).toEqual(title);
  835. expect(browser.getCurrentUrl()).toContain(url.toLowerCase());
  836.  
  837. commonHelper.switchToPreviousTab();
  838. });
  839. });
  840.  
  841. describe('multi variant product edit variants - add one option value to a changes product look variant', function () {
  842.  
  843. var title = commonHelper.uniqueProductName('editm8') + unique_value;
  844. var secondPrice = '$30.00';
  845. var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
  846.  
  847. beforeAll(function () {
  848. commonHelper.acceptAlert();
  849. });
  850.  
  851. afterAll(function () {
  852. commonHelper.clearAllData();
  853. });
  854.  
  855. it('should redirect on dashboard page after login', function () {
  856. browser.get(storeLink + '/admin');
  857. signInPage.login(username, password);
  858. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  859. });
  860.  
  861. it('should redirect on add product page', function () {
  862. browser.get(addProductLink);
  863. addProductPage.waitForPublishButton();
  864. });
  865.  
  866. it('should select multi variant option', function () {
  867. addProductPage.clickMulti();
  868. });
  869.  
  870. it('should fill new product form', function () {
  871. addProductPage.selectType(type);
  872. addProductPage.selectFirstCollection();
  873. addProductPage.fillTitle(title);
  874. });
  875.  
  876. it('should add first option', function () {
  877. addProductPage.fillOptionTitle(0, 'Color');
  878. addProductPage.fillOptionValue(0, firstColor);
  879. });
  880.  
  881. it('should add second option', function () {
  882. addProductPage.fillOptionTitle(1, 'Size');
  883. addProductPage.fillOptionValue(1, firstSize);
  884. });
  885.  
  886. it('should fill variant price', function () {
  887. addProductPage.fillVariantPrice(firstVariant, price);
  888. });
  889.  
  890. it('should add images', function () {
  891. addProductPage.uploadImage(1, firstImage);
  892. });
  893.  
  894. it('should publish product', function () {
  895. addProductPage.clickPublish();
  896. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  897. });
  898.  
  899. it('should save thumbnail source', function () {
  900. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  901. productListPage.productImage(title).getAttribute('style').then(function (value) {
  902. firstThumbnail = value;
  903. });
  904. });
  905.  
  906. it('should open product page', function () {
  907. productListPage.clickProduct(title);
  908. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  909. });
  910.  
  911. it('should save main image source', function () {
  912. productPage.eleProductImage.getAttribute('src').then(function (value) {
  913. firstProductImage = value;
  914. });
  915. });
  916.  
  917. it('should edit product', function () {
  918. commonHelper.switchToPreviousTab();
  919. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  920. productListPage.editProduct(title);
  921. addProductPage.waitForSaveButton();
  922. });
  923.  
  924. it('should add new color in first option', function () {
  925. addProductPage.fillOptionValue(0, secondColor);
  926. });
  927.  
  928. it('should fill variant price', function () {
  929. addProductPage.fillVariantPrice(fourthVariant, secondPrice);
  930. });
  931.  
  932. it('should add image', function () {
  933. addProductPage.uploadImage(1, secondImage);
  934. });
  935.  
  936. it('should save product', function () {
  937. addProductPage.clickSave();
  938. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  939. });
  940.  
  941. it('should save thumbnail source', function () {
  942. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  943. productListPage.productImage(title).getAttribute('style').then(function (value) {
  944. secondThumbnail = value;
  945. });
  946. });
  947.  
  948. it('should open product page', function () {
  949. productListPage.clickProduct(title);
  950. });
  951.  
  952. it('should show main product image', function () {
  953. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  954. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  955. });
  956.  
  957. it('should save main image source', function () {
  958. productPage.eleProductImage.getAttribute('src').then(function (value) {
  959. secondProductImage = value;
  960. });
  961. });
  962.  
  963. it('should not see image changes', function () {
  964. expect(firstThumbnail).toEqual(secondThumbnail);
  965. expect(firstProductImage).toEqual(secondProductImage);
  966. });
  967.  
  968. it('should show correct product price', function () {
  969. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  970. });
  971.  
  972. it('should show correct product name', function () {
  973. expect(productPage.productTitle()).toEqual(title);
  974. });
  975.  
  976. it('should show correct number of thumbs', function () {
  977. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  978. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  979. browser.sleep(10000);
  980. expect(productPage.allThumbs.count()).toEqual(2);
  981. });
  982.  
  983. it('should select second color', function () {
  984. productPage.selectOption('color', secondColor);
  985. });
  986.  
  987. it('should show main product image', function () {
  988. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  989. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  990. });
  991.  
  992. it('should show correct product price', function () {
  993. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  994. });
  995.  
  996. it('should show correct number of thumbs', function () {
  997. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  998. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  999. browser.sleep(1000);
  1000. expect(productPage.allThumbs.count()).toEqual(2);
  1001. commonHelper.switchToPreviousTab();
  1002. });
  1003. });
  1004.  
  1005. describe('multi variant product edit variants - remove option value to changes product look variant', function () {
  1006.  
  1007. var title = commonHelper.uniqueProductName('editm9') + unique_value;
  1008. var secondPrice = '$30.00';
  1009.  
  1010. beforeAll(function () {
  1011. commonHelper.acceptAlert();
  1012. });
  1013.  
  1014. afterAll(function () {
  1015. commonHelper.clearAllData();
  1016. });
  1017.  
  1018. it('should redirect on dashboard page after login', function () {
  1019. browser.get(storeLink + '/admin');
  1020. signInPage.login(username, password);
  1021. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1022. });
  1023.  
  1024. it('should redirect on add product page', function () {
  1025. browser.get(addProductLink);
  1026. addProductPage.waitForPublishButton();
  1027. });
  1028.  
  1029. it('should select multi variant option', function () {
  1030. addProductPage.clickMulti();
  1031. });
  1032.  
  1033. it('should fill new product form', function () {
  1034. addProductPage.selectType(type);
  1035. addProductPage.selectFirstCollection();
  1036. addProductPage.fillTitle(title);
  1037. });
  1038.  
  1039. it('should add first option', function () {
  1040. addProductPage.fillOptionTitle(0, 'Color');
  1041. addProductPage.fillOptionValue(0, firstColor);
  1042. addProductPage.fillOptionValue(0, secondColor);
  1043. addProductPage.clickProductLookCheckbox(0);
  1044. });
  1045.  
  1046. it('should add second option', function () {
  1047. addProductPage.fillOptionTitle(1, 'Size');
  1048. addProductPage.fillOptionValue(1, firstSize);
  1049. });
  1050.  
  1051. it('should fill variant price', function () {
  1052. addProductPage.fillVariantPrice(firstVariant, price);
  1053. addProductPage.fillVariantPrice(fourthVariant, secondPrice);
  1054. });
  1055.  
  1056. it('should add images', function () {
  1057. addProductPage.uploadImage(1, firstImage);
  1058. addProductPage.uploadImage(2, secondImage);
  1059. });
  1060.  
  1061. it('should publish product', function () {
  1062. addProductPage.clickPublish();
  1063. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1064. });
  1065.  
  1066. it('should edit product', function () {
  1067. productListPage.editProduct(title);
  1068. addProductPage.waitForSaveButton();
  1069. });
  1070.  
  1071. it('should delete color', function () {
  1072. addProductPage.clickDeleteCollection(secondColor);
  1073. });
  1074.  
  1075. it('should save product', function () {
  1076. addProductPage.clickSave();
  1077. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1078. });
  1079.  
  1080. it('should open product page', function () {
  1081. productListPage.clickProduct(title);
  1082. });
  1083.  
  1084. it('should show main product image', function () {
  1085. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1086. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1087. });
  1088.  
  1089. it('should not show second color', function () {
  1090. expect(productPage.eleOption(secondColor).isPresent()).toBeFalsy();
  1091. });
  1092. });
  1093.  
  1094. describe('multi variant product variant thumbnail selector edit - via hex value, via image, image back to hex', function () {
  1095.  
  1096. var title = commonHelper.uniqueProductName('editm10') + unique_value;
  1097.  
  1098. beforeAll(function () {
  1099. commonHelper.acceptAlert();
  1100. });
  1101.  
  1102. afterAll(function () {
  1103. commonHelper.clearAllData();
  1104. });
  1105.  
  1106. it('should redirect on dashboard page after login', function () {
  1107. browser.get(storeLink + '/admin');
  1108. signInPage.login(username, password);
  1109. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1110. });
  1111.  
  1112.  
  1113. it('should redirect on add product page', function () {
  1114. browser.get(addProductLink);
  1115. addProductPage.waitForPublishButton();
  1116. });
  1117.  
  1118. it('should select multi variant option', function () {
  1119. addProductPage.clickMulti();
  1120. });
  1121.  
  1122. it('should fill new product form', function () {
  1123. addProductPage.selectType(type);
  1124. addProductPage.selectFirstCollection();
  1125. addProductPage.fillTitle(title);
  1126. });
  1127.  
  1128. it('should add first option', function () {
  1129. addProductPage.fillOptionTitle(0, 'Color');
  1130. addProductPage.fillOptionValue(0, firstColor);
  1131. addProductPage.fillOptionValue(0, secondColor);
  1132. });
  1133.  
  1134. it('should add second option', function () {
  1135. addProductPage.fillOptionTitle(1, 'Size');
  1136. addProductPage.fillOptionValue(1, firstSize);
  1137. addProductPage.fillOptionValue(1, secondSize);
  1138. });
  1139.  
  1140. it('should fill variant prices', function () {
  1141. addProductPage.fillVariantPrice(firstVariant, price);
  1142. addProductPage.clickVariantPriceAutofill(firstVariant);
  1143. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1144. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1145. });
  1146.  
  1147. it('should add images', function () {
  1148. addProductPage.uploadImage(1, firstImage);
  1149. addProductPage.uploadImage(1, secondImage);
  1150. addProductPage.uploadImage(1, thirdImage);
  1151. });
  1152.  
  1153. it('should publish product', function () {
  1154. addProductPage.clickPublish();
  1155. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1156. });
  1157.  
  1158. it('should edit product', function () {
  1159. productListPage.editProduct(title);
  1160. addProductPage.waitForSaveButton();
  1161. });
  1162.  
  1163. it('should click thumbnail selector for first option', function () {
  1164. addProductPage.clickThumbnailSelectorRadio(0);
  1165. });
  1166.  
  1167. it('should click add - edit thumbnails for first option', function () {
  1168. addProductPage.clickAddThumbnails(0);
  1169. });
  1170.  
  1171. it('should set color codes for two colors', function () {
  1172. addProductPage.fillColorCode(firstColor, firstColorCode);
  1173. addProductPage.fillColorCode(secondColor, secondColorCode);
  1174. });
  1175.  
  1176. it('should click submit button in add - edit', function () {
  1177. addProductPage.clickSubmitThumbnail();
  1178. });
  1179.  
  1180. it('should save product', function () {
  1181. addProductPage.clickSave();
  1182. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1183. });
  1184.  
  1185. it('should open product page', function () {
  1186. productListPage.clickProduct(title);
  1187. });
  1188.  
  1189. it('should show main product image', function () {
  1190. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1191. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1192. });
  1193.  
  1194. it('should show color buttons', function () {
  1195. expect(productPage.eleColor(firstColorCode).isPresent()).toBeTruthy();
  1196. expect(productPage.eleColor(secondColorCode).isPresent()).toBeTruthy();
  1197. });
  1198.  
  1199. it('should edit product', function () {
  1200. commonHelper.switchToPreviousTab();
  1201. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1202. productListPage.editProduct(title);
  1203. addProductPage.waitForSaveButton();
  1204. });
  1205.  
  1206. it('should click add - edit thumbnails for first option', function () {
  1207. addProductPage.clickAddThumbnails(0);
  1208. });
  1209.  
  1210. it('should click swatch image', function () {
  1211. addProductPage.clickSwatchImage(firstColor);
  1212. addProductPage.clickSwatchImage(secondColor);
  1213. });
  1214.  
  1215. it('should add images', function () {
  1216. addProductPage.uploadImage(2, firstImage);
  1217. addProductPage.uploadImage(3, secondImage);
  1218. });
  1219.  
  1220. it('should click submit button in add - edit', function () {
  1221. addProductPage.clickSubmitThumbnail();
  1222. });
  1223.  
  1224. it('should save product', function () {
  1225. addProductPage.clickSave();
  1226. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1227. });
  1228.  
  1229. it('should open product page', function () {
  1230. productListPage.clickProduct(title);
  1231. });
  1232.  
  1233. it('should show main product image', function () {
  1234. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1235. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1236. });
  1237.  
  1238. it('should show color buttons', function () {
  1239. expect(productPage.allColorButtons.count()).toEqual(2);
  1240. });
  1241.  
  1242. it('should edit product', function () {
  1243. commonHelper.switchToPreviousTab();
  1244. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1245. productListPage.editProduct(title);
  1246. addProductPage.waitForSaveButton();
  1247. });
  1248.  
  1249. it('should click add - edit thumbnails for first option', function () {
  1250. addProductPage.clickAddThumbnails(0);
  1251. });
  1252.  
  1253. it('should click swatch image', function () {
  1254. addProductPage.clickColorCode(firstColor);
  1255. addProductPage.clickColorCode(secondColor);
  1256. });
  1257.  
  1258. it('should set color codes for two colors', function () {
  1259. addProductPage.fillColorCode(firstColor, firstColorCode);
  1260. addProductPage.fillColorCode(secondColor, secondColorCode);
  1261. });
  1262.  
  1263. it('should click submit button in add - edit', function () {
  1264. addProductPage.clickSubmitThumbnail();
  1265. });
  1266.  
  1267. it('should save product', function () {
  1268. addProductPage.clickSave();
  1269. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1270. });
  1271.  
  1272. it('should open product page', function () {
  1273. productListPage.clickProduct(title);
  1274. });
  1275.  
  1276. it('should show main product image', function () {
  1277. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1278. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1279. });
  1280.  
  1281. it('should show color buttons', function () {
  1282. expect(productPage.eleColor(firstColorCode).isPresent()).toBeTruthy();
  1283. expect(productPage.eleColor(secondColorCode).isPresent()).toBeTruthy();
  1284. });
  1285. });
  1286.  
  1287. describe('multi variant product edit - add another variant that changes product look', function () {
  1288.  
  1289. var title = commonHelper.uniqueProductName('editm11') + unique_value;
  1290. var secondPrice = '$40.00';
  1291. var secondComparePrice = '$50.00';
  1292.  
  1293. beforeAll(function () {
  1294. commonHelper.acceptAlert();
  1295. });
  1296.  
  1297. afterAll(function () {
  1298. commonHelper.clearAllData();
  1299. });
  1300.  
  1301. it('should redirect on dashboard page after login', function () {
  1302. browser.get(storeLink + '/admin');
  1303. signInPage.login(username, password);
  1304. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1305. });
  1306.  
  1307. it('should redirect on add product page', function () {
  1308. browser.get(addProductLink);
  1309. addProductPage.waitForPublishButton();
  1310. });
  1311.  
  1312. it('should select multi variant', function () {
  1313. addProductPage.clickMulti();
  1314. });
  1315.  
  1316. it('should fill new product form', function () {
  1317. addProductPage.selectType(type);
  1318. addProductPage.selectFirstCollection();
  1319. addProductPage.fillTitle(title);
  1320. });
  1321.  
  1322. it('should add first option', function () {
  1323. addProductPage.fillOptionTitle(0, 'Color');
  1324. addProductPage.fillOptionValue(0, firstColor);
  1325. addProductPage.fillOptionValue(0, secondColor);
  1326. });
  1327.  
  1328. it('should add second option', function () {
  1329. addProductPage.fillOptionTitle(1, 'Size');
  1330. addProductPage.fillOptionValue(1, firstSize);
  1331. addProductPage.fillOptionValue(1, secondSize);
  1332. });
  1333.  
  1334. it('should fill variant prices', function () {
  1335. addProductPage.fillVariantPrice(firstVariant, price);
  1336. addProductPage.clickVariantPriceAutofill(firstVariant);
  1337. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1338. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1339. });
  1340.  
  1341. it('should add images', function () {
  1342. addProductPage.uploadImage(1, firstImage);
  1343. addProductPage.uploadImage(1, secondImage);
  1344. });
  1345.  
  1346. it('should publish product', function () {
  1347. addProductPage.clickPublish();
  1348. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1349. });
  1350.  
  1351. it('should edit product', function () {
  1352. productListPage.editProduct(title);
  1353. addProductPage.waitForSaveButton();
  1354. });
  1355.  
  1356. it('should add third option', function () {
  1357. addProductPage.clickAddOption();
  1358. addProductPage.fillOptionTitle(2, 'Style');
  1359. addProductPage.fillOptionValue(2, firstStyle);
  1360. addProductPage.fillOptionValue(2, secondStyle);
  1361. addProductPage.clickProductLookCheckbox(2);
  1362. });
  1363.  
  1364. it('should add images for first color', function () {
  1365. addProductPage.uploadImage(1, firstImage);
  1366. addProductPage.uploadImage(1, secondImage);
  1367. });
  1368.  
  1369. it('should add images for second color', function () {
  1370. addProductPage.uploadImage(2, secondImage);
  1371. addProductPage.uploadImage(2, thirdImage);
  1372. });
  1373.  
  1374. it('should fill first variant', function () {
  1375. var firstVariant = firstColor + ' / ' + firstSize + ' / ' + firstStyle;
  1376. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  1377. addProductPage.clickVariantPriceAutofill(firstVariant);
  1378. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  1379. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1380. });
  1381.  
  1382. it('should save product', function () {
  1383. addProductPage.clickSave();
  1384. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1385. });
  1386.  
  1387. it('should open product page', function () {
  1388. productListPage.clickProduct(title);
  1389. });
  1390.  
  1391. it('should show main product image', function () {
  1392. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1393. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1394. });
  1395.  
  1396. it('should show correct product price', function () {
  1397. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1398. });
  1399.  
  1400. it('should show correct product compare price', function () {
  1401. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1402. });
  1403.  
  1404. it('should show correct product name', function () {
  1405. expect(productPage.productTitle()).toEqual(title);
  1406. });
  1407.  
  1408. it('should show correct number of thumbs', function () {
  1409. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1410. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1411. browser.sleep(1000);
  1412. expect(productPage.allThumbs.count()).toEqual(2);
  1413. });
  1414.  
  1415. it('should select second color', function () {
  1416. productPage.selectOption('color', secondColor);
  1417. });
  1418.  
  1419. it('should show main product image', function () {
  1420. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1421. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1422. });
  1423.  
  1424. it('should show correct product price', function () {
  1425. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1426. });
  1427.  
  1428. it('should show correct product compare price', function () {
  1429. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1430. });
  1431.  
  1432. it('should show correct number of thumbs', function () {
  1433. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1434. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1435. browser.sleep(1000);
  1436. expect(productPage.allThumbs.count()).toEqual(2);
  1437. });
  1438.  
  1439. it('should select second size', function () {
  1440. productPage.selectOption('size', secondSize);
  1441. });
  1442.  
  1443. it('should show main product image', function () {
  1444. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1445. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1446. });
  1447.  
  1448. it('should show correct product price', function () {
  1449. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1450. });
  1451.  
  1452. it('should show correct product compare price', function () {
  1453. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1454. });
  1455.  
  1456. it('should show correct number of thumbs', function () {
  1457. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1458. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1459. browser.sleep(1000);
  1460. expect(productPage.allThumbs.count()).toEqual(2);
  1461. });
  1462.  
  1463. it('should select second color', function () {
  1464. productPage.selectOption('style', secondStyle);
  1465. });
  1466.  
  1467. it('should show main product image', function () {
  1468. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1469. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1470. });
  1471.  
  1472. it('should show correct product price', function () {
  1473. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1474. });
  1475.  
  1476. it('should show correct product compare price', function () {
  1477. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1478. });
  1479.  
  1480. it('should show correct number of thumbs', function () {
  1481. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1482. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1483. browser.sleep(1000);
  1484. expect(productPage.allThumbs.count()).toEqual(2);
  1485. });
  1486. });
  1487.  
  1488. describe('multi variant product edit - add another variant that does not change product look', function () {
  1489.  
  1490. var title = commonHelper.uniqueProductName('editm12') + unique_value;
  1491. var secondPrice = '$40.00';
  1492. var secondComparePrice = '$50.00';
  1493.  
  1494. beforeAll(function () {
  1495. commonHelper.acceptAlert();
  1496. });
  1497.  
  1498. afterAll(function () {
  1499. commonHelper.clearAllData();
  1500. });
  1501.  
  1502. it('should redirect on dashboard page after login', function () {
  1503. browser.get(storeLink + '/admin');
  1504. signInPage.login(username, password);
  1505. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1506. });
  1507.  
  1508. it('should redirect on add product page', function () {
  1509. browser.get(addProductLink);
  1510. addProductPage.waitForPublishButton();
  1511. });
  1512.  
  1513. it('should select multi variant', function () {
  1514. addProductPage.clickMulti();
  1515. });
  1516.  
  1517. it('should fill new product form', function () {
  1518. addProductPage.selectType(type);
  1519. addProductPage.selectFirstCollection();
  1520. addProductPage.fillTitle(title);
  1521. });
  1522.  
  1523. it('should add first option', function () {
  1524. addProductPage.fillOptionTitle(0, 'Color');
  1525. addProductPage.fillOptionValue(0, firstColor);
  1526. addProductPage.fillOptionValue(0, secondColor);
  1527. });
  1528.  
  1529. it('should add second option', function () {
  1530. addProductPage.fillOptionTitle(1, 'Size');
  1531. addProductPage.fillOptionValue(1, firstSize);
  1532. addProductPage.fillOptionValue(1, secondSize);
  1533. });
  1534.  
  1535. it('should fill variant price', function () {
  1536. addProductPage.fillVariantPrice(firstVariant, price);
  1537. addProductPage.clickVariantPriceAutofill(firstVariant);
  1538. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1539. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1540. });
  1541.  
  1542. it('should add images', function () {
  1543. addProductPage.uploadImage(1, firstImage);
  1544. addProductPage.uploadImage(1, secondImage);
  1545. });
  1546.  
  1547. it('should publish product', function () {
  1548. addProductPage.clickPublish();
  1549. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1550. });
  1551.  
  1552. it('should edit product', function () {
  1553. productListPage.editProduct(title);
  1554. addProductPage.waitForSaveButton();
  1555. });
  1556.  
  1557. it('should add third option', function () {
  1558. addProductPage.clickAddOption();
  1559. addProductPage.fillOptionTitle(2, 'Style');
  1560. addProductPage.fillOptionValue(2, firstStyle);
  1561. addProductPage.fillOptionValue(2, secondStyle);
  1562. });
  1563.  
  1564. it('should add image', function () {
  1565. addProductPage.uploadImage(1, thirdImage);
  1566. });
  1567.  
  1568. it('should fill variant price', function () {
  1569. var firstVariant = firstColor + ' / ' + firstSize + ' / ' + firstStyle;
  1570. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  1571. addProductPage.clickVariantPriceAutofill(firstVariant);
  1572. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  1573. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1574. });
  1575.  
  1576. it('should save product', function () {
  1577. addProductPage.clickSave();
  1578. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1579. });
  1580.  
  1581. it('should open product page', function () {
  1582. productListPage.clickProduct(title);
  1583. });
  1584.  
  1585. it('should show main product image', function () {
  1586. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1587. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1588. });
  1589.  
  1590. it('should show correct product price', function () {
  1591. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1592. });
  1593.  
  1594. it('should show correct product compare price', function () {
  1595. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1596. });
  1597.  
  1598. it('should show correct product name', function () {
  1599. expect(productPage.productTitle()).toEqual(title);
  1600. });
  1601.  
  1602. it('should show correct number of thumbs', function () {
  1603. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1604. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1605. browser.sleep(1000);
  1606. expect(productPage.allThumbs.count()).toEqual(3);
  1607. });
  1608.  
  1609. it('should select second color', function () {
  1610. productPage.selectOption('color', secondColor);
  1611. });
  1612.  
  1613. it('should show main product image', function () {
  1614. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1615. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1616. });
  1617.  
  1618. it('should show correct product price', function () {
  1619. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1620. });
  1621.  
  1622. it('should show correct product compare price', function () {
  1623. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1624. });
  1625.  
  1626. it('should show correct number of thumbs', function () {
  1627. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1628. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1629. browser.sleep(1000);
  1630. expect(productPage.allThumbs.count()).toEqual(3);
  1631. });
  1632.  
  1633. it('should select second size', function () {
  1634. productPage.selectOption('size', secondSize);
  1635. });
  1636.  
  1637. it('should show main product image', function () {
  1638. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1639. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1640. });
  1641.  
  1642. it('should show correct product price', function () {
  1643. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1644. });
  1645.  
  1646. it('should show correct product compare price', function () {
  1647. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1648. });
  1649.  
  1650. it('should show correct number of thumbs', function () {
  1651. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1652. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1653. browser.sleep(1000);
  1654. expect(productPage.allThumbs.count()).toEqual(3);
  1655. });
  1656.  
  1657. it('should select second color', function () {
  1658. productPage.selectOption('style', secondStyle);
  1659. });
  1660.  
  1661. it('should show main product image', function () {
  1662. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1663. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1664. });
  1665.  
  1666. it('should show correct product price', function () {
  1667. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1668. });
  1669.  
  1670. it('should show correct product compare price', function () {
  1671. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1672. });
  1673.  
  1674. it('should show correct number of thumbs', function () {
  1675. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1676. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1677. browser.sleep(1000);
  1678. expect(productPage.allThumbs.count()).toEqual(3);
  1679. });
  1680. });
  1681.  
  1682. describe('multi variant product edit to delete all variants and replace with new ones', function () {
  1683.  
  1684. var title = commonHelper.uniqueProductName('editm13') + unique_value;
  1685.  
  1686. beforeAll(function () {
  1687. commonHelper.acceptAlert();
  1688. });
  1689.  
  1690. afterAll(function () {
  1691. commonHelper.clearAllData();
  1692. });
  1693.  
  1694. it('should redirect on dashboard page after login', function () {
  1695. browser.get(storeLink + '/admin');
  1696. signInPage.login(username, password);
  1697. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1698. });
  1699.  
  1700. it('should redirect on add product page', function () {
  1701. browser.get(addProductLink);
  1702. addProductPage.waitForPublishButton();
  1703. });
  1704.  
  1705. it('should select multi variant option', function () {
  1706. addProductPage.clickMulti();
  1707. });
  1708.  
  1709. it('should fill new product form', function () {
  1710. addProductPage.selectType(type);
  1711. addProductPage.selectFirstCollection();
  1712. addProductPage.fillTitle(title);
  1713. });
  1714.  
  1715. it('should add first option', function () {
  1716. addProductPage.fillOptionTitle(0, 'Color');
  1717. addProductPage.fillOptionValue(0, firstColor);
  1718. });
  1719.  
  1720. it('should add second option', function () {
  1721. addProductPage.fillOptionTitle(1, 'Size');
  1722. addProductPage.fillOptionValue(1, firstSize);
  1723. });
  1724.  
  1725. it('should fill variant price', function () {
  1726. addProductPage.fillVariantPrice(firstVariant, price);
  1727. });
  1728.  
  1729. it('should add image', function () {
  1730. addProductPage.uploadImage(1, firstImage);
  1731. });
  1732.  
  1733. it('should publish product', function () {
  1734. addProductPage.clickPublish();
  1735. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1736. });
  1737.  
  1738. it('should edit product', function () {
  1739. productListPage.editProduct(title);
  1740. addProductPage.waitForSaveButton();
  1741. });
  1742.  
  1743. it('should delete all variants', function(){
  1744. addProductPage.clickDeleteOption(0);
  1745. addProductPage.clickDeleteOption(0);
  1746. });
  1747.  
  1748. it('should add first option', function () {
  1749. addProductPage.clickAddOption();
  1750. addProductPage.fillOptionTitle(0, 'Color');
  1751. addProductPage.fillOptionValue(0, firstColor);
  1752. });
  1753.  
  1754. it('should add second option', function () {
  1755. addProductPage.clickAddOption();
  1756. addProductPage.fillOptionTitle(1, 'Size');
  1757. addProductPage.fillOptionValue(1, firstSize);
  1758. });
  1759.  
  1760. it('should fill variant price', function () {
  1761. addProductPage.fillVariantPrice(firstVariant, price);
  1762. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1763. });
  1764.  
  1765. it('should save product', function () {
  1766. addProductPage.clickSave();
  1767. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1768. });
  1769.  
  1770. it('should open product page', function () {
  1771. productListPage.clickProduct(title);
  1772. });
  1773.  
  1774. it('should show main product image', function () {
  1775. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1776. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1777. });
  1778.  
  1779. it('should show correct product price', function () {
  1780. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  1781. });
  1782.  
  1783. it('should show correct product compare price', function () {
  1784. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  1785. });
  1786. });
  1787.  
  1788. describe('multi variant product edit to add more images', function () {
  1789.  
  1790. var title = commonHelper.uniqueProductName('editm14') + unique_value;
  1791.  
  1792. beforeAll(function () {
  1793. commonHelper.acceptAlert();
  1794. });
  1795.  
  1796. afterAll(function () {
  1797. commonHelper.clearAllData();
  1798. });
  1799.  
  1800. it('should redirect on dashboard page after login', function () {
  1801. browser.get(storeLink + '/admin');
  1802. signInPage.login(username, password);
  1803. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1804. });
  1805.  
  1806. it('should redirect on add product page', function () {
  1807. browser.get(addProductLink);
  1808. addProductPage.waitForPublishButton();
  1809. });
  1810.  
  1811. it('should select multi variant option', function () {
  1812. addProductPage.clickMulti();
  1813. });
  1814.  
  1815. it('should fill new product form', function () {
  1816. addProductPage.selectType(type);
  1817. addProductPage.selectFirstCollection();
  1818. addProductPage.fillTitle(title);
  1819. });
  1820.  
  1821. it('should add first option', function () {
  1822. addProductPage.fillOptionTitle(0, 'Color');
  1823. addProductPage.fillOptionValue(0, firstColor);
  1824. addProductPage.fillOptionValue(0, secondColor);
  1825. addProductPage.fillOptionValue(0, thirdColor);
  1826. addProductPage.clickProductLookCheckbox(0);
  1827. });
  1828.  
  1829. it('should add second option', function () {
  1830. addProductPage.fillOptionTitle(1, 'Size');
  1831. addProductPage.fillOptionValue(1, firstSize);
  1832. addProductPage.fillOptionValue(1, secondSize);
  1833. addProductPage.fillOptionValue(1, thirdSize);
  1834. });
  1835.  
  1836. it('should fill variant prices', function () {
  1837. addProductPage.fillVariantPrice(firstVariant, price);
  1838. addProductPage.clickVariantPriceAutofill(firstVariant);
  1839. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1840. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1841. });
  1842.  
  1843. it('should add images for first color', function () {
  1844. addProductPage.uploadImage(1, firstImage);
  1845. });
  1846.  
  1847. it('should add images for second color', function () {
  1848. addProductPage.uploadImage(2, secondImage);
  1849. });
  1850.  
  1851. it('should add images for third color', function () {
  1852. addProductPage.uploadImage(3, thirdImage);
  1853. });
  1854.  
  1855. it('should publish product', function () {
  1856. addProductPage.clickPublish();
  1857. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1858. });
  1859.  
  1860. it('should edit product', function () {
  1861. productListPage.editProduct(title);
  1862. addProductPage.waitForSaveButton();
  1863. });
  1864.  
  1865. it('should add images to first color', function () {
  1866. addProductPage.uploadImage(1, secondImage);
  1867. addProductPage.uploadImage(1, thirdImage);
  1868. });
  1869.  
  1870. it('should add images to second color', function () {
  1871. addProductPage.uploadImage(2, firstImage);
  1872. addProductPage.uploadImage(2, thirdImage);
  1873. });
  1874.  
  1875. it('should add images to third color', function () {
  1876. addProductPage.uploadImage(3, firstImage);
  1877. addProductPage.uploadImage(3, secondImage);
  1878. });
  1879.  
  1880. it('should save product', function () {
  1881. addProductPage.clickSave();
  1882. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1883. });
  1884.  
  1885. it('should open product page', function () {
  1886. productListPage.clickProduct(title);
  1887. });
  1888.  
  1889. it('should show main product image', function () {
  1890. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1891. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1892. });
  1893.  
  1894. it('should show correct product price', function () {
  1895. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  1896. });
  1897.  
  1898. it('should show correct product compare price', function () {
  1899. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  1900. });
  1901.  
  1902. it('should show correct number of thumbs', function () {
  1903. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1904. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1905. browser.sleep(1000);
  1906. expect(productPage.allThumbs.count()).toEqual(3);
  1907. });
  1908. });
  1909.  
  1910. describe('multi-variant product edit prices and compare at prices', function () {
  1911. var title = commonHelper.uniqueProductName('editm15') + unique_value;
  1912. var secondPrice = '$40.00';
  1913. var secondComparePrice = '$50.00';
  1914.  
  1915. beforeAll(function () {
  1916. commonHelper.acceptAlert();
  1917. });
  1918.  
  1919. afterAll(function () {
  1920. commonHelper.clearAllData();
  1921. });
  1922.  
  1923. it('should redirect on dashboard page after login', function () {
  1924. browser.get(storeLink + '/admin');
  1925. signInPage.login(username, password);
  1926. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1927. });
  1928.  
  1929. it('should redirect on add product page', function () {
  1930. browser.get(addProductLink);
  1931. addProductPage.waitForPublishButton();
  1932. });
  1933.  
  1934. it('should select multi variant option', function () {
  1935. addProductPage.clickMulti();
  1936. });
  1937.  
  1938. it('should fill new product form', function () {
  1939. addProductPage.selectType(type);
  1940. addProductPage.selectFirstCollection();
  1941. addProductPage.fillTitle(title);
  1942. });
  1943.  
  1944. it('should add first option', function () {
  1945. addProductPage.fillOptionTitle(0, 'Color');
  1946. addProductPage.fillOptionValue(0, firstColor);
  1947. });
  1948.  
  1949. it('should add second option', function () {
  1950. addProductPage.fillOptionTitle(1, 'Size');
  1951. addProductPage.fillOptionValue(1, firstSize);
  1952. });
  1953.  
  1954. it('should fill variant prices', function () {
  1955. addProductPage.fillVariantPrice(firstVariant, price);
  1956. addProductPage.clickVariantPriceAutofill(firstVariant);
  1957. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  1958. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1959. });
  1960.  
  1961. it('should publish product', function () {
  1962. addProductPage.clickPublish();
  1963. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1964. });
  1965.  
  1966. it('should edit product', function () {
  1967. productListPage.editProduct(title);
  1968. addProductPage.waitForSaveButton();
  1969. });
  1970.  
  1971. it('should edit variant prices', function () {
  1972. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  1973. addProductPage.clickVariantPriceAutofill(firstVariant);
  1974. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  1975. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  1976. });
  1977.  
  1978. it('should save product', function () {
  1979. addProductPage.clickSave();
  1980. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1981. });
  1982.  
  1983. it('should open product page', function () {
  1984. productListPage.clickProduct(title);
  1985. });
  1986.  
  1987. it('should show add to cart button', function () {
  1988. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1989. });
  1990.  
  1991. it('should show correct new product price', function () {
  1992. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1993. });
  1994.  
  1995. it('should show correct product new compare price', function () {
  1996. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1997. });
  1998. });
  1999.  
  2000. describe('multi-variant product edit default variant selection', function () {
  2001.  
  2002. var title = commonHelper.uniqueProductName('editm16') + unique_value;
  2003. var secondPrice = '$40.00';
  2004. var secondComparePrice = '$50.00';
  2005.  
  2006. beforeAll(function () {
  2007. commonHelper.acceptAlert();
  2008. });
  2009.  
  2010. afterAll(function () {
  2011. commonHelper.clearAllData();
  2012. });
  2013.  
  2014. it('should redirect on dashboard page after login', function () {
  2015. browser.get(storeLink + '/admin');
  2016. signInPage.login(username, password);
  2017. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2018. });
  2019.  
  2020. it('should redirect on add product page', function () {
  2021. browser.get(addProductLink);
  2022. addProductPage.waitForPublishButton();
  2023. });
  2024.  
  2025. it('should select multi variant option', function () {
  2026. addProductPage.clickMulti();
  2027. });
  2028.  
  2029. it('should fill new product form', function () {
  2030. addProductPage.selectType(type);
  2031. addProductPage.selectFirstCollection();
  2032. addProductPage.fillTitle(title);
  2033. });
  2034.  
  2035. it('should add first option', function () {
  2036. addProductPage.fillOptionTitle(0, 'Color');
  2037. addProductPage.fillOptionValue(0, firstColor);
  2038. });
  2039.  
  2040. it('should add second option', function () {
  2041. addProductPage.fillOptionTitle(1, 'Size');
  2042. addProductPage.fillOptionValue(1, firstSize);
  2043. addProductPage.fillOptionValue(1, secondSize);
  2044. });
  2045.  
  2046. it('should fill first and second variant prices', function () {
  2047. addProductPage.fillVariantPrice(firstVariant, price);
  2048. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  2049. addProductPage.fillVariantPrice(secondVariant, secondPrice);
  2050. addProductPage.fillVariantComparePrice(secondVariant, secondComparePrice);
  2051. });
  2052.  
  2053. it('should publish product', function () {
  2054. addProductPage.clickPublish();
  2055. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  2056. });
  2057.  
  2058. it('should edit product', function () {
  2059. productListPage.editProduct(title);
  2060. addProductPage.waitForSaveButton();
  2061. });
  2062.  
  2063. it('should change the default variant', function () {
  2064. addProductPage.clickDefaultVariantCheckbox(secondVariant);
  2065. });
  2066.  
  2067. it('should save product', function () {
  2068. addProductPage.clickSave();
  2069. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  2070. });
  2071.  
  2072. it('should open product page', function () {
  2073. productListPage.clickProduct(title);
  2074. });
  2075.  
  2076. it('should show add to cart button', function () {
  2077. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2078. });
  2079.  
  2080. it('should show correct product price', function () {
  2081. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  2082. });
  2083.  
  2084. it('should show correct product compare price', function () {
  2085. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  2086. });
  2087.  
  2088. it('should select second size', function () {
  2089. productPage.selectOption('size', firstSize);
  2090. });
  2091.  
  2092. it('should show add to cart button', function () {
  2093. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2094. });
  2095.  
  2096. it('should show correct product price', function () {
  2097. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  2098. });
  2099.  
  2100. it('should show correct product compare price', function () {
  2101. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  2102. });
  2103. });
  2104.  
  2105. describe('multi-variant product edit some of them to off via switch', function () {
  2106.  
  2107. var title = commonHelper.uniqueProductName('editm17') + unique_value;
  2108.  
  2109. beforeAll(function () {
  2110. commonHelper.acceptAlert();
  2111. });
  2112.  
  2113. afterAll(function () {
  2114. commonHelper.clearAllData();
  2115. });
  2116.  
  2117. it('should redirect on dashboard page after login', function () {
  2118. browser.get(storeLink + '/admin');
  2119. signInPage.login(username, password);
  2120. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2121. });
  2122.  
  2123. it('should redirect on add product page', function () {
  2124. browser.get(addProductLink);
  2125. addProductPage.waitForPublishButton();
  2126. });
  2127.  
  2128. it('should select multi variant option', function () {
  2129. addProductPage.clickMulti();
  2130. });
  2131.  
  2132. it('should fill new product form', function () {
  2133. addProductPage.selectType(type);
  2134. addProductPage.selectFirstCollection();
  2135. addProductPage.fillTitle(title);
  2136. });
  2137.  
  2138. it('should add first option', function () {
  2139. addProductPage.fillOptionTitle(0, 'Color');
  2140. addProductPage.fillOptionValue(0, firstColor);
  2141. });
  2142.  
  2143. it('should add second option', function () {
  2144. addProductPage.fillOptionTitle(1, 'Size');
  2145. addProductPage.fillOptionValue(1, firstSize);
  2146. addProductPage.fillOptionValue(1, secondSize);
  2147. });
  2148.  
  2149. it('should fill first and second variant prices', function () {
  2150. addProductPage.fillVariantPrice(firstVariant, price);
  2151. addProductPage.clickVariantPriceAutofill(firstVariant);
  2152. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  2153. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2154. });
  2155.  
  2156. it('should publish product', function () {
  2157. addProductPage.clickPublish();
  2158. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  2159. });
  2160.  
  2161. it('should edit product', function () {
  2162. productListPage.editProduct(title);
  2163. addProductPage.waitForSaveButton();
  2164. });
  2165.  
  2166. it('should switch off second variant', function () {
  2167. addProductPage.clickSwitchOff(secondVariant);
  2168. });
  2169.  
  2170. it('should save product', function () {
  2171. addProductPage.clickSave();
  2172. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  2173. });
  2174.  
  2175. it('should open product page', function () {
  2176. productListPage.clickProduct(title);
  2177. });
  2178.  
  2179. it('should show add to cart button', function () {
  2180. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2181. });
  2182.  
  2183. it('should show correct product price', function () {
  2184. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  2185. });
  2186.  
  2187. it('should show correct product compare price', function () {
  2188. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  2189. });
  2190.  
  2191. it('should not show disabled variant', function () {
  2192. expect(productPage.eleOption(secondSize).isPresent()).toBeFalsy();
  2193. });
  2194. });
  2195.  
  2196. describe('checking for edit multi variant product prices, images and names and then checking effect on existing Orders with it', function () {
  2197.  
  2198. var productTitle = commonHelper.uniqueProductName('editm18') + unique_value;
  2199. var secondProductTitle = commonHelper.uniqueProductName('editm19') + unique_value;
  2200.  
  2201. var secondPrice = '$30.00';
  2202. var secondComparePrice = '$35.00';
  2203.  
  2204. var orderNumber;
  2205.  
  2206. beforeAll(function () {
  2207. commonHelper.acceptAlert();
  2208. });
  2209.  
  2210. afterAll(function () {
  2211. commonHelper.clearAllData();
  2212. });
  2213.  
  2214. it('should redirect on dashboard page after login', function () {
  2215. browser.get(storeLink + '/admin');
  2216. signInPage.login(username, password);
  2217. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2218. });
  2219.  
  2220. it('should redirect on add product page', function () {
  2221. browser.get(addProductLink);
  2222. addProductPage.waitForPublishButton();
  2223. });
  2224.  
  2225. it('should select multi variant', function () {
  2226. addProductPage.clickMulti();
  2227. });
  2228.  
  2229. it('should fill new product form', function () {
  2230. addProductPage.selectType(type);
  2231. addProductPage.selectFirstCollection();
  2232. addProductPage.fillTitle(productTitle);
  2233. addProductPage.fillShippingWeight(weight);
  2234. addProductPage.addTag(tag);
  2235. });
  2236.  
  2237. it('should add first option', function () {
  2238. addProductPage.fillOptionTitle(0, 'Color');
  2239. addProductPage.fillOptionValue(0, firstColor);
  2240. addProductPage.fillOptionValue(0, secondColor);
  2241. addProductPage.clickProductLookCheckbox(0);
  2242. });
  2243.  
  2244. it('should add second option', function () {
  2245. addProductPage.fillOptionTitle(1, 'Size');
  2246. addProductPage.fillOptionValue(1, firstSize);
  2247. addProductPage.fillOptionValue(1, secondSize);
  2248. });
  2249.  
  2250. it('should fill variant prices', function () {
  2251. addProductPage.fillVariantPrice(firstVariant, price);
  2252. addProductPage.clickVariantPriceAutofill(firstVariant);
  2253. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  2254. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2255. });
  2256.  
  2257. it('should add images', function () {
  2258. addProductPage.uploadImage(0, firstImage);
  2259. addProductPage.uploadImage(0, secondImage);
  2260. addProductPage.uploadImage(1, firstImage);
  2261. addProductPage.uploadImage(1, secondImage);
  2262. });
  2263.  
  2264. it('should publish product', function () {
  2265. addProductPage.clickPublish();
  2266. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2267. });
  2268.  
  2269. it('should show product image', function () {
  2270. commonHelper.waitUntilElementVisible(productListPage.productImage(productTitle));
  2271. });
  2272.  
  2273. it('should show product page after click on product link', function () {
  2274. productListPage.clickProduct(productTitle);
  2275. });
  2276.  
  2277. it('should show main product image', function () {
  2278. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2279. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  2280. });
  2281.  
  2282. it('should show correct product price', function () {
  2283. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  2284. });
  2285.  
  2286. it('should show correct product compare price', function () {
  2287. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  2288. });
  2289.  
  2290. it('should show correct product name', function () {
  2291. expect(productPage.productTitle()).toEqual(productTitle);
  2292. });
  2293.  
  2294. it('should show correct number of thumbs', function () {
  2295. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  2296. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  2297. browser.sleep(1000);
  2298. expect(productPage.allThumbs.count()).toEqual(2);
  2299. });
  2300.  
  2301. it('should select 1 product', function () {
  2302. productPage.clickUp(1);
  2303. });
  2304.  
  2305. it('should click add to cart button', function () {
  2306. productPage.clickAddToCart();
  2307. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  2308. });
  2309.  
  2310. it('should show correct total price in cart', function () {
  2311. expect(cartPage.totalPrice()).toEqual('25.00');
  2312. });
  2313.  
  2314. it('should click checkout button', function () {
  2315. cartPage.clickCheckout();
  2316. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2317. });
  2318.  
  2319. it('should show correct product', function () {
  2320. expect(checkoutPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2321. });
  2322.  
  2323. it('should show product images', function () {
  2324. expect(checkoutPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2325. });
  2326.  
  2327. it('should show correct prices for products', function () {
  2328. expect(checkoutPage.productPrice(productTitle)).toEqual('$25.00 x 1');
  2329. });
  2330.  
  2331. it('should show correct subtotals for products', function () {
  2332. expect(checkoutPage.productSubtotal(productTitle)).toEqual('$25.00');
  2333. });
  2334.  
  2335. it('should fill email address', function () {
  2336. checkoutPage.fillEmailAddress(emailAddress);
  2337. });
  2338.  
  2339. it('should fill contact information form', function () {
  2340. checkoutPage.selectCountry(country);
  2341. checkoutPage.selectState(city);
  2342. checkoutPage.fillCity(city);
  2343. checkoutPage.fillZip(zip);
  2344. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  2345. checkoutPage.fillFirstName(firstName);
  2346. checkoutPage.fillLastName(lastName);
  2347. checkoutPage.fillStreetAddress(streetAddress);
  2348. checkoutPage.fillSuite(suite);
  2349. checkoutPage.fillPhone(phone);
  2350. });
  2351.  
  2352. it('should fill payment form', function () {
  2353. checkoutPage.fillCardNumberField(cardNumber);
  2354. checkoutPage.fillCardNameField(cardName);
  2355. checkoutPage.fillCardDateField(cardDate);
  2356. checkoutPage.fillCVVField(cardCVV);
  2357. });
  2358.  
  2359. it('should show correct prices', function () {
  2360. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  2361. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  2362. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  2363. expect(checkoutPage.taxes()).toEqual('$0.00');
  2364. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  2365. });
  2366.  
  2367. it('should click complete order', function () {
  2368. checkoutPage.clickCompleteOrder();
  2369. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  2370. });
  2371.  
  2372. it('should save order number', function () {
  2373. checkoutPage.txtOrder.getText().then(function (value) {
  2374. orderNumber = value.split(' ')[1];
  2375. });
  2376. });
  2377.  
  2378. it('should redirect on admin dashboard page', function () {
  2379. browser.get(storeLink + '/admin');
  2380. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2381. });
  2382.  
  2383. it('should open orders list', function () {
  2384. dashboardPage.openOrdersPage();
  2385. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2386. });
  2387.  
  2388. it('should show last order in the first row', function () {
  2389. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  2390. });
  2391.  
  2392. it('should open needed order', function () {
  2393. ordersPage.clickOrderEntry(orderNumber);
  2394. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2395. });
  2396.  
  2397. it('should show correct products', function () {
  2398. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2399. });
  2400.  
  2401. it('should show product image', function () {
  2402. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2403. });
  2404.  
  2405. it('should show correct order price', function () {
  2406. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2407. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  2408. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2409. expect(ordersPage.taxes()).toEqual('$0.00');
  2410. expect(ordersPage.totalPrice()).toEqual('$35.00');
  2411. });
  2412.  
  2413. it('should redirect on admin dashboard page after login', function () {
  2414. browser.get(storeLink + '/admin');
  2415. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2416. });
  2417.  
  2418. it('should open products list page', function () {
  2419. dashboardPage.openProductListPage();
  2420. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2421. });
  2422.  
  2423. it('should open edit product', function () {
  2424. productListPage.editProduct(productTitle);
  2425. addProductPage.waitForSaveButton();
  2426. });
  2427.  
  2428. it('should edit product prices and title', function () {
  2429. addProductPage.fillTitle(secondProductTitle);
  2430. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  2431. addProductPage.clickVariantPriceAutofill(firstVariant);
  2432. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  2433. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2434. });
  2435.  
  2436. it('should delete old pictures', function () {
  2437. addProductPage.deleteImage(1);
  2438. addProductPage.deleteImage(1);
  2439. });
  2440.  
  2441. it('should add another pictures', function () {
  2442. addProductPage.uploadImage(1, thirdImage);
  2443. addProductPage.uploadImage(1, secondImage);
  2444. });
  2445.  
  2446. it('should save product', function () {
  2447. addProductPage.clickSave();
  2448. commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  2449. });
  2450.  
  2451. it('should redirect on admin dashboard page', function () {
  2452. browser.get(signInData.link);
  2453. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2454. });
  2455.  
  2456. it('should open orders list', function () {
  2457. dashboardPage.openOrdersPage();
  2458. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2459. });
  2460.  
  2461. it('should open needed order', function () {
  2462. ordersPage.clickOrderEntry(orderNumber);
  2463. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2464. });
  2465.  
  2466. it('should show correct products', function () {
  2467. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2468. });
  2469.  
  2470. it('should show product image', function () {
  2471. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2472. });
  2473.  
  2474. it('should show correct order price', function () {
  2475. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2476. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  2477. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2478. expect(ordersPage.taxes()).toEqual('$0.00');
  2479. expect(ordersPage.totalPrice()).toEqual('$35.00');
  2480. });
  2481.  
  2482. it('should redirect on admin dashboard page after login', function () {
  2483. browser.get(storeLink + '/admin');
  2484. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2485. });
  2486.  
  2487. it('should open products list page', function () {
  2488. dashboardPage.openProductListPage();
  2489. commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  2490. });
  2491.  
  2492. it('should show product page after click on product link', function () {
  2493. productListPage.clickProduct(secondProductTitle);
  2494. });
  2495.  
  2496. it('should show main product image', function () {
  2497. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2498. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  2499. });
  2500.  
  2501. it('should show correct product price', function () {
  2502. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  2503. });
  2504.  
  2505. it('should show correct product compare price', function () {
  2506. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  2507. });
  2508.  
  2509. it('should show correct product name', function () {
  2510. expect(productPage.productTitle()).toEqual(secondProductTitle);
  2511. });
  2512.  
  2513. it('should show correct number of thumbs', function () {
  2514. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  2515. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  2516. browser.sleep(1000);
  2517. expect(productPage.allThumbs.count()).toEqual(2);
  2518. });
  2519.  
  2520. it('should select 1 product', function () {
  2521. productPage.clickUp(1);
  2522. });
  2523.  
  2524. it('should click add to cart button', function () {
  2525. productPage.clickAddToCart();
  2526. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  2527. });
  2528.  
  2529. it('should show correct total price in cart', function () {
  2530. expect(cartPage.totalPrice()).toEqual('30.00');
  2531. });
  2532.  
  2533. it('should click checkout button', function () {
  2534. cartPage.clickCheckout();
  2535. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2536. });
  2537.  
  2538. it('should show correct product', function () {
  2539. expect(checkoutPage.productName(secondProductTitle).isDisplayed()).toBeTruthy();
  2540. });
  2541.  
  2542. it('should show product images', function () {
  2543. expect(checkoutPage.productImage(secondProductTitle).isDisplayed()).toBeTruthy();
  2544. });
  2545.  
  2546. it('should show correct prices for products', function () {
  2547. expect(checkoutPage.productPrice(secondProductTitle)).toEqual('$30.00 x 1');
  2548. });
  2549.  
  2550. it('should show correct subtotals for products', function () {
  2551. expect(checkoutPage.productSubtotal(secondProductTitle)).toEqual('$30.00');
  2552. });
  2553. });
  2554.  
  2555. describe('checking for delete purchased variant from product and then checking effect on existing orders with it', function () {
  2556.  
  2557. var productTitle = commonHelper.uniqueProductName('editm20') + unique_value;
  2558.  
  2559. var secondPrice = '$30.00';
  2560. var secondComparePrice = '$35.00';
  2561. var thirdPrice = '$35.00';
  2562. var thirdComparePrice = '$40.00';
  2563.  
  2564. var orderNumber;
  2565.  
  2566. beforeAll(function () {
  2567. commonHelper.acceptAlert();
  2568. });
  2569.  
  2570. afterAll(function () {
  2571. commonHelper.clearAllData();
  2572. });
  2573.  
  2574. it('should redirect on dashboard page after login', function () {
  2575. browser.get(storeLink + '/admin');
  2576. signInPage.login(username, password);
  2577. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2578. });
  2579.  
  2580. it('should redirect on add product page', function () {
  2581. browser.get(addProductLink);
  2582. addProductPage.waitForPublishButton();
  2583. });
  2584.  
  2585. it('should select multi variant', function () {
  2586. addProductPage.clickMulti();
  2587. });
  2588.  
  2589. it('should fill new product form', function () {
  2590. addProductPage.selectType(type);
  2591. addProductPage.selectFirstCollection();
  2592. addProductPage.fillTitle(productTitle);
  2593. addProductPage.fillShippingWeight(weight);
  2594. addProductPage.addTag(tag);
  2595. });
  2596.  
  2597. it('should add first option', function () {
  2598. addProductPage.fillOptionTitle(0, 'Color');
  2599. addProductPage.fillOptionValue(0, firstColor);
  2600. addProductPage.fillOptionValue(0, secondColor);
  2601. addProductPage.clickProductLookCheckbox(0);
  2602. });
  2603.  
  2604. it('should add second option', function () {
  2605. addProductPage.fillOptionTitle(1, 'Size');
  2606. addProductPage.fillOptionValue(1, firstSize);
  2607. addProductPage.fillOptionValue(1, secondSize);
  2608. });
  2609.  
  2610. it('should fill first variant', function () {
  2611. addProductPage.fillVariantPrice(firstVariant, price);
  2612. addProductPage.clickVariantPriceAutofill(firstVariant);
  2613. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  2614. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2615. });
  2616.  
  2617. it('should add images', function () {
  2618. addProductPage.uploadImage(0, firstImage);
  2619. addProductPage.uploadImage(0, secondImage);
  2620. addProductPage.uploadImage(1, firstImage);
  2621. addProductPage.uploadImage(1, secondImage);
  2622. });
  2623.  
  2624. it('should publish product', function () {
  2625. addProductPage.clickPublish();
  2626. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2627. });
  2628.  
  2629. it('should show product image', function () {
  2630. commonHelper.waitUntilElementVisible(productListPage.productImage(productTitle));
  2631. });
  2632.  
  2633. it('should show product page after click on product link', function () {
  2634. productListPage.clickProduct(productTitle);
  2635. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2636. });
  2637.  
  2638. it('should show main product image', function () {
  2639. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2640. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  2641. });
  2642.  
  2643. it('should select 1 product', function () {
  2644. productPage.clickUp(1);
  2645. });
  2646.  
  2647. it('should click add to cart button', function () {
  2648. productPage.clickAddToCart();
  2649. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  2650. });
  2651.  
  2652. it('should click checkout button', function () {
  2653. cartPage.clickCheckout();
  2654. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2655. });
  2656.  
  2657. it('should fill email address', function () {
  2658. checkoutPage.fillEmailAddress(emailAddress);
  2659. });
  2660.  
  2661. it('should fill contact information form', function () {
  2662. checkoutPage.selectCountry(country);
  2663. checkoutPage.selectState(city);
  2664. checkoutPage.fillCity(city);
  2665. checkoutPage.fillZip(zip);
  2666. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  2667. checkoutPage.fillFirstName(firstName);
  2668. checkoutPage.fillLastName(lastName);
  2669. checkoutPage.fillStreetAddress(streetAddress);
  2670. checkoutPage.fillSuite(suite);
  2671. checkoutPage.fillPhone(phone);
  2672. });
  2673.  
  2674. it('should fill payment form', function () {
  2675. checkoutPage.fillCardNumberField(cardNumber);
  2676. checkoutPage.fillCardNameField(cardName);
  2677. checkoutPage.fillCardDateField(cardDate);
  2678. checkoutPage.fillCVVField(cardCVV);
  2679. });
  2680.  
  2681. it('should show correct prices', function () {
  2682. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  2683. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  2684. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  2685. expect(checkoutPage.taxes()).toEqual('$0.00');
  2686. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  2687. });
  2688.  
  2689. it('should click complete order', function () {
  2690. checkoutPage.clickCompleteOrder();
  2691. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  2692. });
  2693.  
  2694. it('should save order number', function () {
  2695. checkoutPage.txtOrder.getText().then(function (value) {
  2696. orderNumber = value.split(' ')[1];
  2697. });
  2698. });
  2699.  
  2700. it('should redirect on admin dashboard page after login', function () {
  2701. browser.get(storeLink + '/admin');
  2702. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2703. });
  2704.  
  2705. it('should open orders list', function () {
  2706. dashboardPage.openOrdersPage();
  2707. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2708. });
  2709.  
  2710. it('should show last order in the first row', function () {
  2711. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  2712. });
  2713.  
  2714. it('should open needed order', function () {
  2715. ordersPage.clickOrderEntry(orderNumber);
  2716. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2717. });
  2718.  
  2719. it('should show correct products', function () {
  2720. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2721. });
  2722.  
  2723. it('should show product image', function () {
  2724. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2725. });
  2726.  
  2727. it('should show correct order price', function () {
  2728. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2729. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  2730. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2731. expect(ordersPage.taxes()).toEqual('$0.00');
  2732. expect(ordersPage.totalPrice()).toEqual('$35.00');
  2733. });
  2734.  
  2735. it('should switch to previous tab', function () {
  2736. commonHelper.switchToPreviousTab();
  2737. });
  2738.  
  2739. it('should redirect on admin dashboard page after login', function () {
  2740. browser.get(storeLink + '/admin');
  2741. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2742. });
  2743.  
  2744. it('should open products list page', function () {
  2745. dashboardPage.openProductListPage();
  2746. });
  2747.  
  2748. it('should open edit product', function () {
  2749. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2750. productListPage.editProduct(productTitle);
  2751. addProductPage.waitForSaveButton();
  2752. });
  2753.  
  2754. it('should delete product colors and sizes', function () {
  2755. addProductPage.clickDeleteCollection(firstColor);
  2756. addProductPage.clickDeleteCollection(secondColor);
  2757. addProductPage.clickDeleteCollection(firstSize);
  2758. addProductPage.clickDeleteCollection(secondSize);
  2759. });
  2760.  
  2761. it('should add first option', function () {
  2762. addProductPage.fillOptionValue(0, secondColor);
  2763. addProductPage.fillOptionValue(0, thirdColor);
  2764. });
  2765.  
  2766. it('should add second option', function () {
  2767. addProductPage.fillOptionValue(1, secondSize);
  2768. addProductPage.fillOptionValue(1, thirdSize);
  2769. });
  2770.  
  2771. it('should add pictures for first color', function () {
  2772. addProductPage.uploadImage(0, firstImage);
  2773. addProductPage.uploadImage(0, secondImage);
  2774. });
  2775.  
  2776. it('should add pictures for second color', function () {
  2777. addProductPage.uploadImage(1, thirdImage);
  2778. addProductPage.uploadImage(1, secondImage);
  2779. });
  2780.  
  2781. it('should fill first variant', function () {
  2782. var firstVariant = secondColor + ' / ' + secondSize;
  2783. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  2784. addProductPage.clickVariantPriceAutofill(firstVariant);
  2785. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  2786. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2787. });
  2788.  
  2789. it('should save product', function () {
  2790. addProductPage.clickSave();
  2791. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2792. });
  2793.  
  2794. it('should redirect on admin dashboard page after login', function () {
  2795. browser.get(storeLink + '/admin');
  2796. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2797. });
  2798.  
  2799. it('should open orders list', function () {
  2800. dashboardPage.openOrdersPage();
  2801. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2802. });
  2803.  
  2804. it('should show last order in the first row', function () {
  2805. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  2806. });
  2807.  
  2808. it('should open needed order', function () {
  2809. ordersPage.clickOrderEntry(orderNumber);
  2810. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2811. });
  2812.  
  2813. it('should show correct products', function () {
  2814. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2815. });
  2816.  
  2817. it('should show correct order price', function () {
  2818. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2819. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  2820. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2821. expect(ordersPage.taxes()).toEqual('$0.00');
  2822. expect(ordersPage.totalPrice()).toEqual('$35.00');
  2823. });
  2824.  
  2825. it('should open products list page', function () {
  2826. dashboardPage.openProductListPage();
  2827. });
  2828.  
  2829. it('should show product page after click on product link', function () {
  2830. productListPage.clickProduct(productTitle);
  2831. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2832. });
  2833.  
  2834. it('should show main product image', function () {
  2835. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2836. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  2837. });
  2838.  
  2839. it('should select 1 product', function () {
  2840. productPage.clickUp(1);
  2841. });
  2842.  
  2843. it('should click add to cart button', function () {
  2844. productPage.clickAddToCart();
  2845. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  2846. });
  2847.  
  2848. it('should click checkout button', function () {
  2849. cartPage.clickCheckout();
  2850. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2851. });
  2852.  
  2853. it('should show correct product', function () {
  2854. expect(checkoutPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2855. });
  2856.  
  2857. it('should show product images', function () {
  2858. expect(checkoutPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2859. });
  2860.  
  2861. it('should show correct prices for products', function () {
  2862. expect(checkoutPage.productPrice(productTitle)).toEqual('$30.00 x 1');
  2863. });
  2864.  
  2865. it('should show correct subtotals for products', function () {
  2866. expect(checkoutPage.productSubtotal(productTitle)).toEqual('$30.00');
  2867. commonHelper.switchToPreviousTab();
  2868. });
  2869.  
  2870. it('should open products list page', function () {
  2871. commonHelper.switchToPreviousTab();
  2872. dashboardPage.openProductListPage();
  2873. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2874. });
  2875.  
  2876. it('should open edit product', function () {
  2877. productListPage.editProduct(productTitle);
  2878. addProductPage.waitForSaveButton();
  2879. });
  2880.  
  2881. it('should delete old options', function () {
  2882. addProductPage.clickDeleteOption(1);
  2883. addProductPage.clickDeleteOption(0);
  2884. });
  2885.  
  2886. it('should add second option', function () {
  2887. addProductPage.clickAddOption();
  2888. addProductPage.fillOptionTitle(0, 'Style');
  2889. addProductPage.fillOptionValue(0, firstStyle);
  2890. addProductPage.fillOptionValue(0, secondStyle);
  2891. addProductPage.clickProductLookCheckbox(0);
  2892. });
  2893.  
  2894. it('should add third option', function () {
  2895. addProductPage.clickAddOption();
  2896. addProductPage.fillOptionTitle(1, 'Material');
  2897. addProductPage.fillOptionValue(1, firstMaterial);
  2898. addProductPage.fillOptionValue(1, secondMaterial);
  2899. });
  2900.  
  2901. it('should add pictures for t-shirt', function () {
  2902. addProductPage.uploadImage(0, firstImage);
  2903. addProductPage.uploadImage(0, secondImage);
  2904. addProductPage.uploadImage(1, thirdImage);
  2905. addProductPage.uploadImage(1, firstImage);
  2906. });
  2907.  
  2908. it('should fill sixth variant', function () {
  2909. var firstVariant = firstStyle + ' / ' + firstMaterial;
  2910. addProductPage.fillVariantPrice(firstVariant, thirdPrice);
  2911. addProductPage.clickVariantPriceAutofill(firstVariant);
  2912. addProductPage.fillVariantComparePrice(firstVariant, thirdComparePrice);
  2913. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  2914. });
  2915.  
  2916. it('should save product', function () {
  2917. addProductPage.clickSave();
  2918. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2919. });
  2920.  
  2921. it('should redirect on admin dashboard page after login', function () {
  2922. browser.get(storeLink + '/admin');
  2923. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2924. });
  2925.  
  2926. it('should open orders list', function () {
  2927. dashboardPage.openOrdersPage();
  2928. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2929. });
  2930.  
  2931. it('should show last order in the first row', function () {
  2932. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  2933. });
  2934.  
  2935. it('should open needed order', function () {
  2936. ordersPage.clickOrderEntry(orderNumber);
  2937. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2938. });
  2939.  
  2940. it('should show new correct products', function () {
  2941. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  2942. });
  2943.  
  2944. it('should show product image', function () {
  2945. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  2946. });
  2947.  
  2948. it('should show correct order price', function () {
  2949. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2950. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  2951. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2952. expect(ordersPage.taxes()).toEqual('$0.00');
  2953. expect(ordersPage.totalPrice()).toEqual('$35.00');
  2954. });
  2955.  
  2956. it('should open products list page', function () {
  2957. dashboardPage.openProductListPage();
  2958. });
  2959.  
  2960. it('should show product page after click on product link', function () {
  2961. productListPage.clickProduct(productTitle);
  2962. });
  2963.  
  2964. it('should show main product image', function () {
  2965. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  2966. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  2967. });
  2968.  
  2969. it('should show correct product price', function () {
  2970. expect(productPage.productPrice()).toEqual(thirdPrice.replace('$', ''));
  2971. });
  2972.  
  2973. it('should show correct product compare price', function () {
  2974. expect(productPage.productComparePrice()).toEqual(thirdComparePrice.replace('$', ''));
  2975. });
  2976.  
  2977. it('should show correct product name', function () {
  2978. expect(productPage.productTitle()).toEqual(productTitle);
  2979. });
  2980.  
  2981. it('should show correct number of thumbs', function () {
  2982. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  2983. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  2984. browser.sleep(1000);
  2985. expect(productPage.allThumbs.count()).toEqual(2);
  2986. });
  2987.  
  2988. it('should select 1 product', function () {
  2989. productPage.clickUp(1);
  2990. });
  2991.  
  2992. it('should click add to cart button', function () {
  2993. productPage.clickAddToCart();
  2994. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  2995. });
  2996.  
  2997. it('should click checkout button', function () {
  2998. cartPage.clickCheckout();
  2999. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  3000. });
  3001.  
  3002. it('should show correct product', function () {
  3003. expect(checkoutPage.productName(productTitle).isDisplayed()).toBeTruthy();
  3004. });
  3005.  
  3006. it('should show product images', function () {
  3007. expect(checkoutPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  3008. });
  3009.  
  3010. it('should show correct prices for products', function () {
  3011. expect(checkoutPage.productPrice(productTitle)).toEqual('$35.00 x 1');
  3012. });
  3013.  
  3014. it('should show correct subtotals for products', function () {
  3015. expect(checkoutPage.productSubtotal(productTitle)).toEqual('$35.00');
  3016. });
  3017. });
  3018.  
  3019. describe('multi-variant product edit image order', function () {
  3020.  
  3021. var title = commonHelper.uniqueProductName('editm21') + unique_value;
  3022. var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
  3023.  
  3024. beforeAll(function () {
  3025. commonHelper.acceptAlert();
  3026. });
  3027.  
  3028. afterAll(function () {
  3029. commonHelper.clearAllData();
  3030. });
  3031.  
  3032. it('should redirect on dashboard page after login', function () {
  3033. browser.get(storeLink + '/admin');
  3034. signInPage.login(username, password);
  3035. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3036. });
  3037.  
  3038. it('should redirect on add product page', function () {
  3039. browser.get(addProductLink);
  3040. addProductPage.waitForPublishButton();
  3041. });
  3042.  
  3043. it('should select multi variant option', function () {
  3044. addProductPage.clickMulti();
  3045. });
  3046.  
  3047. it('should fill new product form', function () {
  3048. addProductPage.selectType(type);
  3049. addProductPage.selectFirstCollection();
  3050. addProductPage.fillTitle(title);
  3051. });
  3052.  
  3053. it('should add first option', function () {
  3054. addProductPage.fillOptionTitle(0, 'Color');
  3055. addProductPage.fillOptionValue(0, firstColor);
  3056. });
  3057.  
  3058. it('should add second option', function () {
  3059. addProductPage.fillOptionTitle(1, 'Size');
  3060. addProductPage.fillOptionValue(1, firstSize);
  3061. addProductPage.fillOptionValue(1, secondSize);
  3062. });
  3063.  
  3064. it('should fill first and second variant prices', function () {
  3065. addProductPage.fillVariantPrice(firstVariant, price);
  3066. addProductPage.clickVariantPriceAutofill(firstVariant);
  3067. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  3068. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3069. });
  3070.  
  3071. it('should add some images', function () {
  3072. addProductPage.uploadImage(0, firstImage);
  3073. addProductPage.uploadImage(0, secondImage);
  3074. });
  3075.  
  3076. it('should publish product', function () {
  3077. addProductPage.clickPublish();
  3078. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3079. });
  3080.  
  3081. it('should save thumbnail source', function () {
  3082. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  3083. productListPage.productImage(title).getAttribute('style').then(function (value) {
  3084. firstThumbnail = value;
  3085. });
  3086. });
  3087.  
  3088. it('should edit product', function () {
  3089. commonHelper.switchToPreviousTab();
  3090. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3091. productListPage.editProduct(title);
  3092. addProductPage.waitForSaveButton();
  3093. });
  3094.  
  3095. it('should change order for images', function () {
  3096. addProductPage.dragAndDropImage(1, 2);
  3097. });
  3098.  
  3099. it('should save product', function () {
  3100. addProductPage.clickSave();
  3101. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3102. });
  3103.  
  3104. it('should save thumbnail source', function () {
  3105. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  3106. productListPage.productImage(title).getAttribute('style').then(function (value) {
  3107. secondThumbnail = value;
  3108. });
  3109. });
  3110.  
  3111. it('should open product page', function () {
  3112. productListPage.clickProduct(title);
  3113. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  3114. });
  3115.  
  3116. it('should save main image source', function () {
  3117. productPage.eleProductImage.getAttribute('src').then(function (value) {
  3118. secondProductImage = value;
  3119. });
  3120. commonHelper.switchToPreviousTab();
  3121. });
  3122.  
  3123. it('should see image changes', function () {
  3124. expect(firstThumbnail).not.toEqual(secondThumbnail);
  3125. expect(firstProductImage).not.toEqual(secondProductImage);
  3126. });
  3127. });
  3128.  
  3129. // describe('checking for edit multi variant product price and checking effect on cart and checkout on fes', function () {
  3130. //
  3131. // var productTitle = commonHelper.uniqueProductName('editm20') + unique_value;
  3132. //
  3133. // var firstPrice = '$10.00';
  3134. // var firstComparePrice = '$10.00';
  3135. // var secondPrice = '$20.00';
  3136. // var secondComparePrice = '$20.00';
  3137. // var thirdPrice = '$30.00';
  3138. // var thirdComparePrice = '$30.00';
  3139. //
  3140. // var orderNumber;
  3141. //
  3142. // beforeAll(function () {
  3143. // commonHelper.acceptAlert();
  3144. // });
  3145. //
  3146. // afterAll(function () {
  3147. // commonHelper.clearAllData();
  3148. // });
  3149. //
  3150. // it('should redirect on dashboard page after login', function () {
  3151. // browser.get(storeLink + '/admin');
  3152. // signInPage.login(username, password);
  3153. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3154. // });
  3155. //
  3156. // it('should redirect on add product page', function () {
  3157. // browser.get(addProductLink);
  3158. // addProductPage.waitForPublishButton();
  3159. // });
  3160. //
  3161. // it('should select multi variant', function () {
  3162. // addProductPage.clickMulti();
  3163. // });
  3164. //
  3165. // it('should fill new product form', function () {
  3166. // addProductPage.selectType(type);
  3167. // addProductPage.selectFirstCollection();
  3168. // addProductPage.fillTitle(productTitle);
  3169. // addProductPage.fillShippingWeight(weight);
  3170. // addProductPage.addTag(tag);
  3171. // });
  3172. //
  3173. // it('should add first option', function () {
  3174. // addProductPage.fillOptionTitle(0, 'Color');
  3175. // addProductPage.fillOptionValue(0, firstColor);
  3176. // addProductPage.fillOptionValue(0, secondColor);
  3177. // addProductPage.clickProductLookCheckbox(0);
  3178. // });
  3179. //
  3180. // it('should add second option', function () {
  3181. // addProductPage.fillOptionTitle(1, 'Size');
  3182. // addProductPage.fillOptionValue(1, firstSize);
  3183. // addProductPage.fillOptionValue(1, secondSize);
  3184. // });
  3185. //
  3186. // it('should fill first variant', function () {
  3187. // addProductPage.fillVariantPrice(firstVariant, firstPrice);
  3188. // addProductPage.clickVariantPriceAutofill(firstVariant);
  3189. // addProductPage.fillVariantComparePrice(firstVariant, firstComparePrice);
  3190. // addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3191. // });
  3192. //
  3193. // it('should add images for red and blue', function () {
  3194. // addProductPage.uploadImage(0, firstImage);
  3195. // addProductPage.uploadImage(0, secondImage);
  3196. // addProductPage.uploadImage(1, firstImage);
  3197. // addProductPage.uploadImage(1, secondImage);
  3198. // });
  3199. //
  3200. // it('should publish product', function () {
  3201. // addProductPage.clickPublish();
  3202. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  3203. // });
  3204. //
  3205. // it('should show product image', function () {
  3206. // commonHelper.waitUntilElementVisible(productListPage.productImage(productTitle));
  3207. // });
  3208. //
  3209. // it('should show product page after click on product link', function () {
  3210. // productListPage.clickProduct(productTitle);
  3211. // commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3212. // });
  3213. //
  3214. // it('should select 1 product', function () {
  3215. // productPage.clickUp(1);
  3216. // });
  3217. //
  3218. // it('should click add to cart button before switch', function () {
  3219. // productPage.clickAddToCart();
  3220. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  3221. // });
  3222. //
  3223. // it('should show correct total price in cart', function () {
  3224. // expect(cartPage.totalPrice()).toEqual('10.00');
  3225. // });
  3226. //
  3227. // it('should go to previous tab', function () {
  3228. // commonHelper.switchToPreviousWithoutClose();
  3229. // });
  3230. //
  3231. // it('should open edit product', function () {
  3232. // productListPage.editProduct(productTitle);
  3233. // addProductPage.waitForSaveButton();
  3234. // });
  3235. //
  3236. // it('should fill first and second variant prices', function () {
  3237. // addProductPage.fillVariantPrice(firstVariant, secondPrice);
  3238. // addProductPage.clickVariantPriceAutofill(firstVariant);
  3239. // addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  3240. // addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3241. // });
  3242. //
  3243. // it('should save product', function () {
  3244. // addProductPage.clickSave();
  3245. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  3246. // });
  3247. //
  3248. // it('should go to next tab', function () {
  3249. // commonHelper.switchToNextTab();
  3250. // });
  3251. //
  3252. // it('should click checkout button', function () {
  3253. // cartPage.clickCheckout();
  3254. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  3255. // });
  3256. //
  3257. // it('should show correct product', function () {
  3258. // expect(checkoutPage.productName(productTitle).isDisplayed()).toBeTruthy();
  3259. // });
  3260. //
  3261. // it('should show product images', function () {
  3262. // expect(checkoutPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  3263. // });
  3264. //
  3265. // it('should show correct prices for products', function () {
  3266. // expect(checkoutPage.productPrice(productTitle)).toEqual('$20.00 x 1');
  3267. // });
  3268. //
  3269. // it('should show correct subtotals for products', function () {
  3270. // expect(checkoutPage.productSubtotal(productTitle)).toEqual('$20.00');
  3271. // });
  3272. //
  3273. // it('should go to previous tab', function () {
  3274. // commonHelper.switchToPreviousWithoutClose();
  3275. // });
  3276. //
  3277. // it('should open 3 edit product', function () {
  3278. // productListPage.editProduct(productTitle);
  3279. // addProductPage.waitForSaveButton();
  3280. // });
  3281. //
  3282. // it('should fill first and second variant prices', function () {
  3283. // addProductPage.fillVariantPrice(firstVariant, thirdPrice);
  3284. // addProductPage.clickVariantPriceAutofill(firstVariant);
  3285. // addProductPage.fillVariantComparePrice(firstVariant, thirdComparePrice);
  3286. // addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3287. // });
  3288. //
  3289. // it('should save product', function () {
  3290. // addProductPage.clickSave();
  3291. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  3292. // });
  3293. //
  3294. // it('should go to next tab', function () {
  3295. // commonHelper.switchToNextTab();
  3296. // });
  3297. //
  3298. // it('should show correct product', function () {
  3299. // expect(checkoutPage.productName(productTitle).isDisplayed()).toBeTruthy();
  3300. // });
  3301. //
  3302. // it('should show product images', function () {
  3303. // expect(checkoutPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  3304. // });
  3305. //
  3306. // it('should show correct prices for products', function () {
  3307. // expect(checkoutPage.productPrice(productTitle)).toEqual('$20.00 x 1');
  3308. // });
  3309. //
  3310. // it('should show correct subtotals for products', function () {
  3311. // expect(checkoutPage.productSubtotal(productTitle)).toEqual('$20.00');
  3312. // });
  3313. //
  3314. // it('should fill email address', function () {
  3315. // checkoutPage.fillEmailAddress(emailAddress);
  3316. // });
  3317. //
  3318. // it('should fill contact information form', function () {
  3319. // checkoutPage.selectCountry(country);
  3320. // checkoutPage.selectState(city);
  3321. // checkoutPage.fillCity(city);
  3322. // checkoutPage.fillZip(zip);
  3323. // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  3324. // checkoutPage.fillFirstName(firstName);
  3325. // checkoutPage.fillLastName(lastName);
  3326. // checkoutPage.fillStreetAddress(streetAddress);
  3327. // checkoutPage.fillSuite(suite);
  3328. // checkoutPage.fillPhone(phone);
  3329. // });
  3330. //
  3331. // it('should fill payment form', function () {
  3332. // checkoutPage.fillCardNumberField(cardNumber);
  3333. // checkoutPage.fillCardNameField(cardName);
  3334. // checkoutPage.fillCardDateField(cardDate);
  3335. // checkoutPage.fillCVVField(cardCVV);
  3336. // });
  3337. //
  3338. // it('should show correct prices', function () {
  3339. // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  3340. // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  3341. // expect(checkoutPage.subtotalPrice()).toEqual('$30.00');
  3342. // expect(checkoutPage.taxes()).toEqual('$0.00');
  3343. // expect(checkoutPage.totalPrice()).toEqual('$30.00');
  3344. // });
  3345. //
  3346. // it('should click complete order', function () {
  3347. // checkoutPage.clickCompleteOrder();
  3348. // });
  3349. //
  3350. // it('should show error message', function () {
  3351. // browser.sleep(2000);
  3352. // expect(checkoutPage.chkErrorMessage()).toEqual('Products in your cart have been updated by the store owner, please refresh the page to review the changes');
  3353. // });
  3354. //
  3355. // it('should click complete order', function () {
  3356. // checkoutPage.clickCompleteOrder();
  3357. // commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  3358. // });
  3359. //
  3360. // it('should save order number', function () {
  3361. // checkoutPage.txtOrder.getText().then(function (value) {
  3362. // orderNumber = value.split(' ')[1];
  3363. // });
  3364. // });
  3365. //
  3366. // it('should redirect on admin dashboard page after login', function () {
  3367. // browser.get(storeLink);
  3368. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3369. // });
  3370. //
  3371. // it('should open orders list', function () {
  3372. // dashboardPage.openOrdersPage();
  3373. // commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  3374. // });
  3375. //
  3376. // it('should show last order in the first row', function () {
  3377. // expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  3378. // });
  3379. //
  3380. // it('should open needed order', function () {
  3381. // ordersPage.clickOrderEntry(orderNumber);
  3382. // commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  3383. // });
  3384. //
  3385. // it('should show new correct products', function () {
  3386. // expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  3387. // });
  3388. //
  3389. // it('should show product image', function () {
  3390. // expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  3391. // });
  3392. //
  3393. // it('should show correct order price', function () {
  3394. // commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  3395. // expect(ordersPage.subtotalPrice()).toEqual('$30.00');
  3396. // expect(ordersPage.shippingPrice()).toEqual('$10.00');
  3397. // expect(ordersPage.taxes()).toEqual('$0.00');
  3398. // expect(ordersPage.totalPrice()).toEqual('$40.00');
  3399. // });
  3400. // });
  3401.  
  3402. describe('multi variant product edit description', function () {
  3403.  
  3404. var title = commonHelper.uniqueProductName('editm21') + unique_value;
  3405. var firstDescription = 'first description';
  3406. var secondDescription = 'second description';
  3407.  
  3408. beforeAll(function () {
  3409. commonHelper.acceptAlert();
  3410. });
  3411.  
  3412. afterAll(function () {
  3413. commonHelper.clearAllData();
  3414. });
  3415.  
  3416. it('should redirect on dashboard page after login', function () {
  3417. browser.get(storeLink + '/admin');
  3418. signInPage.login(username, password);
  3419. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3420. });
  3421.  
  3422. it('should redirect on add product page', function () {
  3423. browser.get(addProductLink);
  3424. addProductPage.waitForPublishButton();
  3425. });
  3426.  
  3427. it('should select multi variant', function () {
  3428. addProductPage.clickMulti();
  3429. });
  3430.  
  3431. it('should fill new product form', function () {
  3432. addProductPage.selectType(type);
  3433. addProductPage.selectFirstCollection();
  3434. addProductPage.fillTitle(title);
  3435. addProductPage.fillShippingWeight(weight);
  3436. addProductPage.addTag(tag);
  3437. });
  3438.  
  3439. it('should fill description', function () {
  3440. addProductPage.fillDescription(firstDescription);
  3441. });
  3442.  
  3443. it('should add first option', function () {
  3444. addProductPage.fillOptionTitle(0, 'Color');
  3445. addProductPage.fillOptionValue(0, firstColor);
  3446. addProductPage.fillOptionValue(0, thirdColor);
  3447. addProductPage.clickProductLookCheckbox(0);
  3448. });
  3449.  
  3450. it('should add second option', function () {
  3451. addProductPage.fillOptionTitle(1, 'Size');
  3452. addProductPage.fillOptionValue(1, firstSize);
  3453. addProductPage.fillOptionValue(1, secondSize);
  3454. });
  3455.  
  3456. it('should fill first variant price', function () {
  3457. addProductPage.fillVariantPrice(firstVariant, price);
  3458. addProductPage.clickVariantPriceAutofill(firstVariant);
  3459. addProductPage.fillVariantComparePrice(firstVariant, price);
  3460. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3461. });
  3462.  
  3463. it('should publish product', function () {
  3464. addProductPage.clickPublish();
  3465. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3466. });
  3467.  
  3468. it('should show product page after click on product link', function () {
  3469. productListPage.clickProduct(title);
  3470. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3471. });
  3472.  
  3473. it('should show correct description on product page', function () {
  3474. expect(productPage.productDescription()).toContain(tabName);
  3475. expect(productPage.productDescription()).toContain(firstDescription);
  3476. browser.sleep(5000);
  3477. });
  3478.  
  3479. it('should open edit page for added product', function () {
  3480. commonHelper.switchToPreviousTab();
  3481. productListPage.editProduct(title);
  3482. addProductPage.waitForSaveButton();
  3483. });
  3484.  
  3485. it('should edit description', function () {
  3486. addProductPage.fillDescription(secondDescription);
  3487. });
  3488.  
  3489. it('should save product', function () {
  3490. addProductPage.clickSave();
  3491. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3492. });
  3493.  
  3494. it('should show product page after click on product link', function () {
  3495. productListPage.clickProduct(title);
  3496. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3497. });
  3498.  
  3499. it('should show correct description on product page', function () {
  3500. expect(productPage.productDescription()).toContain(tabName);
  3501. expect(productPage.productDescription()).toContain(secondDescription);
  3502. commonHelper.switchToPreviousTab();
  3503. });
  3504. });
  3505.  
  3506. describe('multi variant product edit to delete all images and add new ones', function () {
  3507.  
  3508. var title = commonHelper.uniqueProductName('editm22') + unique_value;
  3509.  
  3510. beforeAll(function () {
  3511. commonHelper.acceptAlert();
  3512. });
  3513.  
  3514. afterAll(function () {
  3515. commonHelper.clearAllData();
  3516. });
  3517.  
  3518. it('should redirect on dashboard page after login', function () {
  3519. browser.get(storeLink + '/admin');
  3520. signInPage.login(username, password);
  3521. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3522. });
  3523.  
  3524. it('should redirect on add product page', function () {
  3525. browser.get(addProductLink);
  3526. addProductPage.waitForPublishButton();
  3527. });
  3528.  
  3529. it('should select multi variant option', function () {
  3530. addProductPage.clickMulti();
  3531. });
  3532.  
  3533. it('should fill new product form', function () {
  3534. addProductPage.selectType(type);
  3535. addProductPage.selectFirstCollection();
  3536. addProductPage.fillTitle(title);
  3537. });
  3538.  
  3539. it('should add first option', function () {
  3540. addProductPage.fillOptionTitle(0, 'Color');
  3541. addProductPage.fillOptionValue(0, firstColor);
  3542. });
  3543.  
  3544. it('should add second option', function () {
  3545. addProductPage.fillOptionTitle(1, 'Size');
  3546. addProductPage.fillOptionValue(1, firstSize);
  3547. });
  3548.  
  3549. it('should fill variant prices', function () {
  3550. addProductPage.fillVariantPrice(firstVariant, price);
  3551. addProductPage.clickVariantPriceAutofill(firstVariant);
  3552. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  3553. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3554. });
  3555.  
  3556. it('should add images', function () {
  3557. addProductPage.uploadImage(1, firstImage);
  3558. addProductPage.uploadImage(1, secondImage);
  3559. });
  3560.  
  3561. it('should publish product', function () {
  3562. addProductPage.clickPublish();
  3563. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3564. });
  3565.  
  3566. it('should show product page after click on product link', function () {
  3567. productListPage.clickProduct(title);
  3568. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3569. });
  3570.  
  3571. it('should show correct product price', function () {
  3572. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  3573. });
  3574.  
  3575. it('should show correct product compare price', function () {
  3576. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  3577. });
  3578.  
  3579. it('should show correct number of thumbs', function () {
  3580. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  3581. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  3582. browser.sleep(1000);
  3583. expect(productPage.allThumbs.count()).toEqual(2);
  3584. });
  3585.  
  3586. it('should open edit page for added product', function () {
  3587. commonHelper.switchToPreviousTab();
  3588. productListPage.editProduct(title);
  3589. addProductPage.waitForSaveButton();
  3590. });
  3591.  
  3592. it('should delete old images', function () {
  3593. addProductPage.deleteImage(1);
  3594. addProductPage.deleteImage(1);
  3595. });
  3596.  
  3597. it('should add new images', function () {
  3598. addProductPage.uploadImage(1, thirdImage);
  3599. addProductPage.uploadImage(1, secondImage);
  3600. addProductPage.uploadImage(1, thirdImage);
  3601. });
  3602.  
  3603. it('should save product', function () {
  3604. addProductPage.clickSave();
  3605. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3606. });
  3607.  
  3608. it('should show product page after click on product link', function () {
  3609. productListPage.clickProduct(title);
  3610. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3611. });
  3612.  
  3613. it('should show correct product price', function () {
  3614. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  3615. });
  3616.  
  3617. it('should show correct product compare price', function () {
  3618. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  3619. });
  3620.  
  3621. it('should show correct number of thumbs', function () {
  3622. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  3623. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  3624. browser.sleep(1000);
  3625. expect(productPage.allThumbs.count()).toEqual(3);
  3626. });
  3627. });
  3628.  
  3629. describe('multi variant product edit - delete variant that changes product look', function () {
  3630.  
  3631. var title = commonHelper.uniqueProductName('editm23') + unique_value;
  3632. var secondPrice = '$40.00';
  3633. var secondComparePrice = '$50.00';
  3634.  
  3635. beforeAll(function () {
  3636. commonHelper.acceptAlert();
  3637. });
  3638.  
  3639. afterAll(function () {
  3640. commonHelper.clearAllData();
  3641. });
  3642.  
  3643. it('should redirect on dashboard page after login', function () {
  3644. browser.get(storeLink + '/admin');
  3645. signInPage.login(username, password);
  3646. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3647. });
  3648.  
  3649. it('should redirect on add product page', function () {
  3650. browser.get(addProductLink);
  3651. addProductPage.waitForPublishButton();
  3652. });
  3653.  
  3654. it('should select multi variant option', function () {
  3655. addProductPage.clickMulti();
  3656. });
  3657.  
  3658. it('should fill new product form', function () {
  3659. addProductPage.selectType(type);
  3660. addProductPage.selectFirstCollection();
  3661. addProductPage.fillTitle(title);
  3662. });
  3663.  
  3664. it('should add first option', function () {
  3665. addProductPage.fillOptionTitle(0, 'Color');
  3666. addProductPage.fillOptionValue(0, firstColor);
  3667. addProductPage.fillOptionValue(0, secondColor);
  3668. addProductPage.clickProductLookCheckbox(0);
  3669. });
  3670.  
  3671. it('should add second option', function () {
  3672. addProductPage.fillOptionTitle(1, 'Size');
  3673. addProductPage.fillOptionValue(1, firstSize);
  3674. addProductPage.fillOptionValue(1, secondSize);
  3675. addProductPage.clickProductLookCheckbox(1);
  3676. });
  3677.  
  3678. it('should add third option', function () {
  3679. addProductPage.clickAddOption();
  3680. addProductPage.fillOptionTitle(2, 'Style');
  3681. addProductPage.fillOptionValue(2, firstStyle);
  3682. addProductPage.fillOptionValue(2, secondStyle);
  3683. });
  3684.  
  3685. it('should fill first variant', function () {
  3686. var firstVariant = firstColor + ' / ' + firstSize + ' / ' + firstStyle;
  3687. addProductPage.fillVariantPrice(firstVariant, price);
  3688. addProductPage.clickVariantPriceAutofill(firstVariant);
  3689. addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  3690. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3691. });
  3692.  
  3693. it('should add images', function () {
  3694. addProductPage.uploadImage(0, firstImage);
  3695. addProductPage.uploadImage(0, firstImage);
  3696. addProductPage.uploadImage(1, secondImage);
  3697. addProductPage.uploadImage(1, firstImage);
  3698. addProductPage.uploadImage(2, thirdImage);
  3699. addProductPage.uploadImage(2, firstImage);
  3700. addProductPage.uploadImage(3, firstImage);
  3701. addProductPage.uploadImage(3, thirdImage);
  3702. });
  3703.  
  3704. it('should publish product', function () {
  3705. addProductPage.clickPublish();
  3706. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3707. });
  3708.  
  3709. it('should show product page after click on product link', function () {
  3710. productListPage.clickProduct(title);
  3711. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3712. });
  3713.  
  3714. it('should show add to cart button', function () {
  3715. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3716. });
  3717.  
  3718. it('should show correct product price', function () {
  3719. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  3720. });
  3721.  
  3722. it('should show correct product compare price', function () {
  3723. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  3724. });
  3725.  
  3726. it('should show correct number of thumbs', function () {
  3727. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  3728. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  3729. browser.sleep(1000);
  3730. expect(productPage.allThumbs.count()).toEqual(2);
  3731. });
  3732.  
  3733. it('should open edit page for added product', function () {
  3734. commonHelper.switchToPreviousTab();
  3735. productListPage.editProduct(title);
  3736. addProductPage.waitForSaveButton();
  3737. });
  3738.  
  3739. it('should delete variant that changes product', function () {
  3740. addProductPage.clickDeleteOption(1);
  3741. });
  3742.  
  3743. it('should fill first variant', function () {
  3744. var firstVariant = firstColor + ' / ' + firstStyle;
  3745. addProductPage.fillVariantPrice(firstVariant, secondPrice);
  3746. addProductPage.clickVariantPriceAutofill(firstVariant);
  3747. addProductPage.fillVariantComparePrice(firstVariant, secondComparePrice);
  3748. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3749. });
  3750.  
  3751. it('should add images', function () {
  3752. addProductPage.uploadImage(0, firstImage);
  3753. addProductPage.uploadImage(0, firstImage);
  3754. addProductPage.uploadImage(1, secondImage);
  3755. addProductPage.uploadImage(1, firstImage);
  3756. });
  3757.  
  3758. it('should save product', function () {
  3759. addProductPage.clickSave();
  3760. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  3761. });
  3762.  
  3763. it('should show product page after click on product link', function () {
  3764. productListPage.clickProduct(title);
  3765. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3766. });
  3767.  
  3768. it('should show main product image', function () {
  3769. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3770. });
  3771.  
  3772. it('should show correct product price', function () {
  3773. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  3774. });
  3775.  
  3776. it('should show correct product compare price', function () {
  3777. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  3778. });
  3779.  
  3780. it('should show correct number of thumbs', function () {
  3781. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  3782. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  3783. browser.sleep(1000);
  3784. expect(productPage.allThumbs.count()).toEqual(2);
  3785. });
  3786.  
  3787. it('should not see size', function () {
  3788. expect(productPage.selField('Size').isPresent()).toBeFalsy();
  3789. });
  3790. });
  3791.  
  3792. // describe('checking for delete purchased variant from product and then checking effect on cart and checkout on fes', function () {
  3793. //
  3794. // var productTitle = commonHelper.uniqueProductName('editm24') + unique_value;
  3795. //
  3796. // beforeAll(function () {
  3797. // commonHelper.acceptAlert();
  3798. // });
  3799. //
  3800. // afterAll(function () {
  3801. // commonHelper.clearAllData();
  3802. // });
  3803. //
  3804. // it('should redirect on dashboard page after login', function () {
  3805. // browser.get(storeLink + '/admin');
  3806. // signInPage.login(username, password);
  3807. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  3808. // });
  3809. //
  3810. // it('should redirect on add product page', function () {
  3811. // browser.get(addProductLink);
  3812. // addProductPage.waitForPublishButton();
  3813. // });
  3814. //
  3815. // it('should select multi variant', function () {
  3816. // addProductPage.clickMulti();
  3817. // });
  3818. //
  3819. // it('should fill new product form', function () {
  3820. // addProductPage.selectType(type);
  3821. // addProductPage.selectFirstCollection();
  3822. // addProductPage.fillTitle(productTitle);
  3823. // addProductPage.fillShippingWeight(weight);
  3824. // addProductPage.addTag(tag);
  3825. // });
  3826. //
  3827. // it('should add first option', function () {
  3828. // addProductPage.fillOptionTitle(0, 'Color');
  3829. // addProductPage.fillOptionValue(0, firstColor);
  3830. // addProductPage.fillOptionValue(0, secondColor);
  3831. // addProductPage.clickProductLookCheckbox(0);
  3832. // });
  3833. //
  3834. // it('should add second option', function () {
  3835. // addProductPage.fillOptionTitle(1, 'Size');
  3836. // addProductPage.fillOptionValue(1, firstSize);
  3837. // addProductPage.fillOptionValue(1, secondSize);
  3838. // });
  3839. //
  3840. // it('should fill variant prices', function () {
  3841. // addProductPage.fillVariantPrice(firstVariant, price);
  3842. // addProductPage.clickVariantPriceAutofill(firstVariant);
  3843. // addProductPage.fillVariantComparePrice(firstVariant, comparePrice);
  3844. // addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3845. // });
  3846. //
  3847. // it('should add images', function () {
  3848. // addProductPage.uploadImage(0, firstImage);
  3849. // addProductPage.uploadImage(0, secondImage);
  3850. // addProductPage.uploadImage(1, firstImage);
  3851. // addProductPage.uploadImage(1, secondImage);
  3852. // });
  3853. //
  3854. // it('should publish product', function () {
  3855. // addProductPage.clickPublish();
  3856. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  3857. // });
  3858. //
  3859. // it('should show product image', function () {
  3860. // commonHelper.waitUntilElementVisible(productListPage.productImage(productTitle));
  3861. // });
  3862. //
  3863. // it('should show product page after click on product link', function () {
  3864. // productListPage.clickProduct(productTitle);
  3865. // });
  3866. //
  3867. // it('should show main product image', function () {
  3868. // commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  3869. // commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  3870. // });
  3871. //
  3872. // it('should show correct product price', function () {
  3873. // expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  3874. // });
  3875. //
  3876. // it('should show correct product compare price', function () {
  3877. // expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  3878. // });
  3879. //
  3880. // it('should show correct product name', function () {
  3881. // expect(productPage.productTitle()).toEqual(productTitle);
  3882. // });
  3883. //
  3884. // it('should show correct number of thumbs', function () {
  3885. // commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  3886. // commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  3887. // browser.sleep(1000);
  3888. // expect(productPage.allThumbs.count()).toEqual(2);
  3889. // });
  3890. //
  3891. // it('should select 1 product', function () {
  3892. // productPage.clickUp(1);
  3893. // });
  3894. //
  3895. // it('should click add to cart button', function () {
  3896. // productPage.clickAddToCart();
  3897. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  3898. // });
  3899. //
  3900. // it('should show correct total price in cart', function () {
  3901. // expect(cartPage.totalPrice()).toEqual('25.00');
  3902. // });
  3903. //
  3904. // it('should click checkout button', function () {
  3905. // cartPage.clickCheckout();
  3906. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  3907. // });
  3908. //
  3909. // it('should switch to previous tab', function () {
  3910. // commonHelper.switchToPreviousWithoutClose();
  3911. // });
  3912. //
  3913. // it('should edit product', function () {
  3914. // productListPage.editProduct(productTitle);
  3915. // addProductPage.waitForSaveButton();
  3916. // });
  3917. //
  3918. // it('should delete old options', function () {
  3919. // addProductPage.clickDeleteOption(1);
  3920. // addProductPage.clickDeleteOption(0);
  3921. // });
  3922. //
  3923. // it('should add second option', function () {
  3924. // addProductPage.clickAddOption();
  3925. // addProductPage.fillOptionTitle(0, 'Style');
  3926. // addProductPage.fillOptionValue(0, firstStyle);
  3927. // addProductPage.fillOptionValue(0, secondStyle);
  3928. // addProductPage.clickProductLookCheckbox(0);
  3929. // });
  3930. //
  3931. // it('should add third option', function () {
  3932. // addProductPage.clickAddOption();
  3933. // addProductPage.fillOptionTitle(1, 'Material');
  3934. // addProductPage.fillOptionValue(1, firstMaterial);
  3935. // addProductPage.fillOptionValue(1, secondMaterial);
  3936. // });
  3937. //
  3938. // it('should add pictures for t-shirt', function () {
  3939. // addProductPage.uploadImage(0, firstImage);
  3940. // addProductPage.uploadImage(0, secondImage);
  3941. // addProductPage.uploadImage(1, thirdImage);
  3942. // addProductPage.uploadImage(1, firstImage);
  3943. // });
  3944. //
  3945. // it('should fill sixth variant', function () {
  3946. // var firstVariant = firstStyle + ' / ' + firstMaterial;
  3947. // addProductPage.fillVariantPrice(firstVariant, thirdPrice);
  3948. // addProductPage.clickVariantPriceAutofill(firstVariant);
  3949. // addProductPage.fillVariantComparePrice(firstVariant, thirdComparePrice);
  3950. // addProductPage.clickVariantComparePriceAutofill(firstVariant);
  3951. // });
  3952. //
  3953. // it('should save product', function () {
  3954. // addProductPage.clickSave();
  3955. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  3956. // });
  3957. //
  3958. // it('should switch to next tab', function () {
  3959. // commonHelper.switchToNextTab();
  3960. // });
  3961. //
  3962. // it('should fill contact information form', function () {
  3963. // checkoutPage.selectCountry(country);
  3964. // checkoutPage.selectState(city);
  3965. // checkoutPage.fillCity(city);
  3966. // checkoutPage.fillZip(zip);
  3967. // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  3968. // checkoutPage.fillFirstName(firstName);
  3969. // checkoutPage.fillLastName(lastName);
  3970. // checkoutPage.fillStreetAddress(streetAddress);
  3971. // checkoutPage.fillSuite(suite);
  3972. // checkoutPage.fillPhone(phone);
  3973. // });
  3974. //
  3975. // it('should fill payment form', function () {
  3976. // checkoutPage.fillCardNumberField(cardNumber);
  3977. // checkoutPage.fillCardNameField(cardName);
  3978. // checkoutPage.fillCardDateField(cardDate);
  3979. // checkoutPage.fillCVVField(cardCVV);
  3980. // });
  3981. //
  3982. // it('should show correct prices', function () {
  3983. // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  3984. // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  3985. // expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  3986. // expect(checkoutPage.taxes()).toEqual('$0.00');
  3987. // expect(checkoutPage.totalPrice()).toEqual('$35.00');
  3988. // });
  3989. //
  3990. // it('should click complete order', function () {
  3991. // checkoutPage.clickCompleteOrder();
  3992. // commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  3993. // });
  3994. //
  3995. // it('should show error message', function () {
  3996. // browser.sleep(1000);
  3997. // expect(checkoutPage.chkErrorMessage()).toEqual('The product you were trying to buy has been changed. Please re-add it to cart and submit the order again');
  3998. // });
  3999. // });
  4000. });
Add Comment
Please, Sign In to add comment