Guest User

multi_variant/edit_product

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