Guest User

core2

a guest
Feb 3rd, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 93.23 KB | None | 0 0
  1. core_edit2_spec.js(то что закомментированно - не работает из-за бага изменения на разных вкладках; последнее не успел доделать, сделаю в пн)
  2.  
  3. var pageObject = require('./../../../services/pages').container.PageObject;
  4. var signInPage = pageObject.getSignInPage();
  5. var dashboardPage = pageObject.getDashboardPage();
  6. var addProductPage = pageObject.getAddProductPage();
  7. var productListPage = pageObject.getProductListPage();
  8. var productPage = pageObject.getProductPage();
  9. var cartPage = pageObject.getCartPage();
  10. var addCollectionPage = pageObject.getAddCollectionPage();
  11. var collectionListPage = pageObject.getCollectionListPage();
  12. var paymentProcessingPage = pageObject.getPaymentProcessingPage();
  13. var shippingPage = pageObject.getShippingPage();
  14. var addShippingZonePage = pageObject.getAddShippingZonePage();
  15. var checkoutPage = pageObject.getCheckoutPage();
  16. var ordersPage = pageObject.getOrdersPage();
  17. var carriersPage = pageObject.getShippingCarriersPage();
  18. var addCarrierPage = pageObject.getAddShippingCarrierPage();
  19. var signUpPage = pageObject.getSignUpPage();
  20. var couponCodesPage = pageObject.getCouponCodesPage();
  21. var addCouponPage = pageObject.getAddCouponPage();
  22. var addCampaignPage = pageObject.getAddCampaignPage();
  23. var upsellCampaignsPage = pageObject.getUpsellCampaignsPage();
  24. var generalSettingsPage = pageObject.getGeneralSettingsPage();
  25. var signInData = require('./../../../data/admin/sign_in/index');
  26. var collectionData = require('./../../../data/admin/collection/index');
  27. var productData = require('./../../../data/admin/product/index');
  28. var coreData = require('./../../../data/admin/core/index');
  29. var shippingData = require('./../../../data/admin/settings/shipping');
  30. var carriersData = require('./../../../data/admin/settings/shipping_carrier/index');
  31. var commonHelper = require('./../../../services/helpers/common.helper.js');
  32.  
  33. describe('Edit Actions', function () {
  34.  
  35. var unique_value = commonHelper.uniqueValue();
  36.  
  37. var cardNumber = coreData.cardNumber;
  38. var cardName = coreData.cardName;
  39. var cardDate = coreData.cardDate;
  40. var cardCVV = coreData.cardCVV;
  41.  
  42. var firstImage = 'car.jpg';
  43. var secondImage = 'bike.png';
  44. var thirdImage = 'laptop.jpg';
  45.  
  46. var firstColor = productData.product.color.first;
  47. var secondColor = productData.product.color.second;
  48. var thirdColor = productData.product.color.third;
  49. var fourthColor = 'Green';
  50. var fifthColor = 'Black';
  51. var sixthColor = 'Blue';
  52. var seventhColor = 'Pink';
  53. var eightColor = 'Purple';
  54.  
  55. var firstSize = productData.product.size.first;
  56. var secondSize = productData.product.size.second;
  57. var thirdSize = productData.product.size.third;
  58. var fourthSize = 'Large';
  59. var fifthSize = 'XL';
  60. var sixthSize = '2XL';
  61. var seventhSize = '3XL';
  62.  
  63. var firstMaterial = 'Catton';
  64. var secondMaterial = 'Wool';
  65.  
  66. var firstStyle = productData.product.style.first;
  67. var secondStyle = productData.product.style.second;
  68.  
  69. var firstVariant = firstColor + ' / ' + firstSize;
  70. var secondVariant = firstColor + ' / ' + fourthSize;
  71. var thirdVariant = firstColor + ' / ' + thirdSize;
  72. var fourthVariant = secondColor + ' / ' + firstSize;
  73.  
  74. var adminUsername = browser.params.adminPanel.username;
  75. var adminPassword = browser.params.adminPanel.password;
  76.  
  77. var collectionTitle = commonHelper.uniqueProductName('collection') + unique_value;
  78. var collectionDescription = collectionData.collection.description.first;
  79.  
  80. var firstProductTitle = commonHelper.uniqueProductName('core1') + unique_value;
  81. var secondProductTitle = commonHelper.uniqueProductName('core2') + unique_value;
  82. var thirdProductTitle = commonHelper.uniqueProductName('core3') + unique_value;
  83. var fourthProductTitle = commonHelper.uniqueProductName('core4') + unique_value;
  84. var fifthProductTitle = commonHelper.uniqueProductName('core5') + unique_value;
  85. var sixthProductTitle = commonHelper.uniqueProductName('core6') + unique_value;
  86. var seventhProductTitle = commonHelper.uniqueProductName('core7') + unique_value;
  87. var eighthProductTitle = commonHelper.uniqueProductName('core8') + unique_value;
  88. var ninthProductTitle = commonHelper.uniqueProductName('core9') + unique_value;
  89. var tenthProductTitle = commonHelper.uniqueProductName('core10') + unique_value;
  90.  
  91. var weight = productData.product.weight;
  92. var tag = productData.product.tag;
  93. var productType = productData.product.type;
  94. var firstProductPrice = '$25.00';
  95. var secondProductPrice = '$30.00';
  96. var thirdProductPrice = '$40.00';
  97. var fourthProductPrice = '$10.00';
  98. var firstCompareProductPrice = '$30.00';
  99. var secondCompareProductPrice = '$35.00';
  100. var thirdCompareProductPrice = '$40.00';
  101.  
  102. var name = shippingData.zone.name.first + unique_value;
  103. var description = shippingData.zone.description.first;
  104. var rate = '$10.00';
  105.  
  106. var storeName = coreData.storeName + '2' + unique_value;
  107. var storeLink = 'https://' + storeName + '.' + browser.params.adminPanel.domain;
  108. var emailAddress = storeName + '@mailinator.com';
  109. var country = coreData.country;
  110. var firstName = coreData.firstName;
  111. var lastName = coreData.lastName;
  112. var streetAddress = coreData.streetAddress;
  113. var suite = coreData.suite;
  114. var city = coreData.city;
  115. var zip = coreData.zip;
  116. var phone = coreData.phone;
  117.  
  118. var carrierTitle = carriersData.title + unique_value;
  119. var trackUrl = carriersData.trackUrl;
  120.  
  121. var firstCampaignName = commonHelper.uniqueProductName('upsell') + commonHelper.randomAlphaNumeric();
  122. var secondCampaignName = commonHelper.uniqueProductName('upsell') + commonHelper.randomAlphaNumeric();
  123. var couponName = 'Big Test';
  124. var validFrom = '11/28/2016';
  125. var couponType = '% off from order total';
  126. var couponDiscount = '10';
  127. var couponCode = 'BIGTEST';
  128.  
  129. var orderNumber;
  130. var signUpLink;
  131. var firstOrderNumber, secondOrderNumber, thirdOrderNumber, fourthOrderNumber, fifthOrderNumber, sixthOrderNumber;
  132.  
  133.  
  134. describe('create new store and add products', function () {
  135.  
  136. beforeAll(function () {
  137. commonHelper.acceptAlert();
  138. browser.get(browser.params.adminPanel.url);
  139. });
  140.  
  141. afterAll(function () {
  142. commonHelper.clearAllData();
  143. });
  144.  
  145. it('should redirect on admin dashboard page after login', function () {
  146. signInPage.login(adminUsername, adminPassword);
  147. commonHelper.waitUntilElementPresent(dashboardPage.txtSuperAdminSearch);
  148. });
  149.  
  150. it('should open first plan details', function () {
  151. dashboardPage.openPlansPage();
  152. dashboardPage.openFirstPlanDetails();
  153. });
  154.  
  155. it('should save sign up link', function () {
  156. dashboardPage.txtSignUpLink.getAttribute('value').then(function (value) {
  157. signUpLink = value;
  158. });
  159. });
  160.  
  161. it('should logout as admin', function () {
  162. dashboardPage.logoutAdmin();
  163. commonHelper.waitUntilElementVisible(signInPage.btnLogin);
  164. });
  165.  
  166. it('should redirect on sign up page', function () {
  167. browser.get(signUpLink);
  168. commonHelper.waitUntilElementVisible(signUpPage.btnSignUp);
  169. });
  170.  
  171. it('should submit sign up form', function () {
  172. signUpPage.fillFullNameField(storeName);
  173. signUpPage.fillEmailField(emailAddress);
  174. signUpPage.fillRetypeEmailField(emailAddress);
  175. signUpPage.fillPasswordField(adminPassword);
  176. signUpPage.clickSignUp();
  177. commonHelper.waitUntilElementVisible(signUpPage.btnCompleteSignUp);
  178. });
  179.  
  180. it('should submit payment details', function () {
  181. signUpPage.fillCardNumberField(cardNumber);
  182. signUpPage.fillCardNameField(cardName);
  183. signUpPage.fillCardDateField(cardDate);
  184. signUpPage.fillCVVField(cardCVV);
  185. signUpPage.clickCompleteSignUp();
  186. commonHelper.waitUntilElementVisible(signUpPage.btnStartBuildingStore);
  187. });
  188.  
  189. it('should submit account information form', function () {
  190. signUpPage.fillAddress(streetAddress);
  191. signUpPage.fillCity(city);
  192. signUpPage.fillSuite(suite);
  193. signUpPage.fillZip(zip);
  194. signUpPage.fillStoreName(storeName);
  195. signUpPage.fillStoreSubdomain(storeName);
  196. signUpPage.fillPhone(phone);
  197. signUpPage.clickStartBuildingStore();
  198. commonHelper.waitUntilElementVisible(signUpPage.btnSignIn);
  199. });
  200.  
  201. it('should click sign-in button', function () {
  202. signUpPage.clickSignIn();
  203. commonHelper.waitUntilElementVisible(signInPage.btnLogin);
  204. });
  205.  
  206. it('should redirect on dashboard page after login', function () {
  207. signInPage.login(emailAddress, adminPassword);
  208. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  209. });
  210.  
  211. it('should open new collection page', function () {
  212. dashboardPage.openAddCollectionPage();
  213. });
  214.  
  215. it('should add new collection', function () {
  216. addCollectionPage.fillTitle(collectionTitle);
  217. addCollectionPage.fillDescription(collectionDescription);
  218. addCollectionPage.clickPublish();
  219. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  220. });
  221.  
  222. it('should open payment processing page', function () {
  223. dashboardPage.openPaymentProcessingPage();
  224. });
  225.  
  226. it('should activate stripe if not activated', function check(done) {
  227. paymentProcessingPage.btnSelectCurrency.isPresent().then(function(result) {
  228. if(result) {
  229. paymentProcessingPage.clickCurrency('USD');
  230. paymentProcessingPage.clickSelectCurrency();
  231. paymentProcessingPage.clickStripeSetup();
  232. paymentProcessingPage.clickConnectWithStripe();
  233. paymentProcessingPage.clickSkipAccountForm();
  234. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  235. check(done);
  236. } else {
  237. done();
  238. }
  239. })
  240. }, 50000);
  241.  
  242. it('should open shipping page', function () {
  243. dashboardPage.openShippingPage();
  244. });
  245.  
  246. it('should delete all zones', function check(done) {
  247. commonHelper.waitUntilElementInvisible(shippingPage.imgLoader);
  248. shippingPage.allShippings.count().then(function(result) {
  249. if(result == 0) {
  250. done();
  251. } else {
  252. shippingPage.allShippings.get(0).getText().then(function (value) {
  253. shippingPage.openForEdit(value);
  254. addShippingZonePage.clickDeleteZone();
  255. });
  256. check(done);
  257. }
  258. })
  259. }, 30000);
  260.  
  261. it('should open new zone page', function () {
  262. shippingPage.clickAddZone();
  263. addShippingZonePage.waitForSaveButton();
  264. });
  265.  
  266. it('should add new zone', function () {
  267. addShippingZonePage.setZoneName(name);
  268. addShippingZonePage.setShippingRate(rate.replace('$', ''));
  269. addShippingZonePage.setServiceDescription(description);
  270. addShippingZonePage.setCountry(country);
  271. addShippingZonePage.clickSave();
  272. });
  273.  
  274. it('should contain new shipping zone', function() {
  275. commonHelper.waitUntilElementVisible(shippingPage.shippingZoneEntry(name));
  276. });
  277.  
  278. it('should open shipping carriers page', function () {
  279. dashboardPage.openShippingCarriersPage();
  280. commonHelper.waitUntilElementClickable(carriersPage.btnAddCarrier);
  281. });
  282.  
  283. it('should open new carrier modal', function () {
  284. carriersPage.clickAddCarrier();
  285. commonHelper.waitUntilElementVisible(addCarrierPage.btnAdd);
  286. });
  287.  
  288. it('should add new carrier', function () {
  289. addCarrierPage.fillName(carrierTitle);
  290. addCarrierPage.fillUrl(trackUrl);
  291. addCarrierPage.clickAdd();
  292. commonHelper.waitUntilElementVisible(carriersPage.shippingEntry(carrierTitle));
  293. });
  294.  
  295. it('should open add product page', function () {
  296. dashboardPage.openAddProductPage();
  297. addProductPage.waitForPublishButton();
  298. });
  299.  
  300. it('should add first product', function () {
  301. addProductPage.fillType(productType);
  302. addProductPage.selectFirstCollection();
  303. addProductPage.fillTitle(firstProductTitle);
  304. addProductPage.fillPrice(firstProductPrice.replace('$', ''));
  305. addProductPage.uploadImage(1, firstImage);
  306. addProductPage.uploadImage(1, firstImage);
  307. addProductPage.clickPublish();
  308. commonHelper.waitUntilElementVisible(productListPage.productEntry(firstProductTitle));
  309. dashboardPage.clickCloseAlert();
  310. });
  311.  
  312. it('should open add product page', function () {
  313. dashboardPage.openAddProductPage();
  314. addProductPage.waitForPublishButton();
  315. });
  316.  
  317. it('should add second product', function () {
  318. addProductPage.selectType(productType);
  319. addProductPage.selectFirstCollection(collectionTitle);
  320. addProductPage.fillTitle(secondProductTitle);
  321. addProductPage.uploadImage(1, firstImage);
  322. addProductPage.uploadImage(1, firstImage);
  323. addProductPage.fillPrice(secondProductPrice.replace('$', ''));
  324. addProductPage.clickPublish();
  325. commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  326. dashboardPage.clickCloseAlert();
  327. });
  328.  
  329. it('should open add product page', function () {
  330. dashboardPage.openAddProductPage();
  331. addProductPage.waitForPublishButton();
  332. });
  333.  
  334. it('should add third product', function () {
  335. addProductPage.clickMulti();
  336. addProductPage.selectType(productType);
  337. addProductPage.selectFirstCollection();
  338. addProductPage.fillTitle(thirdProductTitle);
  339. addProductPage.fillShippingWeight(weight);
  340. addProductPage.addTag(tag);
  341. addProductPage.fillOptionTitle(0, 'Color');
  342. addProductPage.fillOptionValue(0, firstColor);
  343. addProductPage.fillOptionValue(0, sixthColor);
  344. addProductPage.clickProductLookCheckbox(0);
  345. addProductPage.fillOptionTitle(1, 'Size');
  346. addProductPage.fillOptionValue(1, firstSize);
  347. addProductPage.fillOptionValue(1, secondSize);
  348. addProductPage.fillVariantPrice(firstVariant, firstProductPrice);
  349. addProductPage.clickVariantPriceAutofill(firstVariant);
  350. addProductPage.fillVariantComparePrice(firstVariant, firstCompareProductPrice);
  351. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  352. addProductPage.uploadImage(0, firstImage);
  353. addProductPage.uploadImage(0, firstImage);
  354. addProductPage.uploadImage(1, secondImage);
  355. addProductPage.uploadImage(1, secondImage);
  356.  
  357. addProductPage.clickPublish();
  358. commonHelper.waitUntilElementVisible(productListPage.productEntry(thirdProductTitle));
  359. dashboardPage.clickCloseAlert();
  360. });
  361.  
  362. it('should open add product page', function () {
  363. dashboardPage.openAddProductPage();
  364. addProductPage.waitForPublishButton();
  365. });
  366.  
  367. it('should add fourth product', function () {
  368. addProductPage.clickMulti();
  369. addProductPage.selectType(productType);
  370. addProductPage.selectFirstCollection();
  371. addProductPage.fillTitle(fourthProductTitle);
  372. addProductPage.fillShippingWeight(weight);
  373. addProductPage.addTag(tag);
  374. addProductPage.fillOptionTitle(0, 'Color');
  375. addProductPage.fillOptionValue(0, firstColor);
  376. addProductPage.fillOptionValue(0, secondColor);
  377. addProductPage.clickProductLookCheckbox(0);
  378. addProductPage.fillOptionTitle(1, 'Size');
  379. addProductPage.fillOptionValue(1, fourthSize);
  380. addProductPage.fillOptionValue(1, fifthSize);
  381. addProductPage.fillVariantPrice(secondVariant, firstProductPrice);
  382. addProductPage.clickVariantPriceAutofill(secondVariant);
  383. addProductPage.fillVariantComparePrice(secondVariant, firstCompareProductPrice);
  384. addProductPage.clickVariantComparePriceAutofill(secondVariant);
  385. addProductPage.uploadImage(0, firstImage);
  386. addProductPage.uploadImage(0, firstImage);
  387. addProductPage.uploadImage(1, secondImage);
  388. addProductPage.uploadImage(1, secondImage);
  389.  
  390. addProductPage.clickPublish();
  391. commonHelper.waitUntilElementVisible(productListPage.productEntry(fourthProductTitle));
  392. dashboardPage.clickCloseAlert();
  393. });
  394.  
  395. it('should open add product page', function () {
  396. dashboardPage.openAddProductPage();
  397. addProductPage.waitForPublishButton();
  398. });
  399.  
  400. it('should add fifth product', function () {
  401. addProductPage.clickMulti();
  402. addProductPage.selectType(productType);
  403. addProductPage.selectFirstCollection();
  404. addProductPage.fillTitle(fifthProductTitle);
  405. addProductPage.fillShippingWeight(weight);
  406. addProductPage.addTag(tag);
  407. addProductPage.fillOptionTitle(0, 'Color');
  408. addProductPage.fillOptionValue(0, firstColor);
  409. addProductPage.fillOptionValue(0, sixthColor);
  410. addProductPage.clickProductLookCheckbox(0);
  411. addProductPage.fillOptionTitle(1, 'Size');
  412. addProductPage.fillOptionValue(1, firstSize);
  413. addProductPage.fillOptionValue(1, secondSize);
  414. addProductPage.fillVariantPrice(firstVariant, fourthProductPrice);
  415. addProductPage.clickVariantPriceAutofill(firstVariant);
  416. addProductPage.fillVariantComparePrice(firstVariant, firstCompareProductPrice);
  417. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  418. addProductPage.uploadImage(0, firstImage);
  419. addProductPage.uploadImage(0, firstImage);
  420. addProductPage.uploadImage(1, secondImage);
  421. addProductPage.uploadImage(1, secondImage);
  422.  
  423. addProductPage.clickPublish();
  424. commonHelper.waitUntilElementVisible(productListPage.productEntry(fifthProductTitle));
  425. dashboardPage.clickCloseAlert();
  426. });
  427.  
  428. it('should open add product page', function () {
  429. dashboardPage.openAddProductPage();
  430. addProductPage.waitForPublishButton();
  431. });
  432.  
  433. it('should add sixth product', function () {
  434. addProductPage.clickMulti();
  435. addProductPage.selectType(productType);
  436. addProductPage.selectFirstCollection();
  437. addProductPage.fillTitle(sixthProductTitle);
  438. addProductPage.fillShippingWeight(weight);
  439. addProductPage.addTag(tag);
  440. addProductPage.fillOptionTitle(0, 'Color');
  441. addProductPage.fillOptionValue(0, firstColor);
  442. addProductPage.fillOptionValue(0, sixthColor);
  443. addProductPage.clickProductLookCheckbox(0);
  444. addProductPage.fillOptionTitle(1, 'Size');
  445. addProductPage.fillOptionValue(1, firstSize);
  446. addProductPage.fillOptionValue(1, secondSize);
  447. addProductPage.fillVariantPrice(firstVariant, firstProductPrice);
  448. addProductPage.clickVariantPriceAutofill(firstVariant);
  449. addProductPage.fillVariantComparePrice(firstVariant, firstCompareProductPrice);
  450. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  451. addProductPage.uploadImage(0, firstImage);
  452. addProductPage.uploadImage(0, firstImage);
  453. addProductPage.uploadImage(1, secondImage);
  454. addProductPage.uploadImage(1, secondImage);
  455.  
  456. addProductPage.clickPublish();
  457. commonHelper.waitUntilElementVisible(productListPage.productEntry(sixthProductTitle));
  458. dashboardPage.clickCloseAlert();
  459. });
  460.  
  461.  
  462. it('should open add product page', function () {
  463. dashboardPage.openAddProductPage();
  464. addProductPage.waitForPublishButton();
  465. });
  466.  
  467. it('should add seventh product', function () {
  468. addProductPage.clickMulti();
  469. addProductPage.selectType(productType);
  470. addProductPage.selectFirstCollection();
  471. addProductPage.fillTitle(seventhProductTitle);
  472. addProductPage.fillShippingWeight(weight);
  473. addProductPage.addTag(tag);
  474. addProductPage.fillOptionTitle(0, 'Color');
  475. addProductPage.fillOptionValue(0, firstColor);
  476. addProductPage.fillOptionValue(0, sixthColor);
  477. addProductPage.clickProductLookCheckbox(0);
  478. addProductPage.fillOptionTitle(1, 'Size');
  479. addProductPage.fillOptionValue(1, firstSize);
  480. addProductPage.fillOptionValue(1, secondSize);
  481. addProductPage.fillVariantPrice(firstVariant, firstProductPrice);
  482. addProductPage.clickVariantPriceAutofill(firstVariant);
  483. addProductPage.fillVariantComparePrice(firstVariant, firstCompareProductPrice);
  484. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  485. addProductPage.uploadImage(0, firstImage);
  486. addProductPage.uploadImage(0, firstImage);
  487. addProductPage.uploadImage(1, secondImage);
  488. addProductPage.uploadImage(1, secondImage);
  489.  
  490. addProductPage.clickPublish();
  491. commonHelper.waitUntilElementVisible(productListPage.productEntry(sixthProductTitle));
  492. dashboardPage.clickCloseAlert();
  493. });
  494.  
  495. it('should open add product page', function () {
  496. dashboardPage.openAddProductPage();
  497. addProductPage.waitForPublishButton();
  498. });
  499.  
  500. it('should add seventh product', function () {
  501. addProductPage.clickMulti();
  502. addProductPage.selectType(productType);
  503. addProductPage.selectFirstCollection();
  504. addProductPage.fillTitle(eighthroductTitle);
  505. addProductPage.fillShippingWeight(weight);
  506. addProductPage.addTag(tag);
  507. addProductPage.fillOptionTitle(0, 'Color');
  508. addProductPage.fillOptionValue(0, firstColor);
  509. addProductPage.fillOptionValue(0, sixthColor);
  510. addProductPage.clickProductLookCheckbox(0);
  511. addProductPage.fillOptionTitle(1, 'Size');
  512. addProductPage.fillOptionValue(1, firstSize);
  513. addProductPage.fillOptionValue(1, secondSize);
  514. addProductPage.fillVariantPrice(firstVariant, firstProductPrice);
  515. addProductPage.clickVariantPriceAutofill(firstVariant);
  516. addProductPage.fillVariantComparePrice(firstVariant, firstCompareProductPrice);
  517. addProductPage.clickVariantComparePriceAutofill(firstVariant);
  518. addProductPage.uploadImage(0, firstImage);
  519. addProductPage.uploadImage(0, firstImage);
  520. addProductPage.uploadImage(1, secondImage);
  521. addProductPage.uploadImage(1, secondImage);
  522.  
  523. addProductPage.clickPublish();
  524. commonHelper.waitUntilElementVisible(productListPage.productEntry(sixthProductTitle));
  525. dashboardPage.clickCloseAlert();
  526. });
  527.  
  528. it('should open codes page', function () {
  529. dashboardPage.openCouponCodesPage();
  530. commonHelper.waitUntilElementPresent(couponCodesPage.btnAdd);
  531. });
  532.  
  533. it('should open new coupon code page', function () {
  534. couponCodesPage.clickAddCouponCode();
  535. commonHelper.waitUntilElementVisible(addCouponPage.txtName);
  536. });
  537.  
  538. it('should add new coupon code', function () {
  539. addCouponPage.fillName(couponName);
  540. addCouponPage.fillValidFrom(validFrom);
  541. addCouponPage.selectDiscountType(couponType);
  542. addCouponPage.fillDiscount(couponDiscount);
  543. addCouponPage.fillCode(couponCode);
  544. addCouponPage.clickSave();
  545. commonHelper.waitUntilElementInvisible(addCouponPage.imgLoader);
  546. commonHelper.waitUntilElementVisible(couponCodesPage.couponCodeEntry(couponName));
  547. });
  548.  
  549. it('should close add coupon code page', function () {
  550. addCouponPage.clickClose();
  551. commonHelper.waitUntilElementVisible(couponCodesPage.eleDiscountCode);
  552. });
  553.  
  554. it('should open up-sell campaigns page', function () {
  555. dashboardPage.openUpsellCampaignsPage();
  556. commonHelper.waitUntilElementPresent(upsellCampaignsPage.btnAdd);
  557. });
  558.  
  559. it('should open new campaign page', function () {
  560. upsellCampaignsPage.clickAddCampaign();
  561. upsellCampaignsPage.selectBuyType();
  562. });
  563.  
  564. it('should fill campaign name', function () {
  565. commonHelper.waitUntilElementPresent(addCampaignPage.btnSubmit);
  566. addCampaignPage.fillName(firstCampaignName);
  567. });
  568.  
  569. it('should add product to campaign', function () {
  570. addCampaignPage.selectManual();
  571. addCampaignPage.clickAddItems();
  572. addCampaignPage.fillSearch(seventhProductTitle);
  573. commonHelper.waitUntilElementVisible(addCampaignPage.searchedProductEntry(seventhProductTitle));
  574. addCampaignPage.clickProduct(ninethProductTitle);
  575. addCampaignPage.clickCloseAddItems();
  576. });
  577.  
  578. it('should add new campaign', function () {
  579. addCampaignPage.fillBuyItems('10');
  580. addCampaignPage.fillItemsFree('1');
  581. addCampaignPage.clickSubmit();
  582. commonHelper.waitUntilElementVisible(upsellCampaignsPage.campaignEntry(firstCampaignName));
  583. });
  584.  
  585. it('should open up-sell campaigns page', function () {
  586. dashboardPage.openUpsellCampaignsPage();
  587. commonHelper.waitUntilElementPresent(upsellCampaignsPage.btnAdd);
  588. });
  589.  
  590. it('should open new campaign page', function () {
  591. upsellCampaignsPage.clickAddCampaign();
  592. upsellCampaignsPage.selectBuyTypeStorewide();
  593. });
  594.  
  595. it('should add product to compaign', function () {
  596. addCampaignPage.selectManual();
  597. addCampaignPage.clickAddItems();
  598. addCampaignPage.fillSearch(eighthProductTitle);
  599. commonHelper.waitUntilElementVisible(addCampaignPage.searchedProductEntry(eighthProductTitle));
  600. addCampaignPage.clickProduct(eighthProductTitle);
  601. addCampaignPage.clickCloseAddItems();
  602. });
  603.  
  604. it('should add new campaign', function () {
  605. addCampaignPage.fillDiscount('1');
  606. addCampaignPage.fillDiscountExpiration('10');
  607. addCampaignPage.fillButtonText('Button text');
  608. addCampaignPage.clickSubmit();
  609. commonHelper.waitUntilElementVisible(upsellCampaignsPage.campaignEntry(secondCampaignName));
  610. });
  611. });
  612.  
  613. describe('checking for edit single variant product and checking effect on existing orders with it', function () {
  614.  
  615. beforeAll(function () {
  616. commonHelper.acceptAlert();
  617. browser.get(signInData.link);
  618. });
  619.  
  620. afterAll(function () {
  621. commonHelper.clearAllData();
  622. });
  623.  
  624. it('should redirect on dashboard page after login', function () {
  625. browser.get(storeLink + '/admin');
  626. signInPage.login(emailAddress, adminPassword);
  627. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  628. });
  629.  
  630. it('should open products list page', function () {
  631. dashboardPage.openProductListPage();
  632. });
  633.  
  634. it('should show product page after click on product link', function () {
  635. productListPage.clickProduct(firstProductTitle);
  636. });
  637.  
  638. it('should show main product image', function () {
  639. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  640. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  641. });
  642.  
  643. it('should click add to cart button', function () {
  644. productPage.clickAddToCart();
  645. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  646. });
  647.  
  648. it('should click checkout button', function () {
  649. cartPage.clickCheckout();
  650. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  651. });
  652.  
  653. it('should fill email address', function () {
  654. checkoutPage.fillEmailAddress(emailAddress);
  655. });
  656.  
  657. it('should fill contact information form', function () {
  658. checkoutPage.selectCountry(country);
  659. checkoutPage.selectState(city);
  660. checkoutPage.fillCity(city);
  661. checkoutPage.fillZip(zip);
  662. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  663. checkoutPage.fillFirstName(firstName);
  664. checkoutPage.fillLastName(lastName);
  665. checkoutPage.fillStreetAddress(streetAddress);
  666. checkoutPage.fillSuite(suite);
  667. checkoutPage.fillPhone(phone);
  668. });
  669.  
  670. it('should fill payment form', function () {
  671. checkoutPage.fillCardNumberField(cardNumber);
  672. checkoutPage.fillCardNameField(cardName);
  673. checkoutPage.fillCardDateField(cardDate);
  674. checkoutPage.fillCVVField(cardCVV);
  675. });
  676.  
  677. it('should show correct prices', function () {
  678. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  679. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  680. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  681. expect(checkoutPage.taxes()).toEqual('$0.00');
  682. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  683. });
  684.  
  685. it('should click complete order', function () {
  686. checkoutPage.clickCompleteOrder();
  687. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  688. });
  689.  
  690. it('should save order number', function () {
  691. checkoutPage.txtOrder.getText().then(function (value) {
  692. orderNumber = value.split(' ')[1];
  693. });
  694. });
  695.  
  696. it('should open orders page', function () {
  697. commonHelper.switchToPreviousTab();
  698. dashboardPage.openOrdersPage();
  699. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  700. });
  701.  
  702. it('should show last order in the first row', function () {
  703. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  704. });
  705.  
  706. it('should open needed order', function () {
  707. ordersPage.clickOrderEntry(orderNumber);
  708. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  709. });
  710.  
  711. it('should show product image', function () {
  712. expect(ordersPage.productImage(firstProductTitle).isDisplayed()).toBeTruthy();
  713. });
  714.  
  715. it('should show correct order price', function () {
  716. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  717. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  718. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  719. expect(ordersPage.taxes()).toEqual('$0.00');
  720. expect(ordersPage.totalPrice()).toEqual('$35.00');
  721. });
  722.  
  723. it('should open products list page', function () {
  724. dashboardPage.openProductListPage();
  725. commonHelper.waitUntilElementVisible(productListPage.productEntry(firstProductTitle));
  726. });
  727.  
  728. it('should open edit product', function () {
  729. productListPage.editProduct(firstProductTitle);
  730. addProductPage.waitForSaveButton();
  731. });
  732.  
  733. it('should edit product prices and title', function () {
  734. addProductPage.fillTitle(ninethProductTitle);
  735. addProductPage.fillPrice(secondProductPrice);
  736. });
  737.  
  738. it('should delete old pictures', function () {
  739. addProductPage.deleteImage(1);
  740. addProductPage.deleteImage(1);
  741. });
  742.  
  743. it('should add another pictures', function () {
  744. addProductPage.uploadImage(1, thirdImage);
  745. addProductPage.uploadImage(1, secondImage);
  746. });
  747.  
  748. it('should save product', function () {
  749. addProductPage.clickSave();
  750. commonHelper.waitUntilElementVisible(productListPage.productEntry(ninethProductTitle));
  751. });
  752.  
  753. it('should redirect on dashboard page', function () {
  754. browser.get(storeLink + '/admin');
  755. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  756. });
  757.  
  758. it('should open orders list', function () {
  759. dashboardPage.openOrdersPage();
  760. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  761. });
  762.  
  763. it('should show last order in the first row', function () {
  764. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  765. });
  766.  
  767. it('should open needed order', function () {
  768. ordersPage.clickOrderEntry(orderNumber);
  769. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  770. });
  771.  
  772. it('should show new correct products', function () {
  773. expect(ordersPage.productName(firstProductTitle).isDisplayed()).toBeTruthy();
  774. });
  775.  
  776. it('should show new product image', function () {
  777. expect(ordersPage.productImage(firstProductTitle).isDisplayed()).toBeTruthy();
  778. });
  779.  
  780. it('should show correct order price', function () {
  781. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  782. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  783. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  784. expect(ordersPage.taxes()).toEqual('$0.00');
  785. expect(ordersPage.totalPrice()).toEqual('$35.00');
  786. });
  787.  
  788. it('should open products list page', function () {
  789. dashboardPage.openProductListPage();
  790. });
  791.  
  792. it('should show product page after click on product link', function () {
  793. productListPage.clickProduct(ninthProductTitle);
  794. });
  795.  
  796. it('should show main product image', function () {
  797. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  798. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  799. });
  800.  
  801. it('should show correct product price', function () {
  802. expect(productPage.productPrice()).toEqual(secondProductPrice.replace('$', ''));
  803. });
  804.  
  805. it('should show correct product name', function () {
  806. expect(productPage.productTitle()).toEqual(ninthProductTitle);
  807. });
  808.  
  809. it('should show correct number of thumbs', function () {
  810. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  811. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  812. browser.sleep(1000);
  813. expect(productPage.allThumbs.count()).toEqual(2);
  814. });
  815.  
  816. it('should select 1 product', function () {
  817. productPage.clickUp(1);
  818. });
  819.  
  820. it('should click add to cart button', function () {
  821. productPage.clickAddToCart();
  822. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  823. });
  824.  
  825. it('should show correct total price in cart', function () {
  826. expect(cartPage.totalPrice()).toEqual('30.00');
  827. });
  828.  
  829. it('should click checkout button', function () {
  830. cartPage.clickCheckout();
  831. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  832. });
  833.  
  834. it('should show correct product', function () {
  835. expect(checkoutPage.productName(ninthProductTitle).isDisplayed()).toBeTruthy();
  836. });
  837.  
  838. it('should show product images', function () {
  839. expect(checkoutPage.productImage(ninthProductTitle).isDisplayed()).toBeTruthy();
  840. });
  841.  
  842. it('should show correct prices for products', function () {
  843. expect(checkoutPage.productPrice(ninthProductTitle)).toEqual('$30.00 x 1');
  844. });
  845.  
  846. it('should show correct subtotals for products', function () {
  847. expect(checkoutPage.productSubtotal(ninthProductTitle)).toEqual('$30.00');
  848. });
  849.  
  850. });
  851. //
  852. // describe('checking for edit single variant product and checking effect on cart and checkout on fes', function () {
  853. //
  854. // beforeAll(function () {
  855. // commonHelper.acceptAlert();
  856. // browser.get(signInData.link);
  857. // });
  858. //
  859. // afterAll(function () {
  860. // commonHelper.clearAllData();
  861. // });
  862. //
  863. // it('should redirect on dashboard page after login', function () {
  864. // browser.get(storeLink + '/admin');
  865. // signInPage.login(emailAddress, adminPassword);
  866. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  867. // });
  868. //
  869. // it('should open products list page', function () {
  870. // dashboardPage.openProductListPage();
  871. // });
  872. //
  873. // it('should show product page after click on product link', function () {
  874. // productListPage.clickProduct(secondProductTitle);
  875. // });
  876. //
  877. // it('should click add to cart button', function () {
  878. // productPage.clickAddToCart();
  879. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  880. // });
  881. //
  882. // it('should switch to previous tab', function () {
  883. // commonHelper.switchToPreviousWithoutClose();
  884. // });
  885. //
  886. // t('should open edit product', function () {
  887. // productListPage.editProduct(secondProductTitle);
  888. // addProductPage.waitForSaveButton();
  889. // });
  890. //
  891. // it('should fill first and second variant prices', function () {
  892. // addProductPage.fillPrice(secondProductPrice);
  893. // });
  894. //
  895. // it('should save product', function () {
  896. // addProductPage.clickSave();
  897. // commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  898. // });
  899. //
  900. // it('should go to next tab', function () {
  901. // commonHelper.switchToNextTab()
  902. // });
  903. //
  904. // it('should click checkout button', function () {
  905. // cartPage.clickCheckout();
  906. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  907. // });
  908. //
  909. // it('should show correct product', function () {
  910. // expect(checkoutPage.productName(secondProductTitle).isDisplayed()).toBeTruthy();
  911. // });
  912. //
  913. // it('should show product images', function () {
  914. // expect(checkoutPage.productImage(secondProductTitle).isDisplayed()).toBeTruthy();
  915. // });
  916. //
  917. // it('should show correct prices for products', function () {
  918. // expect(checkoutPage.productPrice(secondProductTitle)).toEqual('$30.00 x 1');
  919. // });
  920. //
  921. // it('should show correct subtotals for products', function () {
  922. // expect(checkoutPage.productSubtotal(secondProductTitle)).toEqual('$30.00');
  923. // });
  924. //
  925. // it('should go to previous tab', function () {
  926. // commonHelper.switchToPreviousWithoutClose();
  927. // });
  928. //
  929. // it('should open edit product', function () {
  930. // productListPage.editProduct(secondProductTitle);
  931. // addProductPage.waitForSaveButton();
  932. // });
  933. //
  934. // it('should fill first and second variant prices', function () {
  935. // addProductPage.fillPrice(thirdProductPrice);
  936. // });
  937. //
  938. // it('should save product', function () {
  939. // addProductPage.clickSave();
  940. // commonHelper.waitUntilElementVisible(productListPage.productEntry(secondProductTitle));
  941. // });
  942. //
  943. // it('should go to next tab', function () {
  944. // commonHelper.switchToNextTab();
  945. // });
  946. //
  947. //
  948. // it('should fill email address', function () {
  949. // checkoutPage.fillEmailAddress(emailAddress);
  950. // });
  951. //
  952. // it('should fill contact information form', function () {
  953. // checkoutPage.selectCountry(country);
  954. // checkoutPage.selectState(city);
  955. // checkoutPage.fillCity(city);
  956. // checkoutPage.fillZip(zip);
  957. // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  958. // checkoutPage.fillFirstName(firstName);
  959. // checkoutPage.fillLastName(lastName);
  960. // checkoutPage.fillStreetAddress(streetAddress);
  961. // checkoutPage.fillSuite(suite);
  962. // checkoutPage.fillPhone(phone);
  963. // });
  964. //
  965. // it('should fill payment form', function () {
  966. // checkoutPage.fillCardNumberField(cardNumber);
  967. // checkoutPage.fillCardNameField(cardName);
  968. // checkoutPage.fillCardDateField(cardDate);
  969. // checkoutPage.fillCVVField(cardCVV);
  970. // });
  971. //
  972. // it('should show correct prices', function () {
  973. // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  974. // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  975. // expect(checkoutPage.subtotalPrice()).toEqual('$30.00');
  976. // expect(checkoutPage.taxes()).toEqual('$0.00');
  977. // expect(checkoutPage.totalPrice()).toEqual('$30.00');
  978. // });
  979. //
  980. // it('should click complete order', function () {
  981. // checkoutPage.clickCompleteOrder();
  982. // });
  983. //
  984. // it('should show error message', function () {
  985. // browser.sleep(2000);
  986. // expect(checkoutPage.chkErrorMessage()).toEqual('Products in your cart have been updated by the store owner, please refresh the page to review the changes');
  987. // });
  988. //
  989. // it('should click complete order again', function () {
  990. // checkoutPage.clickCompleteOrder();
  991. // });
  992. // });
  993.  
  994.  
  995. describe('checking for Edit multi variant product prices, images and names and then checking effect on existing orders with it', function () {
  996.  
  997. beforeAll(function () {
  998. commonHelper.acceptAlert();
  999. browser.get(signInData.link);
  1000. });
  1001.  
  1002. afterAll(function () {
  1003. commonHelper.clearAllData();
  1004. });
  1005.  
  1006. it('should redirect on dashboard page after login', function () {
  1007. browser.get(storeLink + '/admin');
  1008. signInPage.login(emailAddress, adminPassword);
  1009. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1010. });
  1011.  
  1012. it('should open products list page', function () {
  1013. dashboardPage.openProductListPage();
  1014. });
  1015.  
  1016. it('should show product page after click on product link', function () {
  1017. productListPage.clickProduct(thirdProductTitle);
  1018. });
  1019.  
  1020. it('should click add to cart button', function () {
  1021. browser.sleep(2000);
  1022. productPage.clickAddToCart();
  1023. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1024. });
  1025.  
  1026. it('should click checkout button', function () {
  1027. cartPage.clickCheckout();
  1028. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1029. });
  1030.  
  1031. it('should fill email address', function () {
  1032. checkoutPage.fillEmailAddress(emailAddress);
  1033. });
  1034.  
  1035. it('should fill contact information form', function () {
  1036. checkoutPage.selectCountry(country);
  1037. checkoutPage.selectState(city);
  1038. checkoutPage.fillCity(city);
  1039. checkoutPage.fillZip(zip);
  1040. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1041. checkoutPage.fillFirstName(firstName);
  1042. checkoutPage.fillLastName(lastName);
  1043. checkoutPage.fillStreetAddress(streetAddress);
  1044. checkoutPage.fillSuite(suite);
  1045. checkoutPage.fillPhone(phone);
  1046. });
  1047.  
  1048. it('should fill payment form', function () {
  1049. checkoutPage.fillCardNumberField(cardNumber);
  1050. checkoutPage.fillCardNameField(cardName);
  1051. checkoutPage.fillCardDateField(cardDate);
  1052. checkoutPage.fillCVVField(cardCVV);
  1053. });
  1054.  
  1055. it('should show correct prices', function () {
  1056. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1057. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1058. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  1059. expect(checkoutPage.taxes()).toEqual('$0.00');
  1060. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  1061. });
  1062.  
  1063. it('should click complete order', function () {
  1064. checkoutPage.clickCompleteOrder();
  1065. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  1066. });
  1067.  
  1068. it('should save order number', function () {
  1069. checkoutPage.txtOrder.getText().then(function (value) {
  1070. orderNumber = value.split(' ')[1];
  1071. });
  1072. });
  1073.  
  1074. it('should open orders page', function () {
  1075. commonHelper.switchToPreviousTab();
  1076. dashboardPage.openOrdersPage();
  1077. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1078. });
  1079.  
  1080. it('should show last order in the first row', function () {
  1081. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1082. });
  1083.  
  1084. it('should open needed order', function () {
  1085. ordersPage.clickOrderEntry(orderNumber);
  1086. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1087. });
  1088.  
  1089. it('should show product image', function () {
  1090. expect(ordersPage.productImage(thirdProductTitle).isDisplayed()).toBeTruthy();
  1091. });
  1092.  
  1093. it('should show correct order price', function () {
  1094. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1095. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1096. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1097. expect(ordersPage.taxes()).toEqual('$0.00');
  1098. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1099. });
  1100.  
  1101. it('should open products list page', function () {
  1102. dashboardPage.openProductListPage();
  1103. commonHelper.waitUntilElementVisible(productListPage.productEntry(thirdProductTitle));
  1104. });
  1105.  
  1106. it('should open edit product', function () {
  1107. productListPage.editProduct(thirdProductTitle);
  1108. addProductPage.waitForSaveButton();
  1109. });
  1110.  
  1111. it('should edit product prices and title', function () {
  1112. addProductPage.fillTitle(tenthProductTitle);
  1113. addProductPage.fillVariantPrice(firstVariant, secondProductPrice);
  1114. addProductPage.clickVariantPriceAutofill(firstVariant);
  1115. });
  1116.  
  1117. it('should delete old pictures', function () {
  1118. browser.sleep(2000);
  1119. addProductPage.deleteImage(0);
  1120. addProductPage.deleteImage(0);
  1121. addProductPage.deleteImage(1);
  1122. addProductPage.deleteImage(1);
  1123. });
  1124.  
  1125. it('should add another pictures', function () {
  1126. addProductPage.uploadImage(0, thirdImage);
  1127. addProductPage.uploadImage(0, secondImage);
  1128. addProductPage.uploadImage(1, thirdImage);
  1129. addProductPage.uploadImage(1, secondImage);
  1130. });
  1131.  
  1132. it('should save product', function () {
  1133. addProductPage.clickSave();
  1134. commonHelper.waitUntilElementVisible(productListPage.productEntry(tenthProductTitle));
  1135. });
  1136.  
  1137. it('should redirect on dashboard page', function () {
  1138. browser.get(storeLink + '/admin');
  1139. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1140. });
  1141.  
  1142. it('should open orders list', function () {
  1143. dashboardPage.openOrdersPage();
  1144. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1145. });
  1146.  
  1147. it('should show last order in the first row', function () {
  1148. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1149. });
  1150.  
  1151. it('should open needed order', function () {
  1152. ordersPage.clickOrderEntry(orderNumber);
  1153. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1154. });
  1155.  
  1156. it('should show new correct products', function () {
  1157. expect(ordersPage.productName(thirdProductTitle).isDisplayed()).toBeTruthy();
  1158. });
  1159.  
  1160. it('should show new product image', function () {
  1161. expect(ordersPage.productImage(thirdProductTitle).isDisplayed()).toBeTruthy();
  1162. });
  1163.  
  1164. it('should show correct order price', function () {
  1165. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1166. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1167. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1168. expect(ordersPage.taxes()).toEqual('$0.00');
  1169. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1170. });
  1171.  
  1172. it('should open products list page', function () {
  1173. dashboardPage.openProductListPage();
  1174. });
  1175.  
  1176. it('should show product page after click on product link', function () {
  1177. productListPage.clickProduct(tenthProductTitle);
  1178. });
  1179.  
  1180. it('should show main product image', function () {
  1181. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1182. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1183. });
  1184.  
  1185. it('should show correct product price', function () {
  1186. expect(productPage.productPrice()).toEqual(secondProductPrice.replace('$', ''));
  1187. });
  1188.  
  1189. it('should show correct product name', function () {
  1190. expect(productPage.productTitle()).toEqual(tenthProductTitle);
  1191. });
  1192.  
  1193. it('should show correct number of thumbs', function () {
  1194. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1195. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1196. browser.sleep(1000);
  1197. expect(productPage.allThumbs.count()).toEqual(2);
  1198. });
  1199.  
  1200. it('should select 1 product', function () {
  1201. productPage.clickUp(1);
  1202. });
  1203.  
  1204. it('should click add to cart button', function () {
  1205. productPage.clickAddToCart();
  1206. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1207. });
  1208.  
  1209. it('should show correct total price in cart', function () {
  1210. expect(cartPage.totalPrice()).toEqual('30.00');
  1211. });
  1212.  
  1213. it('should click checkout button', function () {
  1214. cartPage.clickCheckout();
  1215. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1216. });
  1217.  
  1218. it('should show correct product', function () {
  1219. expect(checkoutPage.productName(tenthProductTitle).isDisplayed()).toBeTruthy();
  1220. });
  1221.  
  1222. it('should show product images', function () {
  1223. expect(checkoutPage.productImage(tenthProductTitle).isDisplayed()).toBeTruthy();
  1224. });
  1225.  
  1226. it('should show correct prices for products', function () {
  1227. expect(checkoutPage.productPrice(tenthProductTitle)).toEqual('$30.00 x 1');
  1228. });
  1229.  
  1230. it('should show correct subtotals for products', function () {
  1231. expect(checkoutPage.productSubtotal(tenthProductTitle)).toEqual('$30.00');
  1232. });
  1233. });
  1234.  
  1235. describe('checking for delete purchased variant from product and then checking effect on existing orders with it', function () {
  1236.  
  1237. beforeAll(function () {
  1238. commonHelper.acceptAlert();
  1239. browser.get(signInData.link);
  1240. });
  1241.  
  1242. afterAll(function () {
  1243. commonHelper.clearAllData();
  1244. });
  1245.  
  1246. it('should redirect on dashboard page after login', function () {
  1247. browser.get(storeLink + '/admin');
  1248. signInPage.login(emailAddress, adminPassword);
  1249. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1250. });
  1251.  
  1252. it('should open products list page', function () {
  1253. dashboardPage.openProductListPage();
  1254. });
  1255.  
  1256. it('should show product page after click on product link', function () {
  1257. productListPage.clickProduct(fourthProductTitle);
  1258. });
  1259.  
  1260. it('should click add to cart button', function () {
  1261. browser.sleep(2000);
  1262. productPage.clickAddToCart();
  1263. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1264. });
  1265.  
  1266. it('should click checkout button', function () {
  1267. cartPage.clickCheckout();
  1268. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1269. });
  1270.  
  1271. it('should fill email address', function () {
  1272. checkoutPage.fillEmailAddress(emailAddress);
  1273. });
  1274.  
  1275. it('should fill contact information form', function () {
  1276. checkoutPage.selectCountry(country);
  1277. checkoutPage.selectState(city);
  1278. checkoutPage.fillCity(city);
  1279. checkoutPage.fillZip(zip);
  1280. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1281. checkoutPage.fillFirstName(firstName);
  1282. checkoutPage.fillLastName(lastName);
  1283. checkoutPage.fillStreetAddress(streetAddress);
  1284. checkoutPage.fillSuite(suite);
  1285. checkoutPage.fillPhone(phone);
  1286. });
  1287.  
  1288. it('should fill payment form', function () {
  1289. checkoutPage.fillCardNumberField(cardNumber);
  1290. checkoutPage.fillCardNameField(cardName);
  1291. checkoutPage.fillCardDateField(cardDate);
  1292. checkoutPage.fillCVVField(cardCVV);
  1293. });
  1294.  
  1295. it('should show correct prices', function () {
  1296. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1297. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1298. expect(checkoutPage.subtotalPrice()).toEqual('$35.00');
  1299. expect(checkoutPage.taxes()).toEqual('$0.00');
  1300. expect(checkoutPage.totalPrice()).toEqual('$35.00');
  1301. });
  1302.  
  1303. it('should click complete order', function () {
  1304. checkoutPage.clickCompleteOrder();
  1305. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  1306. });
  1307.  
  1308. it('should save order number', function () {
  1309. checkoutPage.txtOrder.getText().then(function (value) {
  1310. orderNumber = value.split(' ')[1];
  1311. });
  1312. });
  1313.  
  1314. it('should open orders page', function () {
  1315. commonHelper.switchToPreviousTab();
  1316. dashboardPage.openOrdersPage();
  1317. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1318. });
  1319.  
  1320. it('should show last order in the first row', function () {
  1321. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1322. });
  1323.  
  1324. it('should open needed order', function () {
  1325. ordersPage.clickOrderEntry(orderNumber);
  1326. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1327. });
  1328.  
  1329. it('should show product image', function () {
  1330. expect(ordersPage.productImage(fourthProductTitle).isDisplayed()).toBeTruthy();
  1331. });
  1332.  
  1333. it('should show correct order price', function () {
  1334. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1335. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1336. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1337. expect(ordersPage.taxes()).toEqual('$0.00');
  1338. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1339. });
  1340.  
  1341. it('should open products list page', function () {
  1342. dashboardPage.openProductListPage();
  1343. commonHelper.waitUntilElementVisible(productListPage.productEntry(fourthProductTitle));
  1344. });
  1345.  
  1346. it('should open edit product', function () {
  1347. browser.sleep(5000);
  1348. productListPage.editProduct(fourthProductTitle);
  1349. addProductPage.waitForSaveButton();
  1350. });
  1351.  
  1352. it('should delete old variants', function () {
  1353. addProductPage.clickDeleteCollection(firstColor);
  1354. addProductPage.clickDeleteCollection(secondColor);
  1355. addProductPage.clickDeleteCollection(fourthSize);
  1356. addProductPage.clickDeleteCollection(fifthSize);
  1357. });
  1358.  
  1359. it('should add new variants', function () {
  1360. addProductPage.fillOptionValue(0, seventhColor);
  1361. addProductPage.fillOptionValue(0, eightColor);
  1362. addProductPage.fillOptionValue(1, sixthSize);
  1363. addProductPage.fillOptionValue(1, secondSize);
  1364. });
  1365.  
  1366. it('should edit product prices and title', function () {
  1367. var firstVariant = seventhColor + ' / ' + sixthSize;
  1368. addProductPage.fillVariantPrice(firstVariant, secondProductPrice);
  1369. addProductPage.clickVariantPriceAutofill(firstVariant);
  1370. });
  1371.  
  1372. it('should add images', function () {
  1373. addProductPage.uploadImage(0, thirdImage);
  1374. addProductPage.uploadImage(0, thirdImage);
  1375. addProductPage.uploadImage(1, firstImage);
  1376. addProductPage.uploadImage(1, firstImage);
  1377. });
  1378.  
  1379. it('should save product', function () {
  1380. addProductPage.clickSave();
  1381. commonHelper.waitUntilElementVisible(productListPage.productEntry(fourthProductTitle));
  1382. });
  1383.  
  1384. it('should redirect on dashboard page', function () {
  1385. browser.get(storeLink + '/admin');
  1386. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1387. });
  1388.  
  1389. it('should open orders list', function () {
  1390. dashboardPage.openOrdersPage();
  1391. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1392. });
  1393.  
  1394. it('should show last order in the first row', function () {
  1395. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1396. });
  1397.  
  1398. it('should open needed order', function () {
  1399. ordersPage.clickOrderEntry(orderNumber);
  1400. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1401. });
  1402.  
  1403. it('should show new correct products', function () {
  1404. expect(ordersPage.productName(fourthProductTitle).isDisplayed()).toBeTruthy();
  1405. });
  1406.  
  1407. it('should show new product image', function () {
  1408. expect(ordersPage.productImage(fourthProductTitle).isDisplayed()).toBeTruthy();
  1409. });
  1410.  
  1411. it('should show correct order price', function () {
  1412. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1413. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1414. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1415. expect(ordersPage.taxes()).toEqual('$0.00');
  1416. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1417. });
  1418.  
  1419. it('should open products list page', function () {
  1420. dashboardPage.openProductListPage();
  1421. });
  1422.  
  1423. it('should show product page after click on product link', function () {
  1424. productListPage.clickProduct(fourthProductTitle);
  1425. });
  1426.  
  1427. it('should show main product image', function () {
  1428. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1429. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1430. });
  1431.  
  1432. it('should show correct product price', function () {
  1433. expect(productPage.productPrice()).toEqual(secondProductPrice.replace('$', ''));
  1434. });
  1435.  
  1436. it('should show correct product name', function () {
  1437. expect(productPage.productTitle()).toEqual(fourthProductTitle);
  1438. });
  1439.  
  1440. it('should show correct number of thumbs', function () {
  1441. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1442. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1443. browser.sleep(1000);
  1444. expect(productPage.allThumbs.count()).toEqual(2);
  1445. });
  1446.  
  1447. it('should select 1 product', function () {
  1448. productPage.clickUp(1);
  1449. });
  1450.  
  1451. it('should click add to cart button', function () {
  1452. productPage.clickAddToCart();
  1453. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1454. });
  1455.  
  1456. it('should show correct total price in cart', function () {
  1457. expect(cartPage.totalPrice()).toEqual('30.00');
  1458. });
  1459.  
  1460. it('should click checkout button', function () {
  1461. cartPage.clickCheckout();
  1462. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1463. });
  1464.  
  1465. it('should show correct product', function () {
  1466. expect(checkoutPage.productName(fourthProductTitle).isDisplayed()).toBeTruthy();
  1467. });
  1468.  
  1469. it('should show product images', function () {
  1470. expect(checkoutPage.productImage(fourthProductTitle).isDisplayed()).toBeTruthy();
  1471. });
  1472.  
  1473. it('should show correct prices for products', function () {
  1474. expect(checkoutPage.productPrice(fourthProductTitle)).toEqual('$30.00 x 1');
  1475. });
  1476.  
  1477. it('should show correct subtotals for products', function () {
  1478. expect(checkoutPage.productSubtotal(fourthProductTitle)).toEqual('$30.00');
  1479. });
  1480.  
  1481.  
  1482. it('should open products list page', function () {
  1483. commonHelper.switchToPreviousTab();
  1484. dashboardPage.openProductListPage();
  1485. commonHelper.waitUntilElementVisible(productListPage.productEntry(thirdProductTitle));
  1486. });
  1487.  
  1488. it('should open edit product', function () {
  1489. productListPage.editProduct(fourthProductTitle);
  1490. addProductPage.waitForSaveButton();
  1491. });
  1492.  
  1493. it('should delete old options', function () {
  1494. addProductPage.clickDeleteOption(1);
  1495. addProductPage.clickDeleteOption(0);
  1496. });
  1497.  
  1498. it('should add option variants', function () {
  1499. addProductPage.clickAddOption();
  1500. addProductPage.fillOptionTitle(0, 'Style');
  1501. addProductPage.fillOptionValue(0, firstStyle);
  1502. addProductPage.fillOptionValue(0, secondStyle);
  1503. addProductPage.clickProductLookCheckbox(0);
  1504. addProductPage.clickAddOption();
  1505. addProductPage.fillOptionTitle(1, 'Material');
  1506. addProductPage.fillOptionValue(1, firstMaterial);
  1507. addProductPage.fillOptionValue(1, secondMaterial);
  1508. });
  1509.  
  1510. it('should edit product prices and title', function () {
  1511. var firstVariant = firstStyle + ' / ' + firstMaterial;
  1512. addProductPage.fillVariantPrice(firstVariant, thirdProductPrice);
  1513. addProductPage.clickVariantPriceAutofill(firstVariant);
  1514. });
  1515.  
  1516. it('should add images', function () {
  1517. addProductPage.uploadImage(0, thirdImage);
  1518. addProductPage.uploadImage(0, thirdImage);
  1519. addProductPage.uploadImage(1, firstImage);
  1520. addProductPage.uploadImage(1, firstImage);
  1521. });
  1522.  
  1523. it('should save product', function () {
  1524. addProductPage.clickSave();
  1525. commonHelper.waitUntilElementVisible(productListPage.productEntry(fourthProductTitle));
  1526. });
  1527.  
  1528. it('should redirect on dashboard page', function () {
  1529. browser.get(storeLink + '/admin');
  1530. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1531. });
  1532.  
  1533. it('should open orders list', function () {
  1534. dashboardPage.openOrdersPage();
  1535. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1536. });
  1537.  
  1538. it('should show last order in the first row', function () {
  1539. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1540. });
  1541.  
  1542. it('should open needed order', function () {
  1543. ordersPage.clickOrderEntry(orderNumber);
  1544. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1545. });
  1546.  
  1547. it('should show new correct products', function () {
  1548. expect(ordersPage.productName(fourthProductTitle).isDisplayed()).toBeTruthy();
  1549. });
  1550.  
  1551. it('should show new product image', function () {
  1552. expect(ordersPage.productImage(fourthProductTitle).isDisplayed()).toBeTruthy();
  1553. });
  1554.  
  1555. it('should show correct order price', function () {
  1556. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1557. expect(ordersPage.subtotalPrice()).toEqual('$25.00');
  1558. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1559. expect(ordersPage.taxes()).toEqual('$0.00');
  1560. expect(ordersPage.totalPrice()).toEqual('$35.00');
  1561. });
  1562.  
  1563. it('should open products list page', function () {
  1564. dashboardPage.openProductListPage();
  1565. });
  1566.  
  1567. it('should show product page after click on product link', function () {
  1568. productListPage.clickProduct(fourthProductTitle);
  1569. });
  1570.  
  1571. it('should show main product image', function () {
  1572. commonHelper.waitUntilElementVisible(productPage.btnAddToCart);
  1573. commonHelper.waitUntilElementVisible(productPage.eleProductImage);
  1574. });
  1575.  
  1576. it('should show correct product price', function () {
  1577. expect(productPage.productPrice()).toEqual(thirdProductPrice.replace('$', ''));
  1578. });
  1579.  
  1580. it('should show correct product name', function () {
  1581. expect(productPage.productTitle()).toEqual(fourthProductTitle);
  1582. });
  1583.  
  1584. it('should show correct number of thumbs', function () {
  1585. commonHelper.waitUntilElementVisible(productPage.eleThumbsContainer);
  1586. commonHelper.waitUntilElementVisible(productPage.eleImageBorder);
  1587. browser.sleep(1000);
  1588. expect(productPage.allThumbs.count()).toEqual(2);
  1589. });
  1590.  
  1591. it('should select 1 product', function () {
  1592. productPage.clickUp(1);
  1593. });
  1594.  
  1595. it('should click add to cart button', function () {
  1596. productPage.clickAddToCart();
  1597. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1598. });
  1599.  
  1600. it('should show correct total price in cart', function () {
  1601. expect(cartPage.totalPrice()).toEqual('40.00');
  1602. });
  1603.  
  1604. it('should click checkout button', function () {
  1605. cartPage.clickCheckout();
  1606. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1607. });
  1608.  
  1609. it('should show correct product', function () {
  1610. expect(checkoutPage.productName(fourthProductTitle).isDisplayed()).toBeTruthy();
  1611. });
  1612.  
  1613. it('should show product images', function () {
  1614. expect(checkoutPage.productImage(fourthProductTitle).isDisplayed()).toBeTruthy();
  1615. });
  1616.  
  1617. it('should show correct prices for products', function () {
  1618. expect(checkoutPage.productPrice(fourthProductTitle)).toEqual('$40.00 x 1');
  1619. });
  1620.  
  1621. it('should show correct subtotals for products', function () {
  1622. expect(checkoutPage.productSubtotal(fourthProductTitle)).toEqual('$40.00');
  1623. });
  1624. });
  1625.  
  1626.  
  1627. // describe('checking for edit multi variant product price and checking effect on Cart and checkout on fes', function () {
  1628. //
  1629. // var secondProductPrice = '$20.00';
  1630. // var thirdProductPrice = '$30.00';
  1631. //
  1632. // beforeAll(function () {
  1633. // commonHelper.acceptAlert();
  1634. // browser.get(signInData.link);
  1635. // });
  1636. //
  1637. // afterAll(function () {
  1638. // commonHelper.clearAllData();
  1639. // });
  1640. //
  1641. // it('should redirect on dashboard page after login', function () {
  1642. // browser.get(storeLink + '/admin');
  1643. // signInPage.login(emailAddress, adminPassword);
  1644. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1645. // });
  1646. //
  1647. // it('should open products list page', function () {
  1648. // browser.sleep(1000);
  1649. // dashboardPage.openProductListPage();
  1650. // });
  1651. //
  1652. // it('should show product page after click on product link', function () {
  1653. // productListPage.clickProduct(fifthProductTitle);
  1654. // });
  1655. //
  1656. // it('should click add to cart button', function () {
  1657. // browser.sleep(2000);
  1658. // productPage.clickAddToCart();
  1659. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1660. // });
  1661. //
  1662. // it('should switch to previous tab', function () {
  1663. // commonHelper.switchToPreviousWithoutClose();
  1664. // });
  1665. //
  1666. // it('should open edit product', function () {
  1667. // productListPage.editProduct(fifthProductTitle);
  1668. // addProductPage.waitForSaveButton();
  1669. // });
  1670. //
  1671. // it('should edit prices', function () {
  1672. // addProductPage.fillVariantPrice(firstVariant, secondProductPrice);
  1673. // addProductPage.clickVariantPriceAutofill(firstVariant);
  1674. // });
  1675. //
  1676. // it('should save product', function () {
  1677. // addProductPage.clickSave();
  1678. // commonHelper.waitUntilElementVisible(productListPage.productEntry(fifthProductTitle));
  1679. // });
  1680. //
  1681. // it('should switch on the next tab', function () {
  1682. // commonHelper.switchToNextTab();
  1683. // });
  1684. //
  1685. // it('should click checkout button', function () {
  1686. // cartPage.clickCheckout();
  1687. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1688. // });
  1689. //
  1690. // it('should show correct product', function () {
  1691. // expect(checkoutPage.productName(fifthProductTitle).isDisplayed()).toBeTruthy();
  1692. // });
  1693. //
  1694. // it('should show product images', function () {
  1695. // expect(checkoutPage.productImage(fifthProductTitle).isDisplayed()).toBeTruthy();
  1696. // });
  1697. //
  1698. // it('should show correct prices for products', function () {
  1699. // expect(checkoutPage.productPrice(fifthProductTitle)).toEqual('$20.00 x 1');
  1700. // });
  1701. //
  1702. // it('should show correct subtotals for products', function () {
  1703. // expect(checkoutPage.productSubtotal(fifthProductTitle)).toEqual('$20.00');
  1704. // });
  1705. //
  1706. // it('should go to previous tab', function () {
  1707. // commonHelper.switchToPreviousWithoutClose();
  1708. // });
  1709. //
  1710. // it('should open edit product', function () {
  1711. // productListPage.editProduct(fifthProductTitle);
  1712. // addProductPage.waitForSaveButton();
  1713. // });
  1714. //
  1715. // it('should change variant prices', function () {
  1716. // addProductPage.fillVariantPrice(firstVariant, thirdProductPrice);
  1717. // addProductPage.clickVariantPriceAutofill(firstVariant);
  1718. // });
  1719. //
  1720. // it('should save product', function () {
  1721. // addProductPage.clickSave();
  1722. // commonHelper.waitUntilElementVisible(productListPage.productEntry(fifthProductTitle));
  1723. // });
  1724. //
  1725. // it('should go to next tab', function () {
  1726. // commonHelper.switchToNextTab();
  1727. // });
  1728. //
  1729. // it('should fill email address', function () {
  1730. // checkoutPage.fillEmailAddress(emailAddress);
  1731. // });
  1732. //
  1733. // it('should fill contact information form', function () {
  1734. // checkoutPage.selectCountry(country);
  1735. // checkoutPage.selectState(city);
  1736. // checkoutPage.fillCity(city);
  1737. // checkoutPage.fillZip(zip);
  1738. // commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1739. // checkoutPage.fillFirstName(firstName);
  1740. // checkoutPage.fillLastName(lastName);
  1741. // checkoutPage.fillStreetAddress(streetAddress);
  1742. // checkoutPage.fillSuite(suite);
  1743. // checkoutPage.fillPhone(phone);
  1744. // });
  1745. //
  1746. // it('should fill payment form', function () {
  1747. // checkoutPage.fillCardNumberField(cardNumber);
  1748. // checkoutPage.fillCardNameField(cardName);
  1749. // checkoutPage.fillCardDateField(cardDate);
  1750. // checkoutPage.fillCVVField(cardCVV);
  1751. // });
  1752. //
  1753. // it('should show correct prices', function () {
  1754. // commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1755. // expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1756. // expect(checkoutPage.subtotalPrice()).toEqual('$40.00');
  1757. // expect(checkoutPage.taxes()).toEqual('$0.00');
  1758. // expect(checkoutPage.totalPrice()).toEqual('$40.00');
  1759. // });
  1760. //
  1761. // it('should click complete order', function () {
  1762. // checkoutPage.clickCompleteOrder();
  1763. // });
  1764. //
  1765. // it('should show error message', function () {
  1766. // browser.sleep(2000);
  1767. // expect(checkoutPage.chkErrorMessage()).toEqual('Products in your cart have been updated by the store owner, please refresh the page to review the changes');
  1768. // });
  1769. //
  1770. // it('should click complete order again', function () {
  1771. // checkoutPage.clickCompleteOrder();
  1772. // });
  1773. //});
  1774. //
  1775. // describe('checking for delete purchased variant from product and then checking effect on cart and checkout on fes', function () {
  1776. //
  1777. // beforeAll(function () {
  1778. // commonHelper.acceptAlert();
  1779. // browser.get(signInData.link);
  1780. // });
  1781. //
  1782. // afterAll(function () {
  1783. // commonHelper.clearAllData();
  1784. // });
  1785. //
  1786. // it('should redirect on dashboard page after login', function () {
  1787. // browser.get(storeLink + '/admin');
  1788. // signInPage.login(emailAddress, adminPassword);
  1789. // commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1790. // });
  1791. //
  1792. // it('should open products list page', function () {
  1793. // dashboardPage.openProductListPage();
  1794. // });
  1795. //
  1796. // it('should show product page after click on product link', function () {
  1797. // productListPage.clickProduct(sixthProductTitle);
  1798. // });
  1799. //
  1800. // it('should click add to cart button', function () {
  1801. // browser.sleep(2000);
  1802. // productPage.clickAddToCart();
  1803. // commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1804. // });
  1805. //
  1806. // it('should click checkout button', function () {
  1807. // cartPage.clickCheckout();
  1808. // commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1809. // });
  1810. //
  1811. // it('should switch to previous tab', function () {
  1812. // commonHelper.switchToPreviousWithoutClose();
  1813. // });
  1814. //
  1815. // it('should open edit product', function () {
  1816. // productListPage.editProduct(sixthProductTitle);
  1817. // addProductPage.waitForSaveButton();
  1818. // });
  1819. //
  1820. // it('should delete old options', function () {
  1821. // addProductPage.clickDeleteOption(1);
  1822. // addProductPage.clickDeleteOption(0);
  1823. // });
  1824. //
  1825. // it('should add option variants', function () {
  1826. // addProductPage.clickAddOption();
  1827. // addProductPage.fillOptionTitle(0, 'Style');
  1828. // addProductPage.fillOptionValue(0, firstStyle);
  1829. // addProductPage.fillOptionValue(0, secondStyle);
  1830. // addProductPage.clickProductLookCheckbox(0);
  1831. // addProductPage.clickAddOption();
  1832. // addProductPage.fillOptionTitle(1, 'Material');
  1833. // addProductPage.fillOptionValue(1, firstMaterial);
  1834. // addProductPage.fillOptionValue(1, secondMaterial);
  1835. // });
  1836. //
  1837. // it('should edit product prices and title', function () {
  1838. // var firstVariant = firstStyle + ' / ' + firstMaterial;
  1839. // addProductPage.fillVariantPrice(firstVariant, thirdProductPrice);
  1840. // addProductPage.clickVariantPriceAutofill(firstVariant);
  1841. // });
  1842. //
  1843. // it('should add images', function () {
  1844. // addProductPage.uploadImage(0, thirdImage);
  1845. // addProductPage.uploadImage(0, thirdImage);
  1846. // addProductPage.uploadImage(1, firstImage);
  1847. // addProductPage.uploadImage(1, firstImage);
  1848. // });
  1849. //
  1850. // it('should switch to next tab', function () {
  1851. // commonHelper.switchToNextTab();
  1852. // });
  1853. // });
  1854.  
  1855. describe('checking for delete purchased variant from product and then checking effect on cart and checkout on fes', function () {
  1856.  
  1857. beforeAll(function () {
  1858. commonHelper.acceptAlert();
  1859. browser.get(signInData.link);
  1860. });
  1861.  
  1862. afterAll(function () {
  1863. commonHelper.clearAllData();
  1864. });
  1865.  
  1866. it('should redirect on dashboard page after login', function () {
  1867. browser.get(storeLink + '/admin');
  1868. signInPage.login(emailAddress, adminPassword);
  1869. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1870. });
  1871.  
  1872. it('should open products list page', function () {
  1873. dashboardPage.openProductListPage();
  1874. });
  1875.  
  1876. it('should show product page after click on product link', function () {
  1877. productListPage.clickProduct(seventhProductTitle);
  1878. });
  1879.  
  1880. it('should select 11 product', function () {
  1881. productPage.clickUp(11);
  1882. });
  1883.  
  1884. it('should click add to cart button', function () {
  1885. productPage.clickAddToCart();
  1886. commonHelper.waitUntilElementVisible(cartPage.btnCheckout);
  1887. });
  1888.  
  1889. it('should show correct total price in cart', function () {
  1890. expect(cartPage.totalPrice()).toEqual('250.00');
  1891. });
  1892.  
  1893. it('should click checkout button', function () {
  1894. cartPage.clickCheckout();
  1895. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  1896. });
  1897.  
  1898. it('should fill email address', function () {
  1899. checkoutPage.fillEmailAddress(emailAddress);
  1900. });
  1901.  
  1902. it('should fill contact information form', function () {
  1903. checkoutPage.selectCountry(country);
  1904. checkoutPage.selectState(city);
  1905. checkoutPage.fillCity(city);
  1906. checkoutPage.fillZip(zip);
  1907. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  1908. checkoutPage.fillFirstName(firstName);
  1909. checkoutPage.fillLastName(lastName);
  1910. checkoutPage.fillStreetAddress(streetAddress);
  1911. checkoutPage.fillSuite(suite);
  1912. checkoutPage.fillPhone(phone);
  1913. });
  1914.  
  1915. it('should fill payment form', function () {
  1916. checkoutPage.fillCardNumberField(cardNumber);
  1917. checkoutPage.fillCardNameField(cardName);
  1918. checkoutPage.fillCardDateField(cardDate);
  1919. checkoutPage.fillCVVField(cardCVV);
  1920. });
  1921.  
  1922. it('should show correct prices', function () {
  1923. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  1924. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  1925. expect(checkoutPage.subtotalPrice()).toEqual('$260.00');
  1926. expect(checkoutPage.taxes()).toEqual('$0.00');
  1927. expect(checkoutPage.totalPrice()).toEqual('$260.00');
  1928. });
  1929.  
  1930. it('should click complete order', function () {
  1931. checkoutPage.clickCompleteOrder();
  1932. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  1933. });
  1934.  
  1935. it('should save order number', function () {
  1936. checkoutPage.txtOrder.getText().then(function (value) {
  1937. orderNumber = value.split(' ')[1];
  1938. });
  1939. });
  1940.  
  1941. it('should open orders page', function () {
  1942. commonHelper.switchToPreviousTab();
  1943. dashboardPage.openOrdersPage();
  1944. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1945. });
  1946.  
  1947. it('should show last order in the first row', function () {
  1948. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1949. });
  1950.  
  1951. it('should open needed order', function () {
  1952. ordersPage.clickOrderEntry(orderNumber);
  1953. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  1954. });
  1955.  
  1956. it('should show product image', function () {
  1957. expect(ordersPage.productImage(seventhProductTitle).isDisplayed()).toBeTruthy();
  1958. });
  1959.  
  1960. it('should show correct order price', function () {
  1961. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  1962. expect(ordersPage.subtotalPrice()).toEqual('$275.00');
  1963. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  1964. expect(ordersPage.taxes()).toEqual('$0.00');
  1965. expect(ordersPage.totalPrice()).toEqual('$260.00');
  1966. });
  1967.  
  1968. it('should open up-sell campaigns page', function () {
  1969. dashboardPage.openUpsellCampaignsPage();
  1970. commonHelper.waitUntilElementPresent(upsellCampaignsPage.btnAdd);
  1971. });
  1972.  
  1973. it('should select compaign', function () {
  1974. upsellCampaignsPage.selectCampaign(firstCampaignName);
  1975. });
  1976.  
  1977. it('should delete compaign', function () {
  1978. upsellCampaignsPage.clickDeleteCompaign();
  1979. upsellCampaignsPage.clickConfirm();
  1980. });
  1981.  
  1982. it('should redirect on dashboard page', function () {
  1983. browser.get(storeLink + '/admin');
  1984. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1985. });
  1986.  
  1987. it('should open orders page', function () {
  1988. commonHelper.switchToPreviousTab();
  1989. dashboardPage.openOrdersPage();
  1990. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  1991. });
  1992.  
  1993. it('should show last order in the first row', function () {
  1994. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  1995. });
  1996.  
  1997. it('should open needed order', function () {
  1998. ordersPage.clickOrderEntry(orderNumber);
  1999. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2000. });
  2001.  
  2002. it('should show product image', function () {
  2003. expect(ordersPage.productImage(seventhProductTitle).isDisplayed()).toBeTruthy();
  2004. });
  2005.  
  2006. it('should show correct order price', function () {
  2007. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2008. expect(ordersPage.subtotalPrice()).toEqual('$275.00');
  2009. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2010. expect(ordersPage.taxes()).toEqual('$0.00');
  2011. expect(ordersPage.totalPrice()).toEqual('$260.00');
  2012. });
  2013. });
  2014.  
  2015. describe('checking for delete purchased variant from product and then checking effect on cart and checkout on fes', function () {
  2016.  
  2017. beforeAll(function () {
  2018. commonHelper.acceptAlert();
  2019. browser.get(signInData.link);
  2020. });
  2021.  
  2022. afterAll(function () {
  2023. commonHelper.clearAllData();
  2024. });
  2025.  
  2026. it('should redirect on dashboard page after login', function () {
  2027. browser.get(storeLink + '/admin');
  2028. signInPage.login(emailAddress, adminPassword);
  2029. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2030. });
  2031.  
  2032. it('should open products list page', function () {
  2033. dashboardPage.openProductListPage();
  2034. });
  2035.  
  2036. it('should show product page after click on product link', function () {
  2037. productListPage.clickProduct(eighthProductTitle);
  2038. });
  2039.  
  2040. it('should click checkout button', function () {
  2041. cartPage.clickCheckout();
  2042. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2043. });
  2044.  
  2045. it('should fill email address', function () {
  2046. checkoutPage.fillEmailAddress(emailAddress);
  2047. });
  2048.  
  2049. it('should fill contact information form', function () {
  2050. checkoutPage.selectCountry(country);
  2051. checkoutPage.selectState(city);
  2052. checkoutPage.fillCity(city);
  2053. checkoutPage.fillZip(zip);
  2054. commonHelper.waitUntilElementPresent(checkoutPage.selectedShipping(description));
  2055. checkoutPage.fillFirstName(firstName);
  2056. checkoutPage.fillLastName(lastName);
  2057. checkoutPage.fillStreetAddress(streetAddress);
  2058. checkoutPage.fillSuite(suite);
  2059. checkoutPage.fillPhone(phone);
  2060. });
  2061.  
  2062. it('should fill payment form', function () {
  2063. checkoutPage.fillCardNumberField(cardNumber);
  2064. checkoutPage.fillCardNameField(cardName);
  2065. checkoutPage.fillCardDateField(cardDate);
  2066. checkoutPage.fillCVVField(cardCVV);
  2067. });
  2068.  
  2069. it('should show correct prices', function () {
  2070. commonHelper.waitUntilElementVisible(checkoutPage.txtShippingPrice);
  2071. expect(checkoutPage.shippingPrice()).toEqual('$10.00');
  2072. expect(checkoutPage.subtotalPrice()).toEqual('$25.00');
  2073. expect(checkoutPage.taxes()).toEqual('$0.00');
  2074. expect(checkoutPage.totalPrice()).toEqual('$25.00');
  2075. });
  2076.  
  2077. it('should click complete order', function () {
  2078. checkoutPage.clickCompleteOrder();
  2079. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  2080. });
  2081.  
  2082. it('should show thank you discount', function () {
  2083. expect(checkoutPage.txtThankYouDiscount().isPresent()).toBeTruthy();
  2084. });
  2085.  
  2086. it('should redirect on dashboard page', function () {
  2087. browser.get(storeLink + '/admin');
  2088. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2089. });
  2090.  
  2091. it('should show product page after click on product link', function () {
  2092. productListPage.clickProduct(eighthProductTitle);
  2093. });
  2094.  
  2095. it('should click checkout button', function () {
  2096. cartPage.clickCheckout();
  2097. commonHelper.waitUntilElementVisible(checkoutPage.btnCompleteOrder);
  2098. });
  2099.  
  2100. it('should click complete order', function () {
  2101. checkoutPage.clickCompleteOrder();
  2102. commonHelper.waitUntilElementVisible(checkoutPage.txtOrder);
  2103. });
  2104.  
  2105. it('should save order number', function () {
  2106. checkoutPage.txtOrder.getText().then(function (value) {
  2107. orderNumber = value.split(' ')[1];
  2108. });
  2109. });
  2110.  
  2111. it('should redirect on dashboard page', function () {
  2112. browser.get(storeLink + '/admin');
  2113. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2114. });
  2115.  
  2116. it('should open orders page', function () {
  2117. commonHelper.switchToPreviousTab();
  2118. dashboardPage.openOrdersPage();
  2119. commonHelper.waitUntilElementVisible(ordersPage.orderEntry(orderNumber));
  2120. });
  2121.  
  2122. it('should show last order in the first row', function () {
  2123. expect(ordersPage.firstOrder().getText()).toContain(orderNumber);
  2124. });
  2125.  
  2126. it('should open needed order', function () {
  2127. ordersPage.clickOrderEntry(orderNumber);
  2128. commonHelper.waitUntilElementVisible(ordersPage.lnkAllItems);
  2129. });
  2130.  
  2131. it('should show product image', function () {
  2132. expect(ordersPage.productImage(seventhProductTitle).isDisplayed()).toBeTruthy();
  2133. });
  2134.  
  2135. it('should show correct order price', function () {
  2136. commonHelper.moveMouseOver(ordersPage.txtTotalPrice);
  2137. expect(ordersPage.subtotalPrice()).toEqual('$34.00');
  2138. expect(ordersPage.shippingPrice()).toEqual('$10.00');
  2139. expect(ordersPage.taxes()).toEqual('$0.00');
  2140. expect(ordersPage.totalPrice()).toEqual('$260.00');
  2141. });
  2142.  
  2143.  
  2144. });
  2145. });
  2146. -----------------------------------------------------------------------------------------------------------------------
  2147.  
  2148. upsell_compaigns.po.js
  2149.  
  2150. var commonHelper = require('./../../../helpers/common.helper');
  2151.  
  2152. var UpsellCampaignsPage = function () {
  2153.  
  2154. //--------------------------------------------------------------------------
  2155. // Locators
  2156. //--------------------------------------------------------------------------
  2157.  
  2158. var btnNewCampaign = '[href="/admin/upsells/create"]';
  2159.  
  2160. var campaignLocator = 'item in vm.campaigns';
  2161.  
  2162. var campaignTitle = "item.title";
  2163.  
  2164. //--------------------------------------------------------------------------
  2165. // Elements
  2166. //--------------------------------------------------------------------------
  2167.  
  2168. this.btnAddFirstCampaign = $('.empty-state ' + btnNewCampaign);
  2169.  
  2170. this.btnAddCampaign = $('[data-ng-if="vm.campaigns.length"] ' + btnNewCampaign);
  2171.  
  2172. this.btnAdd = element.all(by.css(btnNewCampaign)).first();
  2173.  
  2174. this.eleBuyType = $('[href="/admin/upsells/campaign?type=x-items"]');
  2175.  
  2176. this.eleBuyTypeStore = $('[href="/admin/upsells/campaign?type=storewide"]');
  2177.  
  2178. this.campaignsList = element.all(by.repeater(campaignLocator));
  2179.  
  2180. this.btnEditSettings = element(by.buttonText('Edit Settings'));
  2181.  
  2182. this.btnDeleteCompaign = element(by.buttonText('Delete Campaign'));
  2183.  
  2184. this.btnConfirm = element(by.buttonText('Confirm'));
  2185.  
  2186. //--------------------------------------------------------------------------
  2187. // Functions
  2188. //--------------------------------------------------------------------------
  2189.  
  2190. this.clickAddCampaign = function() {
  2191. var btnFirst = this.btnAddFirstCampaign;
  2192. var btnAdd = this.btnAddCampaign;
  2193. btnFirst.isPresent().then(function(result) {
  2194. if(result) {
  2195. btnFirst.click();
  2196. } else {
  2197. btnAdd.click();
  2198. }
  2199. });
  2200. };
  2201.  
  2202. this.selectBuyType = function() {
  2203. commonHelper.waitUntilElementVisible(this.eleBuyType);
  2204. commonHelper.moveMouseOver(this.eleBuyType);
  2205. this.eleBuyType.click();
  2206. commonHelper.waitUntilElementIsNotPresent(this.eleBuyType);
  2207. browser.sleep(1000);
  2208. };
  2209.  
  2210. this.selectBuyTypeStorewide = function() {
  2211. commonHelper.waitUntilElementVisible(this.eleBuyTypeStorewide);
  2212. commonHelper.moveMouseOver(this.eleBuyType);
  2213. this.eleBuyTypeStorewide.click();
  2214. commonHelper.waitUntilElementIsNotPresent(this.eleBuyTypeStorewide);
  2215. browser.sleep(1000);
  2216. };
  2217.  
  2218. this.campaignEntry = function(name) {
  2219. return element(by.cssContainingText("[ng-repeat='" + campaignLocator + "']", name));
  2220. };
  2221.  
  2222. this.campaignName = function(name) {
  2223. var items = this.campaignsList.filter(function(item) {
  2224. return item.element(by.binding(campaignTitle)).getText().then(function(_name) {
  2225. return _name === name;
  2226. });
  2227. });
  2228. return items.first();
  2229. };
  2230.  
  2231. this.selectCampaign = function(name) {
  2232. this.campaignName(name).click();
  2233. };
  2234.  
  2235. this.clickEditSettings = function() {
  2236. commonHelper.waitUntilElementVisible(this.btnEditSettings);
  2237. this.btnEditSettings.click();
  2238. browser.sleep(1000);
  2239. };
  2240.  
  2241. this.clickDeleteCompaign = function () {
  2242. commonHelper.waitUntilElementVisible(this.btnDeleteCompaign);
  2243. this.btnDeleteCompaign.click();
  2244. browser.sleep(1000);
  2245. };
  2246.  
  2247. this.clickConfirm = function () {
  2248. commonHelper.waitUntilElementVisible(this.btnConfirm);
  2249. this.btnConfirm.click();
  2250. browser.sleep(1000);
  2251. };
  2252.  
  2253. };
  2254.  
  2255. module.exports = UpsellCampaignsPage;
Add Comment
Please, Sign In to add comment