Guest User

single_variant/edit_product

a guest
Feb 8th, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 62.08 KB | None | 0 0
  1. single_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 coreData = require('./../../../../../data/admin/core/index');
  20. var signInData = require('./../../../../../data/admin/sign_in/index');
  21. var productData = require('./../../../../../data/admin/product/index');
  22. var commonHelper = require('./../../../../../services/helpers/common.helper.js');
  23.  
  24. describe('Edit Single 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 vendor = productData.product.vendor;
  37. var tabName = productData.product.tabName;
  38.  
  39. var firstImage = 'car.jpg';
  40. var secondImage = 'bike.png';
  41. var thirdImage = 'laptop.jpg';
  42.  
  43. var cardNumber = coreData.cardNumber;
  44. var cardName = coreData.cardName;
  45. var cardDate = coreData.cardDate;
  46. var cardCVV = coreData.cardCVV;
  47.  
  48. var emailAddress = unique_value + '@mailinator.com';
  49. var country = coreData.country;
  50. var firstName = coreData.firstName;
  51. var lastName = coreData.lastName;
  52. var streetAddress = coreData.streetAddress;
  53. var suite = coreData.suite;
  54. var city = coreData.city;
  55. var zip = coreData.zip;
  56. var phone = coreData.phone;
  57.  
  58. var name = shippingData.zone.name.first + unique_value;
  59. var description = shippingData.zone.description.first;
  60. var rate = '$10.00';
  61.  
  62. describe('single variant product edit type', function () {
  63.  
  64. var title = commonHelper.uniqueProductName('edits1') + unique_value;
  65. var secondType = type + 'edit';
  66.  
  67. beforeAll(function () {
  68. commonHelper.acceptAlert();
  69. browser.get(signInData.link);
  70. });
  71.  
  72. afterAll(function () {
  73. commonHelper.clearAllData();
  74. });
  75.  
  76. it('should redirect on dashboard page after login', function () {
  77. signInPage.login(username, password);
  78. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  79. });
  80.  
  81. it('should redirect on add product page', function () {
  82. browser.get(productData.addLink);
  83. addProductPage.waitForPublishButton();
  84. });
  85.  
  86. it('should fill new product form', function () {
  87. addProductPage.selectType(type);
  88. addProductPage.selectFirstCollection();
  89. addProductPage.fillTitle(title);
  90. addProductPage.fillPrice(price);
  91. });
  92.  
  93. it('should publish product', function () {
  94. addProductPage.clickPublish();
  95. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  96. });
  97.  
  98. it('should open edit page for added product', function () {
  99. productListPage.editProduct(title);
  100. addProductPage.waitForSaveButton();
  101. });
  102.  
  103. it('should edit type', function () {
  104. addProductPage.selectType(secondType);
  105. });
  106.  
  107. it('should save product', function () {
  108. addProductPage.clickSave();
  109. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  110. });
  111.  
  112. it('should show success notification after edit', function () {
  113. commonHelper.waitUntilElementVisible(dashboardPage.eleAlertMessage);
  114. expect(dashboardPage.alertMessage()).toEqual("Product \"" + title + "\" updated successfully");
  115. });
  116.  
  117. it('should open edit page for added product', function () {
  118. productListPage.editProduct(title);
  119. addProductPage.waitForSaveButton();
  120. });
  121.  
  122. it('should show correct selected type', function () {
  123. expect(addProductPage.selectedType()).toEqual(secondType);
  124. });
  125.  
  126. it('should save product', function () {
  127. addProductPage.clickSave();
  128. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  129. });
  130. });
  131.  
  132. describe('single variant product edit collections', function () {
  133.  
  134. var title = commonHelper.uniqueProductName('edits2') + unique_value;
  135. var firstCollectionTitle = 'edits1' + unique_value;
  136. var secondCollectionTitle = 'edits2' + unique_value;
  137.  
  138. beforeAll(function () {
  139. commonHelper.acceptAlert();
  140. browser.get(signInData.link);
  141. });
  142.  
  143. afterAll(function () {
  144. commonHelper.clearAllData();
  145. });
  146.  
  147. it('should redirect on dashboard page after login', function () {
  148. signInPage.login(username, password);
  149. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  150. });
  151.  
  152. it('should open new collection page', function () {
  153. dashboardPage.openAddCollectionPage();
  154. });
  155.  
  156. it('should add first collection', function () {
  157. addCollectionPage.fillTitle(firstCollectionTitle);
  158. addCollectionPage.fillDescription('simple description');
  159. addCollectionPage.clickPublish();
  160. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
  161. });
  162.  
  163. it('should redirect on add product page', function () {
  164. browser.get(productData.addLink);
  165. addProductPage.waitForPublishButton();
  166. });
  167.  
  168. it('should fill new product form', function () {
  169. addProductPage.selectType(type);
  170. addProductPage.selectCollection(firstCollectionTitle);
  171. addProductPage.fillTitle(title);
  172. addProductPage.fillPrice(price);
  173. });
  174.  
  175. it('should publish product', function () {
  176. addProductPage.clickPublish();
  177. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  178. });
  179.  
  180. it('should open new collection page', function () {
  181. dashboardPage.openAddCollectionPage();
  182. });
  183.  
  184. it('should add second collection', function () {
  185. addCollectionPage.fillTitle(secondCollectionTitle);
  186. addCollectionPage.fillDescription('simple description');
  187. addCollectionPage.clickPublish();
  188. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
  189. });
  190.  
  191. it('should open products list page', function () {
  192. dashboardPage.openProductListPage();
  193. });
  194.  
  195. it('should open edit page for added product', function () {
  196. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  197. productListPage.editProduct(title);
  198. addProductPage.waitForSaveButton();
  199. });
  200.  
  201. it('should edit collection', function () {
  202. addProductPage.clickDeleteCollection(firstCollectionTitle);
  203. addProductPage.selectCollection(secondCollectionTitle);
  204. });
  205.  
  206. it('should save product', function () {
  207. addProductPage.clickSave();
  208. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  209. });
  210.  
  211. it('should open edit page for added product', function () {
  212. productListPage.editProduct(title);
  213. addProductPage.waitForSaveButton();
  214. });
  215.  
  216. it('should show correct selected collection', function () {
  217. expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
  218. });
  219.  
  220. it('should save product', function () {
  221. addProductPage.clickSave();
  222. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  223. });
  224.  
  225. it('should show product page after click on product link', function () {
  226. productListPage.clickProduct(title);
  227. });
  228.  
  229. it('should show add to cart button', function () {
  230. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  231. });
  232.  
  233. it('should show correct product price', function () {
  234. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  235. });
  236.  
  237. it('should show correct product name', function () {
  238. expect(productPage.productTitle()).toEqual(title);
  239. commonHelper.switchToPreviousTab();
  240. });
  241.  
  242. it('should open collection list page', function () {
  243. dashboardPage.openCollectionListPage();
  244. });
  245.  
  246. it('should show collection page after click on collection link', function () {
  247. collectionListPage.clickCollection(secondCollectionTitle);
  248. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  249.  
  250. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  251. commonHelper.switchToPreviousTab();
  252. });
  253. });
  254.  
  255. describe('single variant product edit multiple collections', function () {
  256.  
  257. var title = commonHelper.uniqueProductName('edits3') + unique_value;
  258. var firstCollectionTitle = 'editsingle3' + unique_value;
  259. var secondCollectionTitle = 'editsingle4' + unique_value;
  260.  
  261. beforeAll(function () {
  262. commonHelper.acceptAlert();
  263. browser.get(signInData.link);
  264. });
  265.  
  266. afterAll(function () {
  267. commonHelper.clearAllData();
  268. });
  269.  
  270. it('should redirect on dashboard page after login', function () {
  271. signInPage.login(username, password);
  272. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  273. });
  274.  
  275. it('should open new collection page', function () {
  276. dashboardPage.openAddCollectionPage();
  277. });
  278.  
  279. it('should add first collection', function () {
  280. addCollectionPage.fillTitle(firstCollectionTitle);
  281. addCollectionPage.fillDescription('simple description');
  282. addCollectionPage.clickPublish();
  283. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(firstCollectionTitle));
  284. });
  285.  
  286. it('should redirect on add product page', function () {
  287. browser.get(productData.addLink);
  288. addProductPage.waitForPublishButton();
  289. });
  290.  
  291. it('should fill new product form', function () {
  292. addProductPage.selectType(type);
  293. addProductPage.selectCollection(firstCollectionTitle);
  294. addProductPage.fillTitle(title);
  295. addProductPage.fillPrice(price);
  296. });
  297.  
  298. it('should publish product', function () {
  299. addProductPage.clickPublish();
  300. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  301. });
  302.  
  303. it('should open new collection page', function () {
  304. dashboardPage.openAddCollectionPage();
  305. });
  306.  
  307. it('should add second collection', function () {
  308. addCollectionPage.fillTitle(secondCollectionTitle);
  309. addCollectionPage.fillDescription('simple description');
  310. addCollectionPage.clickPublish();
  311. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(secondCollectionTitle));
  312. });
  313.  
  314. it('should open products list page', function () {
  315. dashboardPage.openProductListPage();
  316. });
  317.  
  318. it('should open edit page for added product', function () {
  319. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  320. productListPage.editProduct(title);
  321. addProductPage.waitForSaveButton();
  322. });
  323.  
  324. it('should edit collection', function () {
  325. addProductPage.selectCollection(secondCollectionTitle);
  326. });
  327.  
  328. it('should save product', function () {
  329. addProductPage.clickSave();
  330. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  331. });
  332.  
  333. it('should open edit page for added product', function () {
  334. productListPage.editProduct(title);
  335. addProductPage.waitForSaveButton();
  336. });
  337.  
  338. it('should show correct selected collections', function () {
  339. expect(addProductPage.eleSelectedCollection(firstCollectionTitle).isDisplayed()).toBeTruthy();
  340. expect(addProductPage.eleSelectedCollection(secondCollectionTitle).isDisplayed()).toBeTruthy();
  341. });
  342.  
  343. it('should save product', function () {
  344. addProductPage.clickSave();
  345. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  346. });
  347.  
  348. it('should show product page after click on product link', function () {
  349. productListPage.clickProduct(title);
  350. });
  351.  
  352. it('should show add to cart button', function () {
  353. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  354. });
  355.  
  356. it('should show correct product price', function () {
  357. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  358. });
  359.  
  360. it('should show correct product name', function () {
  361. expect(productPage.productTitle()).toEqual(title);
  362. commonHelper.switchToPreviousTab();
  363. });
  364.  
  365. it('should open collection list page', function () {
  366. dashboardPage.openCollectionListPage();
  367. });
  368.  
  369. it('should show collection page after click on collection link', function () {
  370. collectionListPage.clickCollection(secondCollectionTitle);
  371. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  372.  
  373. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  374. commonHelper.switchToPreviousTab();
  375. });
  376.  
  377. it('should show collection page after click on collection link', function () {
  378. collectionListPage.clickCollection(firstCollectionTitle);
  379. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  380.  
  381. expect(collectionsPage.productTitle(title).isDisplayed()).toBeTruthy();
  382. commonHelper.switchToPreviousTab();
  383. });
  384. });
  385.  
  386. describe('single variant product edit description', function () {
  387.  
  388. var title = commonHelper.uniqueProductName('edits4') + unique_value;
  389. var firstDescription = 'first description';
  390. var secondDescription = 'second description';
  391.  
  392. beforeAll(function () {
  393. commonHelper.acceptAlert();
  394. browser.get(signInData.link);
  395. });
  396.  
  397. afterAll(function () {
  398. commonHelper.clearAllData();
  399. });
  400.  
  401. it('should redirect on dashboard page after login', function () {
  402. signInPage.login(username, password);
  403. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  404. });
  405.  
  406. it('should redirect on add product page', function () {
  407. browser.get(productData.addLink);
  408. addProductPage.waitForPublishButton();
  409. });
  410.  
  411. it('should fill new product form', function () {
  412. addProductPage.selectType(type);
  413. addProductPage.selectFirstCollection();
  414. addProductPage.fillTitle(title);
  415. addProductPage.fillPrice(price);
  416. });
  417.  
  418. it('should fill new product form', function () {
  419. addProductPage.fillDescription(firstDescription);
  420. });
  421.  
  422. it('should publish product', function () {
  423. addProductPage.clickPublish();
  424. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  425. });
  426.  
  427. it('should show product page after click on product link', function () {
  428. productListPage.clickProduct(title);
  429. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  430. });
  431.  
  432. it('should show correct description', function () {
  433. expect(productPage.productDescription()).toContain(tabName);
  434. expect(productPage.productDescription()).toContain(firstDescription);
  435. });
  436.  
  437. it('should open edit page for added product', function () {
  438. commonHelper.switchToPreviousTab();
  439. productListPage.editProduct(title);
  440. addProductPage.waitForSaveButton();
  441. });
  442.  
  443. it('should edit description', function () {
  444. addProductPage.fillDescription(secondDescription);
  445. });
  446.  
  447. it('should save product', function () {
  448. addProductPage.clickSave();
  449. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  450. });
  451.  
  452. it('should show product page after click on product link', function () {
  453. productListPage.clickProduct(title);
  454. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  455. });
  456.  
  457. it('should show correct description', function () {
  458. expect(productPage.productDescription()).toContain(tabName);
  459. expect(productPage.productDescription()).toContain(secondDescription);
  460. commonHelper.switchToPreviousTab();
  461. });
  462. });
  463.  
  464. describe('single variant product edit price and compare price', function () {
  465.  
  466. var title = commonHelper.uniqueProductName('edits5') + unique_value;
  467. var secondPrice ='$20.00';
  468. var secondComparePrice = '$30.00';
  469.  
  470. beforeAll(function () {
  471. commonHelper.acceptAlert();
  472. browser.get(signInData.link);
  473. });
  474.  
  475. afterAll(function () {
  476. commonHelper.clearAllData();
  477. });
  478.  
  479. it('should redirect on dashboard page after login', function () {
  480. signInPage.login(username, password);
  481. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  482. });
  483.  
  484. it('should redirect on add product page', function () {
  485. browser.get(productData.addLink);
  486. addProductPage.waitForPublishButton();
  487. });
  488.  
  489. it('should fill new product form', function () {
  490. addProductPage.selectType(type);
  491. addProductPage.selectFirstCollection();
  492. addProductPage.fillTitle(title);
  493. addProductPage.fillPrice(price);
  494. addProductPage.fillComparePrice(comparePrice);
  495. });
  496.  
  497. it('should publish product', function () {
  498. addProductPage.clickPublish();
  499. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  500. });
  501.  
  502. it('should show product page after click on product link', function () {
  503. productListPage.clickProduct(title);
  504. });
  505.  
  506. it('should show correct product price', function () {
  507. expect(productPage.productPrice()).toEqual(price.replace('$', ''));
  508. });
  509.  
  510. it('should show correct product compare price', function () {
  511. expect(productPage.productComparePrice()).toEqual(comparePrice.replace('$', ''));
  512. });
  513.  
  514. it('should open edit page for added product', function () {
  515. commonHelper.switchToPreviousTab();
  516. productListPage.editProduct(title);
  517. addProductPage.waitForSaveButton();
  518. });
  519.  
  520. it('should add price and compare prise', function () {
  521. addProductPage.fillPrice(secondPrice);
  522. addProductPage.fillComparePrice(secondComparePrice);
  523. });
  524.  
  525. it('should save product', function () {
  526. addProductPage.clickSave();
  527. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  528. });
  529.  
  530. it('should show product page after click on product link', function () {
  531. productListPage.clickProduct(title);
  532. });
  533.  
  534. it('should show correct product price', function () {
  535. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  536. });
  537.  
  538. it('should show correct product compare price', function () {
  539. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  540. });
  541. });
  542.  
  543. describe('single variant product edit - shipping weight, tags, sku', function () {
  544.  
  545. var title = commonHelper.uniqueProductName('edits6') + unique_value;
  546. var firstTag = 'FirstTag' + unique_value;
  547. var secondTag = 'SecondTag' + unique_value;
  548. var secondShippingWeight = '5';
  549. var secondSku = 'KUV-OK-LR-23-ER-T43';
  550.  
  551. beforeAll(function () {
  552. commonHelper.acceptAlert();
  553. browser.get(signInData.link);
  554. });
  555.  
  556. afterAll(function () {
  557. commonHelper.clearAllData();
  558. });
  559.  
  560. it('should redirect on dashboard page after login', function () {
  561. signInPage.login(username, password);
  562. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  563. });
  564.  
  565. it('should redirect on add product page', function () {
  566. browser.get(productData.addLink);
  567. addProductPage.waitForPublishButton();
  568. });
  569.  
  570. it('should fill new product form', function () {
  571. addProductPage.selectType(type);
  572. addProductPage.selectFirstCollection();
  573. addProductPage.fillTitle(title);
  574. addProductPage.fillPrice(price);
  575. addProductPage.fillSku(sku);
  576. addProductPage.addTag(firstTag);
  577. addProductPage.fillShippingWeight(weight);
  578. });
  579.  
  580. it('should publish product', function () {
  581. addProductPage.clickPublish();
  582. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  583. });
  584.  
  585. it('should open edit page for added product', function () {
  586. productListPage.editProduct(title);
  587. addProductPage.waitForSaveButton();
  588. });
  589.  
  590. it('should edit weight, tag and sku', function () {
  591. addProductPage.fillShippingWeight(secondShippingWeight);
  592. addProductPage.fillSku(secondSku);
  593. addProductPage.clickDeleteCollection(firstTag);
  594. addProductPage.addTag(secondTag);
  595. });
  596.  
  597. it('should save product', function () {
  598. addProductPage.clickSave();
  599. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  600. });
  601.  
  602. it('should open edit page for edited product', function () {
  603. productListPage.editProduct(title);
  604. addProductPage.waitForSaveButton();
  605. });
  606.  
  607. it('should show correct tag', function () {
  608. expect(addProductPage.eleSelectedCollection(secondTag).isDisplayed()).toBeTruthy();
  609. });
  610.  
  611. it('should save product', function () {
  612. addProductPage.clickSave();
  613. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  614. });
  615. });
  616.  
  617. describe('single variant product edit image order', function () {
  618.  
  619. var title = commonHelper.uniqueProductName('edits7') + unique_value;
  620. var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
  621.  
  622. beforeAll(function () {
  623. commonHelper.acceptAlert();
  624. browser.get(signInData.link);
  625. });
  626.  
  627. afterAll(function () {
  628. commonHelper.clearAllData();
  629. });
  630.  
  631. it('should redirect on dashboard page after login', function () {
  632. signInPage.login(username, password);
  633. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  634. });
  635.  
  636. it('should redirect on add product page', function () {
  637. browser.get(productData.addLink);
  638. addProductPage.waitForPublishButton();
  639. });
  640.  
  641. it('should fill new product form', function () {
  642. addProductPage.selectType(type);
  643. addProductPage.selectFirstCollection();
  644. addProductPage.fillTitle(title);
  645. addProductPage.fillPrice(price);
  646. addProductPage.uploadImage(1, firstImage);
  647. addProductPage.uploadImage(1, secondImage);
  648. });
  649.  
  650. it('should publish product', function () {
  651. addProductPage.clickPublish();
  652. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  653. });
  654.  
  655. it('should save first thumbnail source', function () {
  656. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  657. productListPage.productImage(title).getAttribute('style').then(function (value) {
  658. firstThumbnail = value;
  659. });
  660. });
  661.  
  662. it('should open product page', function () {
  663. productListPage.clickProduct(title);
  664. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  665. });
  666.  
  667. it('should save first main image source', function () {
  668. productPage.eleProductImage.getAttribute('src').then(function (value) {
  669. firstProductImage = value;
  670. });
  671. });
  672.  
  673. it('should edit product', function () {
  674. commonHelper.switchToPreviousTab();
  675. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  676. productListPage.editProduct(title);
  677. addProductPage.waitForSaveButton();
  678. });
  679.  
  680. it('should change order for images', function () {
  681. addProductPage.dragAndDropImage(1, 2);
  682. });
  683.  
  684. it('should save product', function () {
  685. addProductPage.clickSave();
  686. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  687. });
  688.  
  689. it('should save second thumbnail source', function () {
  690. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  691. productListPage.productImage(title).getAttribute('style').then(function (value) {
  692. secondThumbnail = value;
  693. });
  694. });
  695.  
  696. it('should open product page', function () {
  697. productListPage.clickProduct(title);
  698. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  699. });
  700.  
  701. it('should save second main image source', function () {
  702. productPage.eleProductImage.getAttribute('src').then(function (value) {
  703. secondProductImage = value;
  704. });
  705. commonHelper.switchToPreviousTab();
  706. });
  707.  
  708. it('should see image changes', function () {
  709. expect(firstThumbnail).not.toEqual(secondThumbnail);
  710. expect(firstProductImage).not.toEqual(secondProductImage);
  711. });
  712. });
  713.  
  714. describe('single variant product add some images', function () {
  715.  
  716. var title = commonHelper.uniqueProductName('edits8') + unique_value;
  717. var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
  718.  
  719. beforeAll(function () {
  720. commonHelper.acceptAlert();
  721. browser.get(signInData.link);
  722. });
  723.  
  724. afterAll(function () {
  725. commonHelper.clearAllData();
  726. });
  727.  
  728. it('should redirect on dashboard page after login', function () {
  729. signInPage.login(username, password);
  730. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  731. });
  732.  
  733. it('should redirect on add product page', function () {
  734. browser.get(productData.addLink);
  735. addProductPage.waitForPublishButton();
  736. });
  737.  
  738. it('should fill new product form', function () {
  739. addProductPage.selectType(type);
  740. addProductPage.selectFirstCollection();
  741. addProductPage.fillTitle(title);
  742. addProductPage.fillPrice(price);
  743. addProductPage.uploadImage(1, firstImage);
  744. });
  745.  
  746. it('should publish product', function () {
  747. addProductPage.clickPublish();
  748. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  749. });
  750.  
  751. it('should save first thumbnail source', function () {
  752. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  753. productListPage.productImage(title).getAttribute('style').then(function (value) {
  754. firstThumbnail = value;
  755. });
  756. });
  757.  
  758. it('should open product page', function () {
  759. productListPage.clickProduct(title);
  760. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  761. });
  762.  
  763. it('should save first main image source', function () {
  764. productPage.eleProductImage.getAttribute('src').then(function (value) {
  765. firstProductImage = value;
  766. });
  767. });
  768.  
  769. it('should edit product', function () {
  770. commonHelper.switchToPreviousTab();
  771. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  772. productListPage.editProduct(title);
  773. addProductPage.waitForSaveButton();
  774. });
  775.  
  776. it('should add image', function () {
  777. addProductPage.uploadImage(1, thirdImage);
  778. });
  779.  
  780. it('should save product', function () {
  781. addProductPage.clickSave();
  782. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  783. });
  784.  
  785. it('should save second thumbnail source', function () {
  786. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  787. productListPage.productImage(title).getAttribute('style').then(function (value) {
  788. secondThumbnail = value;
  789. });
  790. });
  791.  
  792. it('should open product page', function () {
  793. productListPage.clickProduct(title);
  794. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  795. });
  796.  
  797. it('should save second main image source', function () {
  798. productPage.eleProductImage.getAttribute('src').then(function (value) {
  799. secondProductImage = value;
  800. });
  801. });
  802.  
  803. it('should show correct number of thumbs', function () {
  804. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  805. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  806. browser.sleep(1000);
  807. expect(productPage.allThumbs.count()).toEqual(2);
  808. });
  809.  
  810. it('should not see image changes', function () {
  811. commonHelper.switchToPreviousTab();
  812. expect(firstThumbnail).toEqual(secondThumbnail);
  813. expect(firstProductImage).toEqual(secondProductImage);
  814. });
  815. });
  816.  
  817. describe('single variant product delete and change all images', function () {
  818.  
  819. var title = commonHelper.uniqueProductName('edits9') + unique_value;
  820. var firstThumbnail, secondThumbnail, firstProductImage, secondProductImage;
  821.  
  822. beforeAll(function () {
  823. commonHelper.acceptAlert();
  824. browser.get(signInData.link);
  825. });
  826.  
  827. afterAll(function () {
  828. commonHelper.clearAllData();
  829. });
  830.  
  831. it('should redirect on dashboard page after login', function () {
  832. signInPage.login(username, password);
  833. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  834. });
  835.  
  836. it('should redirect on add product page', function () {
  837. browser.get(productData.addLink);
  838. addProductPage.waitForPublishButton();
  839. });
  840.  
  841. it('should fill new product form', function () {
  842. addProductPage.selectType(type);
  843. addProductPage.selectFirstCollection();
  844. addProductPage.fillTitle(title);
  845. addProductPage.fillPrice(price);
  846. addProductPage.uploadImage(1, firstImage);
  847. addProductPage.uploadImage(1, secondImage);
  848. });
  849.  
  850. it('should publish product', function () {
  851. addProductPage.clickPublish();
  852. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  853. });
  854.  
  855. it('should save first thumbnail source', function () {
  856. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  857. productListPage.productImage(title).getAttribute('style').then(function (value) {
  858. firstThumbnail = value;
  859. });
  860. });
  861.  
  862. it('should open product page', function () {
  863. productListPage.clickProduct(title);
  864. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  865. });
  866.  
  867. it('should save first main image source', function () {
  868. productPage.eleProductImage.getAttribute('src').then(function (value) {
  869. firstProductImage = value;
  870. });
  871. });
  872.  
  873. it('should edit product', function () {
  874. commonHelper.switchToPreviousTab();
  875. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  876. productListPage.editProduct(title);
  877. addProductPage.waitForSaveButton();
  878. });
  879.  
  880. it('should delete images', function () {
  881. addProductPage.deleteImage(2);
  882. addProductPage.deleteImage(1);
  883. });
  884.  
  885. it('should add new image', function () {
  886. addProductPage.uploadImage(1, thirdImage);
  887. });
  888.  
  889. it('should save product', function () {
  890. addProductPage.clickSave();
  891. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  892. });
  893.  
  894. it('should save second thumbnail source', function () {
  895. commonHelper.waitUntilElementVisible(productListPage.productImage(title));
  896. productListPage.productImage(title).getAttribute('style').then(function (value) {
  897. secondThumbnail = value;
  898. });
  899. });
  900.  
  901. it('should open product page', function () {
  902. productListPage.clickProduct(title);
  903. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  904. });
  905.  
  906. it('should save second main image source', function () {
  907. productPage.eleProductImage.getAttribute('src').then(function (value) {
  908. secondProductImage = value;
  909. });
  910. commonHelper.switchToPreviousTab();
  911. });
  912.  
  913. it('should see image changes', function () {
  914. expect(firstThumbnail).not.toEqual(secondThumbnail);
  915. expect(firstProductImage).not.toEqual(secondProductImage);
  916. });
  917. });
  918.  
  919. describe('single variant product edit page SEO title', function () {
  920.  
  921. var title = commonHelper.uniqueProductName('edits10') + unique_value;
  922. var seoTitle = 'seo';
  923.  
  924. beforeAll(function () {
  925. commonHelper.acceptAlert();
  926. browser.get(signInData.link);
  927. });
  928.  
  929. afterAll(function () {
  930. commonHelper.clearAllData();
  931. });
  932.  
  933. it('should redirect on dashboard page after login', function () {
  934. signInPage.login(username, password);
  935. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  936. });
  937.  
  938. it('should redirect on add product page', function () {
  939. browser.get(productData.addLink);
  940. addProductPage.waitForPublishButton();
  941. });
  942.  
  943. it('should fill new product form', function () {
  944. addProductPage.selectType(type);
  945. addProductPage.selectFirstCollection();
  946. addProductPage.fillTitle(title);
  947. addProductPage.fillPrice(price);
  948. });
  949.  
  950. it('should publish product', function () {
  951. addProductPage.clickPublish();
  952. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  953. });
  954.  
  955. it('should open edit page for added product', function () {
  956. productListPage.editProduct(title);
  957. addProductPage.waitForSaveButton();
  958. });
  959.  
  960. it('should edit seo title', function () {
  961. addProductPage.fillSeoTitle(seoTitle);
  962. });
  963.  
  964. it('should save product', function () {
  965. addProductPage.clickSave();
  966. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  967. });
  968.  
  969. it('should open product page and show correct seo title', function () {
  970. productListPage.clickProduct(title);
  971. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  972.  
  973. expect(productPage.productTitle()).toEqual(title);
  974. expect(homePage.pixelCode('head', seoTitle).isPresent()).toBeTruthy();
  975.  
  976. commonHelper.switchToPreviousTab();
  977. });
  978. });
  979.  
  980. describe('single variant product edit page SEO url', function () {
  981.  
  982. var title = commonHelper.uniqueProductName('edits11') + unique_value;
  983. var url = commonHelper.uniqueProductName('edits12') + unique_value;
  984.  
  985. beforeAll(function () {
  986. commonHelper.acceptAlert();
  987. browser.get(signInData.link);
  988. });
  989.  
  990. afterAll(function () {
  991. commonHelper.clearAllData();
  992. });
  993.  
  994. it('should redirect on dashboard page after login', function () {
  995. signInPage.login(username, password);
  996. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  997. });
  998.  
  999. it('should redirect on add product page', function () {
  1000. browser.get(productData.addLink);
  1001. addProductPage.waitForPublishButton();
  1002. });
  1003.  
  1004. it('should fill new product form', function () {
  1005. addProductPage.selectType(type);
  1006. addProductPage.selectFirstCollection();
  1007. addProductPage.fillTitle(title);
  1008. addProductPage.fillPrice(price);
  1009. });
  1010.  
  1011. it('should publish product', function () {
  1012. addProductPage.clickPublish();
  1013. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1014. });
  1015.  
  1016. it('should open edit page for added product', function () {
  1017. productListPage.editProduct(title);
  1018. addProductPage.waitForSaveButton();
  1019. });
  1020.  
  1021. it('should edit url', function () {
  1022. addProductPage.fillUrl(url);
  1023. });
  1024.  
  1025. it('should save product', function () {
  1026. addProductPage.clickSave();
  1027. commonHelper.waitUntilElementVisible(productListPage.productEntry(title));
  1028. });
  1029.  
  1030. it('should open product page with correct link', function () {
  1031. productListPage.clickProduct(title);
  1032. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1033.  
  1034. expect(productPage.productTitle()).toEqual(title);
  1035. expect(browser.getCurrentUrl()).toContain(url.toLowerCase());
  1036.  
  1037. commonHelper.switchToPreviousTab();
  1038. });
  1039. });
  1040.  
  1041. describe('checking for edit single variant product and checking effect on existing orders with it', function () {
  1042.  
  1043. var productTitle = commonHelper.uniqueProductName('edits13') + unique_value;
  1044. var secondProductTitle = commonHelper.uniqueProductName('edits14') + unique_value;
  1045.  
  1046. var secondPrice = '$30.00';
  1047. var secondComparePrice = '$35.00';
  1048.  
  1049. var orderNumber;
  1050.  
  1051. beforeAll(function () {
  1052. commonHelper.acceptAlert();
  1053. browser.get(signInData.link);
  1054. });
  1055.  
  1056. afterAll(function () {
  1057. commonHelper.clearAllData();
  1058. });
  1059.  
  1060. it('should redirect on dashboard page after login', function () {
  1061. signInPage.login(username, password);
  1062. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1063. });
  1064.  
  1065. it('should open shipping page', function () {
  1066. dashboardPage.openShippingPage();
  1067. });
  1068.  
  1069. it('should delete all zones', function check(done) {
  1070. commonHelper.waitUntilElementInvisible(shippingPage.imgLoader);
  1071. shippingPage.allShippings.count().then(function(result) {
  1072. if(result == 0) {
  1073. done();
  1074. } else {
  1075. shippingPage.allShippings.get(0).getText().then(function (value) {
  1076. shippingPage.openForEdit(value);
  1077. addShippingZonePage.clickDeleteZone();
  1078. });
  1079. check(done);
  1080. }
  1081. })
  1082. }, 30000);
  1083.  
  1084. it('should open new zone page', function () {
  1085. shippingPage.clickAddZone();
  1086. addShippingZonePage.waitForSaveButton();
  1087. });
  1088.  
  1089. it('should add new zone', function () {
  1090. addShippingZonePage.setZoneName(name);
  1091. addShippingZonePage.setShippingRate(rate.replace('$', ''));
  1092. addShippingZonePage.setServiceDescription(description);
  1093. addShippingZonePage.setCountry(country);
  1094. addShippingZonePage.clickSave();
  1095. });
  1096.  
  1097. it('should contain new shipping zone', function() {
  1098. commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
  1099. });
  1100.  
  1101. it('should redirect on add product page', function () {
  1102. browser.get(productData.addLink);
  1103. addProductPage.waitForPublishButton();
  1104. });
  1105.  
  1106. it('should fill new product form', function () {
  1107. addProductPage.selectType(type);
  1108. addProductPage.selectFirstCollection();
  1109. addProductPage.fillTitle(productTitle);
  1110. addProductPage.fillPrice(price);
  1111. addProductPage.fillMetaDescription(description);
  1112. addProductPage.fillComparePrice(comparePrice);
  1113. addProductPage.fillShippingWeight(weight);
  1114. addProductPage.selectVendor(vendor);
  1115. addProductPage.addTag(tag);
  1116. addProductPage.uploadImage(1, firstImage);
  1117. addProductPage.uploadImage(1, secondImage);
  1118. });
  1119.  
  1120. it('should publish product', function () {
  1121. addProductPage.clickPublish();
  1122. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1123. });
  1124.  
  1125. it('should show product page after click on product link', function () {
  1126. productListPage.clickProduct(productTitle);
  1127. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1128. });
  1129.  
  1130. it('should click add to cart button', function () {
  1131. productPage.clickAddToCart();
  1132. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1133. });
  1134.  
  1135. it('should click checkout button', function () {
  1136. cartPage.clickCheckout();
  1137. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1138. });
  1139.  
  1140. it('should fill email address', function () {
  1141. checkoutPage.fillEmailAddress(emailAddress);
  1142. });
  1143.  
  1144. it('should fill contact information form', function () {
  1145. checkoutPage.selectCountry(country);
  1146. checkoutPage.selectState(city);
  1147. checkoutPage.fillCity(city);
  1148. checkoutPage.fillZip(zip);
  1149. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1150. checkoutPage.fillFirstName(firstName);
  1151. checkoutPage.fillLastName(lastName);
  1152. checkoutPage.fillStreetAddress(streetAddress);
  1153. checkoutPage.fillSuite(suite);
  1154. checkoutPage.fillPhone(phone);
  1155. });
  1156.  
  1157. it('should fill payment form', function () {
  1158. checkoutPage.fillCardNumberField(cardNumber);
  1159. checkoutPage.fillCardNameField(cardName);
  1160. checkoutPage.fillCardDateField(cardDate);
  1161. checkoutPage.fillCVVField(cardCVV);
  1162. });
  1163.  
  1164. it('should show correct prices', function () {
  1165. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1166. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1167. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  1168. expect(checkoutPage.taxes()).toEqual('$0.00');
  1169. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  1170. });
  1171.  
  1172. it('should click complete order', function () {
  1173. checkoutPage.clickCompleteOrder();
  1174. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  1175. });
  1176.  
  1177. it('should save order number', function () {
  1178. checkoutPage.txtOrder.getText().then(function (value) {
  1179. orderNumber = value.split(' ')[1];
  1180. });
  1181. });
  1182.  
  1183. it('should redirect on admin dashboard page', function () {
  1184. browser.get(signInData.link);
  1185. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1186. });
  1187.  
  1188. it('should open orders list', function () {
  1189. dashboardPage.openOrdersPage();
  1190. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1191. });
  1192.  
  1193. it('should open needed order', function () {
  1194. ordersPage.clickOrderEntry(orderNumber);
  1195. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1196. });
  1197.  
  1198. it('should show correct product name', function () {
  1199. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  1200. });
  1201.  
  1202. it('should show product image', function () {
  1203. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  1204. });
  1205.  
  1206. it('should show correct order price', function () {
  1207. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1208. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1209. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1210. expect(ordersPage.taxes()).toEqual('$0.00');
  1211. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1212. });
  1213.  
  1214. it('should open products list page', function () {
  1215. dashboardPage.openProductListPage();
  1216. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1217. });
  1218.  
  1219. it('should open edit product', function () {
  1220. productListPage.editProduct(productTitle);
  1221. addProductPage.waitForSaveButton();
  1222. });
  1223.  
  1224. it('should edit product prices and title', function () {
  1225. addProductPage.fillTitle(secondProductTitle);
  1226. addProductPage.fillPrice(secondPrice);
  1227. addProductPage.fillComparePrice(secondComparePrice);
  1228. });
  1229.  
  1230. it('should delete old pictures', function () {
  1231. addProductPage.deleteImage(1);
  1232. addProductPage.deleteImage(1);
  1233. });
  1234.  
  1235. it('should add another pictures', function () {
  1236. addProductPage.uploadImage(1, thirdImage);
  1237. addProductPage.uploadImage(1, firstImage);
  1238. });
  1239.  
  1240. it('should save product', function () {
  1241. addProductPage.clickSave();
  1242. commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  1243. });
  1244.  
  1245. it('should redirect on admin dashboard page', function () {
  1246. browser.get(signInData.link);
  1247. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1248. });
  1249.  
  1250. it('should open orders list', function () {
  1251. dashboardPage.openOrdersPage();
  1252. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1253. });
  1254.  
  1255. it('should show last order in the first row', function () {
  1256. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1257. });
  1258.  
  1259. it('should open needed order', function () {
  1260. ordersPage.clickOrderEntry(orderNumber);
  1261. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1262. });
  1263.  
  1264. it('should show correct product name', function () {
  1265. expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  1266. });
  1267.  
  1268. it('should show product image', function () {
  1269. expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  1270. });
  1271.  
  1272. it('should show correct order price', function () {
  1273. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1274. expect(ordersPage.subtotalPrice()).toEqual(price);
  1275. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1276. expect(ordersPage.taxes()).toEqual('$0.00');
  1277. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1278. });
  1279.  
  1280. it('should open products list page', function () {
  1281. dashboardPage.openProductListPage();
  1282. });
  1283.  
  1284. it('should show product page after click on product link', function () {
  1285. productListPage.clickProduct(secondProductTitle);
  1286. });
  1287.  
  1288. it('should show main product image', function () {
  1289. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1290. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1291. });
  1292.  
  1293. it('should show correct product price', function () {
  1294. expect(productPage.productPrice()).toEqual(secondPrice.replace('$', ''));
  1295. });
  1296.  
  1297. it('should show correct product compare price', function () {
  1298. expect(productPage.productComparePrice()).toEqual(secondComparePrice.replace('$', ''));
  1299. });
  1300.  
  1301. it('should show correct product name', function () {
  1302. expect(productPage.productTitle()).toEqual(secondProductTitle);
  1303. });
  1304.  
  1305. it('should show correct number of thumbs', function () {
  1306. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1307. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1308. browser.sleep(1000);
  1309. expect(productPage.allThumbs.count()).toEqual(2);
  1310. });
  1311.  
  1312. it('should select 1 product', function () {
  1313. productPage.clickUp(1);
  1314. });
  1315.  
  1316. it('should click add to cart button', function () {
  1317. productPage.clickAddToCart();
  1318. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1319. });
  1320.  
  1321. it('should show correct total price in cart', function () {
  1322. expect(cartPage.totalPrice()).toEqual('30.00');
  1323. });
  1324.  
  1325. it('should click checkout button', function () {
  1326. cartPage.clickCheckout();
  1327. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1328. });
  1329.  
  1330. it('should show correct product', function () {
  1331. expect(checkoutPage.productName(secondProductTitle).isDisplayed()).toBeTruthy();
  1332. });
  1333.  
  1334. it('should show product images', function () {
  1335. expect(checkoutPage.productImage(secondProductTitle).isDisplayed()).toBeTruthy();
  1336. });
  1337.  
  1338. it('should show correct prices for products', function () {
  1339. expect(checkoutPage.productPrice(secondProductTitle)).toEqual('$30.00 x 1');
  1340. });
  1341.  
  1342. it('should show correct subtotals for products', function () {
  1343. expect(checkoutPage.productSubtotal(secondProductTitle)).toEqual('$30.00');
  1344. });
  1345. });
  1346.  
  1347. // describe('checking for edit single variant product and checking effect on сart and checkout on fes', function () {
  1348. //
  1349. // var productTitle = commonHelper.uniqueProductName('edits15') + unique_value;
  1350. //
  1351. // var firstPrice = '$10.00';
  1352. // var firstComparePrice = '$10.00';
  1353. // var secondPrice = '$20.00';
  1354. // var secondComparePrice = '$20.00';
  1355. // var thirdPrice = '$30.00';
  1356. // var thirdComparePrice = '$30.00';
  1357. //
  1358. // var orderNumber;
  1359. //
  1360. // beforeAll(function () {
  1361. // commonHelper.acceptAlert();
  1362. // browser.get(signInData.link);
  1363. // });
  1364. //
  1365. // afterAll(function () {
  1366. // commonHelper.clearAllData();
  1367. // });
  1368. //
  1369. // it('should redirect on dashboard page after login', function () {
  1370. // signInPage.login(username, password);
  1371. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1372. // });
  1373. //
  1374. // it('should open shipping page', function () {
  1375. // dashboardPage.openShippingPage();
  1376. // });
  1377. //
  1378. // it('should delete all zones', function check(done) {
  1379. // commonHelper.waitUntilElementInvisible(shippingPage.imgLoader);
  1380. // shippingPage.allShippings.count().then(function (result) {
  1381. // if (result == 0) {
  1382. // done();
  1383. // } else {
  1384. // shippingPage.allShippings.get(0).getText().then(function (value) {
  1385. // shippingPage.openForEdit(value);
  1386. // addShippingZonePage.clickDeleteZone();
  1387. // });
  1388. // check(done);
  1389. // }
  1390. // })
  1391. // }, 30000);
  1392. //
  1393. // it('should open new zone page', function () {
  1394. // shippingPage.clickAddZone();
  1395. // addShippingZonePage.waitForSaveButton();
  1396. // });
  1397. //
  1398. // it('should add new zone', function () {
  1399. // addShippingZonePage.setZoneName(name);
  1400. // addShippingZonePage.setShippingRate(rate.replace('$', ''));
  1401. // addShippingZonePage.setServiceDescription(description);
  1402. // addShippingZonePage.setCountry(country);
  1403. // addShippingZonePage.clickSave();
  1404. // });
  1405. //
  1406. // it('should contain new shipping zone', function () {
  1407. // commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
  1408. // });
  1409. //
  1410. // it('should redirect on add product page', function () {
  1411. // browser.get(productData.addLink);
  1412. // addProductPage.waitForPublishButton();
  1413. // });
  1414. // });
  1415. //
  1416. // it('should fill new product form', function () {
  1417. // addProductPage.selectType(type);
  1418. // addProductPage.selectFirstCollection();
  1419. // addProductPage.fillTitle(productTitle);
  1420. // addProductPage.fillPrice(firstPrice);
  1421. // addProductPage.fillMetaDescription(description);
  1422. // addProductPage.fillComparePrice(firstComparePrice);
  1423. // addProductPage.fillShippingWeight(weight);
  1424. // addProductPage.addTag(tag);
  1425. // addProductPage.uploadImage(1, firstImage);
  1426. // addProductPage.uploadImage(1, secondImage);
  1427. // });
  1428. //
  1429. // it('should publish product', function () {
  1430. // addProductPage.clickPublish();
  1431. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1432. // });
  1433. //
  1434. // it('should show product page after click on product link', function () {
  1435. // productListPage.clickProduct(productTitle);
  1436. // commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1437. // });
  1438. //
  1439. // it('should click add to cart button', function () {
  1440. // productPage.clickAddToCart();
  1441. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1442. // });
  1443. //
  1444. // it('should go to previous tab', function () {
  1445. // commonHelper.switchToPreviousWithoutClose();
  1446. // });
  1447. //
  1448. // it('should edit product', function () {
  1449. // productListPage.editProduct(productTitle);
  1450. // addProductPage.waitForSaveButton();
  1451. // });
  1452. //
  1453. // it('should fill second prices', function () {
  1454. // addProductPage.fillPrice(secondPrice);
  1455. // addProductPage.fillComparePrice(secondComparePrice);
  1456. // });
  1457. //
  1458. // it('should save product', function () {
  1459. // addProductPage.clickSave();
  1460. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1461. // });
  1462. //
  1463. // it('should go to next tab', function () {
  1464. // commonHelper.switchToNextTab()
  1465. // });
  1466. //
  1467. // it('should click checkout button', function () {
  1468. // cartPage.clickCheckout();
  1469. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1470. // });
  1471. //
  1472. // it('should show correct price for product', function () {
  1473. // expect(checkoutPage.productPrice(productTitle)).toEqual('$20.00 x 1');
  1474. // });
  1475. //
  1476. // it('should show correct subtotal for product', function () {
  1477. // expect(checkoutPage.productSubtotal(productTitle)).toEqual('$20.00');
  1478. // });
  1479. //
  1480. // it('should go to previous tab', function () {
  1481. // commonHelper.switchToPreviousWithoutClose();
  1482. // });
  1483. //
  1484. // it('should edit product', function () {
  1485. // productListPage.editProduct(productTitle);
  1486. // addProductPage.waitForSaveButton();
  1487. // });
  1488. //
  1489. // it('should fill third prices', function () {
  1490. // addProductPage.fillPrice(thirdPrice);
  1491. // addProductPage.fillComparePrice(thirdComparePrice);
  1492. // });
  1493. //
  1494. // it('should save product', function () {
  1495. // addProductPage.clickSave();
  1496. // commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1497. // });
  1498. //
  1499. // it('should go to next tab', function () {
  1500. // commonHelper.switchToNextTab();
  1501. // });
  1502. //
  1503. // it('should fill email address', function () {
  1504. // checkoutPage.fillEmailAddress(emailAddress);
  1505. // });
  1506. //
  1507. // it('should fill contact information form', function () {
  1508. // checkoutPage.selectCountry(country);
  1509. // checkoutPage.selectState(city);
  1510. // checkoutPage.fillCity(city);
  1511. // checkoutPage.fillZip(zip);
  1512. // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1513. // checkoutPage.fillFirstName(firstName);
  1514. // checkoutPage.fillLastName(lastName);
  1515. // checkoutPage.fillStreetAddress(streetAddress);
  1516. // checkoutPage.fillSuite(suite);
  1517. // checkoutPage.fillPhone(phone);
  1518. // });
  1519. //
  1520. // it('should fill payment form', function () {
  1521. // checkoutPage.fillCardNumberField(cardNumber);
  1522. // checkoutPage.fillCardNameField(cardName);
  1523. // checkoutPage.fillCardDateField(cardDate);
  1524. // checkoutPage.fillCVVField(cardCVV);
  1525. // });
  1526. //
  1527. // it('should show correct prices', function () {
  1528. // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1529. // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1530. // expect(checkoutPage.subtotalPrice()).toEqual('$30.00');
  1531. // expect(checkoutPage.taxes()).toEqual('$0.00');
  1532. // expect(checkoutPage.totalPrice()).toEqual('$30.00');
  1533. // });
  1534. //
  1535. // it('should click complete order', function () {
  1536. // checkoutPage.clickCompleteOrder();
  1537. // });
  1538. //
  1539. // it('should show error message', function () {
  1540. // browser.sleep(1000);
  1541. // expect(checkoutPage.chkErrorMessage()).toEqual('Products in your cart have been updated by the store owner, please refresh the page to review the changes');
  1542. // });
  1543. //
  1544. // it('should click complete order', function () {
  1545. // checkoutPage.clickCompleteOrder();
  1546. // commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  1547. // });
  1548. //
  1549. // it('should save order number', function () {
  1550. // checkoutPage.txtOrder.getText().then(function (value) {
  1551. // orderNumber = value.split(' ')[1];
  1552. // });
  1553. // });
  1554. //
  1555. // it('should redirect on admin dashboard page', function () {
  1556. // browser.get(signInData.link);
  1557. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1558. // });
  1559. //
  1560. // it('should open orders list', function () {
  1561. // dashboardPage.openOrdersPage();
  1562. // commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1563. // });
  1564. //
  1565. // it('should show last order in the first row', function () {
  1566. // expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1567. // });
  1568. //
  1569. // it('should open needed order', function () {
  1570. // ordersPage.clickOrderEntry(orderNumber);
  1571. // commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1572. // });
  1573. //
  1574. // it('should show new correct products', function () {
  1575. // expect(ordersPage.productName(productTitle).isDisplayed()).toBeTruthy();
  1576. // });
  1577. //
  1578. // it('should show product image', function () {
  1579. // expect(ordersPage.productImage(productTitle).isDisplayed()).toBeTruthy();
  1580. // });
  1581. //
  1582. // it('should show correct order price', function () {
  1583. // commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1584. // expect(ordersPage.subtotalPrice()).toEqual('$30.00');
  1585. // expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1586. // expect(ordersPage.taxes()).toEqual('$0.00');
  1587. // expect(ordersPage.totalPrice()).toEqual('$40.00');
  1588. // });
  1589. // });
  1590. });
Add Comment
Please, Sign In to add comment