Advertisement
Guest User

add_collection/auto_add

a guest
Feb 13th, 2017
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 113.90 KB | None | 0 0
  1. by_price.spec.js
  2.  
  3. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  4. var signInPage = pageObject.getSignInPage();
  5. var dashboardPage = pageObject.getDashboardPage();
  6. var addCollectionPage = pageObject.getAddCollectionPage();
  7. var collectionListPage = pageObject.getCollectionListPage();
  8. var collectionsPage = pageObject.getCollectionsPage();
  9. var addProductPage = pageObject.getAddProductPage();
  10. var productListPage = pageObject.getProductListPage();
  11. var signInData = require('./../../../../../../data/admin/sign_in/index');
  12. var collectionData = require('./../../../../../../data/admin/collection/index');
  13. var productData = require('./../../../../../../data/admin/product/index');
  14. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  15. var coreData = require('./../../../../../../data/admin/core/index');
  16.  
  17. describe('Add Collection - Auto Adding - By Price', function () {
  18.  
  19. var username = signInData.adminAccount.username;
  20. var password = signInData.adminAccount.password;
  21. var firstCollectionTitle = commonHelper.uniqueProductName('price1');
  22. var firstCollectionDescription = collectionData.collection.description.first;
  23.  
  24. var addCollectionLink = signInData.link + '/collections/create';
  25.  
  26. var product = {
  27. firstTitle: commonHelper.uniqueProductName('price2'),
  28. type: productData.product.type,
  29. firstPrice: productData.product.price
  30. };
  31.  
  32. describe('check price metric', function () {
  33.  
  34. beforeAll(function () {
  35. commonHelper.acceptAlert();
  36. browser.get(signInData.link);
  37. });
  38.  
  39. afterAll(function () {
  40. commonHelper.clearAllData();
  41. });
  42.  
  43. it('should redirect on dashboard page after login', function () {
  44. signInPage.login(username, password);
  45. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  46. });
  47.  
  48. it('should open new collection page', function () {
  49. browser.get(addCollectionLink);
  50. });
  51.  
  52. it('should click auto add product radio button', function () {
  53. addCollectionPage.clickAddAuto();
  54. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  55. });
  56.  
  57. it('should select condition', function () {
  58. addCollectionPage.selectConditionVariant(0, 'Product price');
  59. });
  60.  
  61. it('should show correct price placeholder', function () {
  62. expect(addCollectionPage.txtConditionValuePlaceholder()).toEqual('$');
  63. });
  64.  
  65. it('should select condition', function () {
  66. addCollectionPage.selectConditionVariant(0, 'Product title');
  67. });
  68.  
  69. it('should not show price placeholder', function () {
  70. expect(addCollectionPage.plhPrice('$').isPresent()).toBeFalsy();
  71. });
  72. });
  73.  
  74. describe('auto-add product by product price is equal', function () {
  75.  
  76. var unique_value = commonHelper.uniqueValue();
  77. var collectionTitle = firstCollectionTitle + unique_value;
  78. var productTitle = product.firstTitle + unique_value;
  79.  
  80. beforeAll(function () {
  81. commonHelper.acceptAlert();
  82. browser.get(signInData.link);
  83. });
  84.  
  85. afterAll(function () {
  86. commonHelper.clearAllData();
  87. });
  88.  
  89. it('should redirect on dashboard page after login', function () {
  90. signInPage.login(username, password);
  91. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  92. });
  93.  
  94. it('should redirect on add product page', function () {
  95. browser.get(productData.addLink);
  96. addProductPage.waitForPublishButton();
  97. });
  98.  
  99. it('should add new product', function () {
  100. addProductPage.selectType(product.type);
  101. addProductPage.selectFirstCollection();
  102. addProductPage.fillTitle(productTitle);
  103. addProductPage.fillPrice(product.firstPrice);
  104. addProductPage.clickPublish();
  105. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  106. });
  107.  
  108. it('should open new collection page', function () {
  109. browser.get(addCollectionLink);
  110. });
  111.  
  112. it('should fill title and description fields', function () {
  113. addCollectionPage.fillTitle(collectionTitle);
  114. addCollectionPage.fillDescription(firstCollectionDescription);
  115. });
  116.  
  117. it('should click auto add product radio button', function () {
  118. addCollectionPage.clickAddAuto();
  119. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  120. });
  121.  
  122. it('should add condition', function () {
  123. addCollectionPage.selectConditionVariant(0, 'Product price');
  124. addCollectionPage.selectConditionRule(0, 'is equal to');
  125. addCollectionPage.fillConditionValue(0, '$25.00');
  126. });
  127.  
  128. it('should add new collection', function () {
  129. addCollectionPage.clickPublish();
  130. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  131. });
  132.  
  133. it('should show collection page after click on collection link', function () {
  134. collectionListPage.clickCollection(collectionTitle);
  135. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  136. });
  137.  
  138. it('should see product', function check(done) {
  139. collectionsPage.allProducts(productTitle).count().then(function(result){
  140. if(result == 1){
  141. done();
  142. }else {
  143. collectionsPage.clickPaginationButton('Next');
  144. check(done);
  145. }
  146. })
  147. });
  148.  
  149. it('should switch to previous tab', function () {
  150. commonHelper.switchToPreviousTab();
  151. });
  152. });
  153.  
  154. describe('auto-add product by product price is not equal', function () {
  155.  
  156. var unique_value = commonHelper.uniqueValue();
  157. var collectionTitle = firstCollectionTitle + unique_value;
  158. var productTitle = product.firstTitle + unique_value;
  159.  
  160. beforeAll(function () {
  161. commonHelper.acceptAlert();
  162. browser.get(signInData.link);
  163. });
  164.  
  165. afterAll(function () {
  166. commonHelper.clearAllData();
  167. });
  168.  
  169. it('should redirect on dashboard page after login', function () {
  170. signInPage.login(username, password);
  171. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  172. });
  173.  
  174. it('should redirect on add product page', function () {
  175. browser.get(productData.addLink);
  176. addProductPage.waitForPublishButton();
  177. });
  178.  
  179. it('should add new product', function () {
  180. addProductPage.selectType(product.type);
  181. addProductPage.selectFirstCollection();
  182. addProductPage.fillTitle(productTitle);
  183. addProductPage.fillPrice(product.firstPrice);
  184. addProductPage.clickPublish();
  185. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  186. });
  187.  
  188. it('should open new collection page', function () {
  189. browser.get(addCollectionLink);
  190. });
  191.  
  192. it('should fill title and description fields', function () {
  193. addCollectionPage.fillTitle(collectionTitle);
  194. addCollectionPage.fillDescription(firstCollectionDescription);
  195. });
  196.  
  197. it('should click auto add product radio button', function () {
  198. addCollectionPage.clickAddAuto();
  199. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  200. });
  201.  
  202. it('should add condition', function () {
  203. addCollectionPage.selectConditionVariant(0, 'Product price');
  204. addCollectionPage.selectConditionRule(0, 'is not equal to');
  205. addCollectionPage.fillConditionValue(0, '$35.00');
  206. });
  207.  
  208. it('should add new collection', function () {
  209. addCollectionPage.clickPublish();
  210. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  211. });
  212.  
  213. it('should show collection page after click on collection link', function () {
  214. collectionListPage.clickCollection(collectionTitle);
  215. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  216. });
  217.  
  218. it('should see product', function check(done) {
  219. collectionsPage.allProducts(productTitle).count().then(function(result){
  220. if(result == 1){
  221. done();
  222. }else {
  223. collectionsPage.clickPaginationButton('Next');
  224. check(done);
  225. }
  226. })
  227. });
  228.  
  229. it('should switch to previous tab', function () {
  230. commonHelper.switchToPreviousTab();
  231. });
  232. });
  233.  
  234. describe('auto-add product by product price is greater then', function () {
  235.  
  236. var unique_value = commonHelper.uniqueValue();
  237. var collectionTitle = firstCollectionTitle + unique_value;
  238. var productTitle = product.firstTitle + unique_value;
  239.  
  240. beforeAll(function () {
  241. commonHelper.acceptAlert();
  242. browser.get(signInData.link);
  243. });
  244.  
  245. afterAll(function () {
  246. commonHelper.clearAllData();
  247. });
  248.  
  249. it('should redirect on dashboard page after login', function () {
  250. signInPage.login(username, password);
  251. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  252. });
  253.  
  254. it('should redirect on add product page', function () {
  255. browser.get(productData.addLink);
  256. addProductPage.waitForPublishButton();
  257. });
  258.  
  259. it('should add new product', function () {
  260. addProductPage.selectType(product.type);
  261. addProductPage.selectFirstCollection();
  262. addProductPage.fillTitle(productTitle);
  263. addProductPage.fillPrice(product.firstPrice);
  264. addProductPage.clickPublish();
  265. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  266. });
  267.  
  268. it('should open new collection page', function () {
  269. browser.get(addCollectionLink);
  270. });
  271.  
  272. it('should fill title and description fields', function () {
  273. addCollectionPage.fillTitle(collectionTitle);
  274. addCollectionPage.fillDescription(firstCollectionDescription);
  275. });
  276.  
  277. it('should click auto add product radio button', function () {
  278. addCollectionPage.clickAddAuto();
  279. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  280. });
  281.  
  282. it('should add condition', function () {
  283. addCollectionPage.selectConditionVariant(0, 'Product price');
  284. addCollectionPage.selectConditionRule(0, 'is greater then');
  285. addCollectionPage.fillConditionValue(0, '$15.00');
  286. });
  287.  
  288. it('should add new collection', function () {
  289. addCollectionPage.clickPublish();
  290. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  291. });
  292.  
  293. it('should show collection page after click on collection link', function () {
  294. collectionListPage.clickCollection(collectionTitle);
  295. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  296. });
  297.  
  298. it('should see product', function check(done) {
  299. collectionsPage.allProducts(productTitle).count().then(function(result){
  300. if(result == 1){
  301. done();
  302. }else {
  303. collectionsPage.clickPaginationButton('Next');
  304. check(done);
  305. }
  306. })
  307. });
  308.  
  309. it('should switch to previous tab', function () {
  310. commonHelper.switchToPreviousTab();
  311. });
  312. });
  313.  
  314. describe('auto-add product by product price is less then', function () {
  315.  
  316. var unique_value = commonHelper.uniqueValue();
  317. var collectionTitle = firstCollectionTitle + unique_value;
  318. var productTitle = product.firstTitle + unique_value;
  319.  
  320. beforeAll(function () {
  321. commonHelper.acceptAlert();
  322. browser.get(signInData.link);
  323. });
  324.  
  325. afterAll(function () {
  326. commonHelper.clearAllData();
  327. });
  328.  
  329. it('should redirect on dashboard page after login', function () {
  330. signInPage.login(username, password);
  331. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  332. });
  333.  
  334. it('should redirect on add product page', function () {
  335. browser.get(productData.addLink);
  336. addProductPage.waitForPublishButton();
  337. });
  338.  
  339. it('should add new product', function () {
  340. addProductPage.selectType(product.type);
  341. addProductPage.selectFirstCollection();
  342. addProductPage.fillTitle(productTitle);
  343. addProductPage.fillPrice(product.firstPrice);
  344. addProductPage.clickPublish();
  345. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  346. });
  347.  
  348. it('should open new collection page', function () {
  349. browser.get(addCollectionLink);
  350. });
  351.  
  352. it('should fill title and description fields', function () {
  353. addCollectionPage.fillTitle(collectionTitle);
  354. addCollectionPage.fillDescription(firstCollectionDescription);
  355. });
  356.  
  357. it('should click auto add product radio button', function () {
  358. addCollectionPage.clickAddAuto();
  359. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  360. });
  361.  
  362. it('should add condition', function () {
  363. addCollectionPage.selectConditionVariant(0, 'Product price');
  364. addCollectionPage.selectConditionRule(0, 'is less then');
  365. addCollectionPage.fillConditionValue(0, '$35.00');
  366. });
  367.  
  368. it('should add new collection', function () {
  369. addCollectionPage.clickPublish();
  370. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  371. });
  372.  
  373. it('should show collection page after click on collection link', function () {
  374. collectionListPage.clickCollection(collectionTitle);
  375. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  376. });
  377.  
  378. it('should see product', function check(done) {
  379. collectionsPage.allProducts(productTitle).count().then(function(result){
  380. if(result == 1){
  381. done();
  382. }else {
  383. collectionsPage.clickPaginationButton('Next');
  384. check(done);
  385. }
  386. })
  387. });
  388.  
  389. it('should switch to previous tab', function () {
  390. commonHelper.switchToPreviousTab();
  391. });
  392. });
  393. });
  394. ---------------------------------------------------------------------------------------------------------------------------
  395. by_tag.spec.js
  396.  
  397. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  398. var signInPage = pageObject.getSignInPage();
  399. var dashboardPage = pageObject.getDashboardPage();
  400. var addCollectionPage = pageObject.getAddCollectionPage();
  401. var collectionListPage = pageObject.getCollectionListPage();
  402. var collectionsPage = pageObject.getCollectionsPage();
  403. var addProductPage = pageObject.getAddProductPage();
  404. var productListPage = pageObject.getProductListPage();
  405. var signInData = require('./../../../../../../data/admin/sign_in/index');
  406. var collectionData = require('./../../../../../../data/admin/collection/index');
  407. var productData = require('./../../../../../../data/admin/product/index');
  408. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  409.  
  410. describe('Add Collection - Auto Adding - By Tag', function () {
  411.  
  412. var username = signInData.adminAccount.username;
  413. var password = signInData.adminAccount.password;
  414. var firstCollectionTitle = commonHelper.uniqueProductName('tag1');
  415. var firstCollectionDescription = collectionData.collection.description.first;
  416.  
  417. var addCollectionLink = signInData.link + '/collections/create';
  418.  
  419. var product = {
  420. firstTitle: commonHelper.uniqueProductName('tag2'),
  421. type: productData.product.type,
  422. tag: productData.product.tag,
  423. price: productData.product.price
  424. };
  425.  
  426. describe('auto-add product by product tag does not contain', function () {
  427.  
  428. var unique_value = commonHelper.uniqueValue();
  429. var collectionTitle = firstCollectionTitle + unique_value;
  430. var productTitle = product.firstTitle + unique_value;
  431. var productTag = 'mouse' + unique_value;
  432.  
  433. beforeAll(function () {
  434. commonHelper.acceptAlert();
  435. browser.get(signInData.link);
  436. });
  437.  
  438. afterAll(function () {
  439. commonHelper.clearAllData();
  440. });
  441.  
  442. it('should redirect on dashboard page after login', function () {
  443. signInPage.login(username, password);
  444. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  445. });
  446.  
  447. it('should redirect on add product page', function () {
  448. browser.get(productData.addLink);
  449. addProductPage.waitForPublishButton();
  450. });
  451.  
  452. it('should add new product', function () {
  453. addProductPage.selectType(product.type);
  454. addProductPage.selectFirstCollection();
  455. addProductPage.fillTitle(productTitle);
  456. addProductPage.fillPrice(product.price);
  457. addProductPage.selectVendor(productTag);
  458. addProductPage.clickPublish();
  459. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  460. });
  461.  
  462. it('should open new collection page', function () {
  463. browser.get(addCollectionLink);
  464. });
  465.  
  466. it('should fill title and description fields', function () {
  467. addCollectionPage.fillTitle(collectionTitle);
  468. addCollectionPage.fillDescription(firstCollectionDescription);
  469. });
  470.  
  471. it('should click auto add product radio button', function () {
  472. addCollectionPage.clickAddAuto();
  473. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  474. });
  475.  
  476. it('should add condition', function () {
  477. addCollectionPage.selectConditionVariant(0, 'Product tag');
  478. addCollectionPage.selectConditionRule(0, 'does not contain');
  479. addCollectionPage.fillConditionValue(0, product.tag);
  480. });
  481.  
  482. it('should add new collection', function () {
  483. addCollectionPage.clickPublish();
  484. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  485. });
  486.  
  487. it('should show collection page after click on collection link', function () {
  488. collectionListPage.clickCollection(collectionTitle);
  489. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  490. });
  491.  
  492. it('should see product', function check(done) {
  493. collectionsPage.allProducts(productTitle).count().then(function(result){
  494. if(result == 1){
  495. done();
  496. }else {
  497. collectionsPage.clickPaginationButton('Next');
  498. check(done);
  499. }
  500. })
  501. });
  502.  
  503. it('should switch to previous tab', function () {
  504. commonHelper.switchToPreviousTab();
  505. });
  506. });
  507.  
  508. describe('auto-add product by product tag is exactly', function () {
  509.  
  510. var unique_value = commonHelper.uniqueValue();
  511. var collectionTitle = firstCollectionTitle + unique_value;
  512. var productTitle = product.firstTitle + unique_value;
  513. var productTag = product.tag + unique_value;
  514.  
  515. beforeAll(function () {
  516. commonHelper.acceptAlert();
  517. browser.get(signInData.link);
  518. });
  519.  
  520. afterAll(function () {
  521. commonHelper.clearAllData();
  522. });
  523.  
  524. it('should redirect on dashboard page after login', function () {
  525. signInPage.login(username, password);
  526. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  527. });
  528.  
  529. it('should redirect on add product page', function () {
  530. browser.get(productData.addLink);
  531. addProductPage.waitForPublishButton();
  532. });
  533.  
  534. it('should add new product', function () {
  535. addProductPage.selectType(product.type);
  536. addProductPage.selectFirstCollection();
  537. addProductPage.addTag(productTag);
  538. addProductPage.fillTitle(productTitle);
  539. addProductPage.fillPrice(product.price);
  540. addProductPage.clickPublish();
  541. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  542. });
  543.  
  544. it('should open new collection page', function () {
  545. browser.get(addCollectionLink);
  546. });
  547.  
  548. it('should fill title and description fields', function () {
  549. addCollectionPage.fillTitle(collectionTitle);
  550. addCollectionPage.fillDescription(firstCollectionDescription);
  551. });
  552.  
  553. it('should click auto add product radio button', function () {
  554. addCollectionPage.clickAddAuto();
  555. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  556. });
  557.  
  558. it('should add condition', function () {
  559. addCollectionPage.selectConditionVariant(0, 'Product tag');
  560. addCollectionPage.selectConditionRule(0, 'is exactly');
  561. addCollectionPage.fillConditionValue(0, productTag);
  562. });
  563.  
  564. it('should add new collection', function () {
  565. addCollectionPage.clickPublish();
  566. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  567. });
  568.  
  569. it('should show collection page after click on collection link', function () {
  570. collectionListPage.clickCollection(collectionTitle);
  571. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  572. });
  573.  
  574. it('should see product', function check(done) {
  575. collectionsPage.allProducts(productTitle).count().then(function(result){
  576. if(result == 1){
  577. done();
  578. }else {
  579. collectionsPage.clickPaginationButton('Next');
  580. check(done);
  581. }
  582. })
  583. });
  584.  
  585. it('should switch to previous tab', function () {
  586. commonHelper.switchToPreviousTab();
  587. });
  588. });
  589.  
  590. describe('auto-add product by product tag starts with', function () {
  591.  
  592. var unique_value = commonHelper.uniqueValue();
  593. var collectionTitle = firstCollectionTitle + unique_value;
  594. var productTitle = product.firstTitle + unique_value;
  595. var productTag = firstCollectionTitle + product.tag;
  596.  
  597. beforeAll(function () {
  598. commonHelper.acceptAlert();
  599. browser.get(signInData.link);
  600. });
  601.  
  602. afterAll(function () {
  603. commonHelper.clearAllData();
  604. });
  605.  
  606. it('should redirect on dashboard page after login', function () {
  607. signInPage.login(username, password);
  608. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  609. });
  610.  
  611. it('should redirect on add product page', function () {
  612. browser.get(productData.addLink);
  613. addProductPage.waitForPublishButton();
  614. });
  615.  
  616. it('should add new product', function () {
  617. addProductPage.selectType(product.type);
  618. addProductPage.selectFirstCollection();
  619. addProductPage.addTag(productTag);
  620. addProductPage.fillTitle(productTitle);
  621. addProductPage.fillPrice(product.price);
  622. addProductPage.clickPublish();
  623. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  624. });
  625.  
  626. it('should open new collection page', function () {
  627. browser.get(addCollectionLink);
  628. });
  629.  
  630. it('should fill title and description fields', function () {
  631. addCollectionPage.fillTitle(collectionTitle);
  632. addCollectionPage.fillDescription(firstCollectionDescription);
  633. });
  634.  
  635. it('should click auto add product radio button', function () {
  636. addCollectionPage.clickAddAuto();
  637. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  638. });
  639.  
  640. it('should add condition', function () {
  641. addCollectionPage.selectConditionVariant(0, 'Product tag');
  642. addCollectionPage.selectConditionRule(0, 'starts with');
  643. addCollectionPage.fillConditionValue(0, firstCollectionTitle);
  644. });
  645.  
  646. it('should add new collection', function () {
  647. addCollectionPage.clickPublish();
  648. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  649. });
  650.  
  651. it('should show collection page after click on collection link', function () {
  652. collectionListPage.clickCollection(collectionTitle);
  653. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  654. });
  655.  
  656. it('should see product', function check(done) {
  657. collectionsPage.allProducts(productTitle).count().then(function(result){
  658. if(result == 1){
  659. done();
  660. }else {
  661. collectionsPage.clickPaginationButton('Next');
  662. check(done);
  663. }
  664. })
  665. });
  666.  
  667. it('should switch to previous tab', function () {
  668. commonHelper.switchToPreviousTab();
  669. });
  670. });
  671.  
  672. describe('auto-add product by product tag ends with', function () {
  673.  
  674. var unique_value = commonHelper.uniqueValue();
  675. var collectionTitle = firstCollectionTitle + unique_value;
  676. var productTitle = product.firstTitle + unique_value;
  677. var productTag = product.tag + unique_value;
  678.  
  679. beforeAll(function () {
  680. commonHelper.acceptAlert();
  681. browser.get(signInData.link);
  682. });
  683.  
  684. afterAll(function () {
  685. commonHelper.clearAllData();
  686. });
  687.  
  688. it('should redirect on dashboard page after login', function () {
  689. signInPage.login(username, password);
  690. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  691. });
  692.  
  693. it('should redirect on add product page', function () {
  694. browser.get(productData.addLink);
  695. addProductPage.waitForPublishButton();
  696. });
  697.  
  698. it('should add new product', function () {
  699. addProductPage.selectType(product.type);
  700. addProductPage.selectFirstCollection();
  701. addProductPage.fillTitle(productTitle);
  702. addProductPage.fillPrice(product.price);
  703. addProductPage.addTag(productTag);
  704. addProductPage.clickPublish();
  705. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  706. });
  707.  
  708. it('should open new collection page', function () {
  709. browser.get(addCollectionLink);
  710. });
  711.  
  712. it('should fill title and description fields', function () {
  713. addCollectionPage.fillTitle(collectionTitle);
  714. addCollectionPage.fillDescription(firstCollectionDescription);
  715. });
  716.  
  717. it('should click auto add product radio button', function () {
  718. addCollectionPage.clickAddAuto();
  719. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  720. });
  721.  
  722. it('should add condition', function () {
  723. addCollectionPage.selectConditionVariant(0, 'Product tag');
  724. addCollectionPage.selectConditionRule(0, 'ends with');
  725. addCollectionPage.fillConditionValue(0, unique_value);
  726. });
  727.  
  728. it('should add new collection', function () {
  729. addCollectionPage.clickPublish();
  730. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  731. });
  732.  
  733. it('should show collection page after click on collection link', function () {
  734. collectionListPage.clickCollection(collectionTitle);
  735. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  736. });
  737.  
  738. it('should see product', function check(done) {
  739. collectionsPage.allProducts(productTitle).count().then(function(result){
  740. if(result == 1){
  741. done();
  742. }else {
  743. collectionsPage.clickPaginationButton('Next');
  744. check(done);
  745. }
  746. })
  747. });
  748.  
  749. it('should switch to previous tab', function () {
  750. commonHelper.switchToPreviousTab();
  751. });
  752. });
  753.  
  754. describe('auto-add product by product tag contains', function () {
  755.  
  756. var unique_value = commonHelper.uniqueValue();
  757. var collectionTitle = firstCollectionTitle + unique_value;
  758. var productTitle = product.firstTitle + unique_value;
  759. var productTag = product.type + unique_value + 'contains';
  760.  
  761. beforeAll(function () {
  762. commonHelper.acceptAlert();
  763. browser.get(signInData.link);
  764. });
  765.  
  766. afterAll(function () {
  767. commonHelper.clearAllData();
  768. });
  769.  
  770. it('should redirect on dashboard page after login', function () {
  771. signInPage.login(username, password);
  772. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  773. });
  774.  
  775. it('should redirect on add product page', function () {
  776. browser.get(productData.addLink);
  777. addProductPage.waitForPublishButton();
  778. });
  779.  
  780. it('should add new product', function () {
  781. addProductPage.selectType(product.type);
  782. addProductPage.selectFirstCollection();
  783. addProductPage.fillTitle(productTitle);
  784. addProductPage.fillPrice(product.price);
  785. addProductPage.addTag(productTag);
  786. addProductPage.clickPublish();
  787. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  788. });
  789.  
  790. it('should open new collection page', function () {
  791. browser.get(addCollectionLink);
  792. });
  793.  
  794. it('should fill title and description fields', function () {
  795. addCollectionPage.fillTitle(collectionTitle);
  796. addCollectionPage.fillDescription(firstCollectionDescription);
  797. });
  798.  
  799. it('should click auto add product radio button', function () {
  800. addCollectionPage.clickAddAuto();
  801. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  802. });
  803.  
  804. it('should add condition', function () {
  805. addCollectionPage.selectConditionVariant(0, 'Product tag');
  806. addCollectionPage.selectConditionRule(0, 'contains');
  807. addCollectionPage.fillConditionValue(0, unique_value);
  808. });
  809.  
  810. it('should add new collection', function () {
  811. addCollectionPage.clickPublish();
  812. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  813. });
  814.  
  815. it('should show collection page after click on collection link', function () {
  816. collectionListPage.clickCollection(collectionTitle);
  817. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  818. });
  819.  
  820. it('should see product', function check(done) {
  821. collectionsPage.allProducts(productTitle).count().then(function(result){
  822. if(result == 1){
  823. done();
  824. }else {
  825. collectionsPage.clickPaginationButton('Next');
  826. check(done);
  827. }
  828. })
  829. });
  830.  
  831. it('should switch to previous tab', function () {
  832. commonHelper.switchToPreviousTab();
  833. });
  834. });
  835. });
  836. ---------------------------------------------------------------------------------------------------------------------------
  837. by_title.spec.js
  838.  
  839. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  840. var signInPage = pageObject.getSignInPage();
  841. var dashboardPage = pageObject.getDashboardPage();
  842. var addCollectionPage = pageObject.getAddCollectionPage();
  843. var collectionListPage = pageObject.getCollectionListPage();
  844. var collectionsPage = pageObject.getCollectionsPage();
  845. var addProductPage = pageObject.getAddProductPage();
  846. var productListPage = pageObject.getProductListPage();
  847. var signInData = require('./../../../../../../data/admin/sign_in/index');
  848. var collectionData = require('./../../../../../../data/admin/collection/index');
  849. var productData = require('./../../../../../../data/admin/product/index');
  850. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  851.  
  852. describe('Add Collection - Auto Adding - By Title', function () {
  853.  
  854. var username = signInData.adminAccount.username;
  855. var password = signInData.adminAccount.password;
  856. var firstCollectionTitle = commonHelper.uniqueProductName('title1');
  857. var firstCollectionDescription = collectionData.collection.description.first;
  858.  
  859. var addCollectionLink = signInData.link + '/collections/create';
  860.  
  861. var product = {
  862. firstTitle: commonHelper.uniqueProductName('title2'),
  863. secondTitle: commonHelper.uniqueProductName('title3'),
  864. type: productData.product.type,
  865. price: productData.product.price
  866. };
  867.  
  868. describe('auto-add product by product title does not contain', function () {
  869.  
  870. var unique_value = commonHelper.uniqueValue();
  871. var collectionTitle = firstCollectionTitle + unique_value;
  872. var productTitle = 'book' + unique_value;
  873.  
  874. beforeAll(function () {
  875. commonHelper.acceptAlert();
  876. browser.get(signInData.link);
  877. });
  878.  
  879. afterAll(function () {
  880. commonHelper.clearAllData();
  881. });
  882.  
  883. it('should redirect on dashboard page after login', function () {
  884. signInPage.login(username, password);
  885. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  886. });
  887.  
  888. it('should redirect on add product page', function () {
  889. browser.get(productData.addLink);
  890. addProductPage.waitForPublishButton();
  891. });
  892.  
  893. it('should add new product', function () {
  894. addProductPage.selectType(product.type);
  895. addProductPage.selectFirstCollection();
  896. addProductPage.fillTitle(productTitle);
  897. addProductPage.fillPrice(product.price);
  898. addProductPage.clickPublish();
  899. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  900. });
  901.  
  902. it('should open new collection page', function () {
  903. browser.get(addCollectionLink);
  904. });
  905.  
  906. it('should fill title and description fields', function () {
  907. addCollectionPage.fillTitle(collectionTitle);
  908. addCollectionPage.fillDescription(firstCollectionDescription);
  909. });
  910.  
  911. it('should click auto add product radio button', function () {
  912. addCollectionPage.clickAddAuto();
  913. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  914. });
  915.  
  916. it('should add condition', function () {
  917. addCollectionPage.selectConditionVariant(0, 'Product title');
  918. addCollectionPage.selectConditionRule(0, 'does not contain');
  919. addCollectionPage.fillConditionValue(0, product.firstTitle);
  920. });
  921.  
  922. it('should add new condition', function () {
  923. addCollectionPage.clickAddCondition();
  924. });
  925.  
  926. it('should add condition', function () {
  927. addCollectionPage.selectConditionVariant(1, 'Product title');
  928. addCollectionPage.selectConditionRule(1, 'does not contain');
  929. addCollectionPage.fillConditionValue(1, product.secondTitle);
  930. });
  931.  
  932. it('should add new collection', function () {
  933. addCollectionPage.clickPublish();
  934. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  935. });
  936.  
  937. it('should show collection page after click on collection link', function () {
  938. collectionListPage.clickCollection(collectionTitle);
  939. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  940. });
  941.  
  942. it('should see product', function check(done) {
  943. collectionsPage.allProducts(productTitle).count().then(function(result){
  944. if(result == 1){
  945. done();
  946. }else {
  947. collectionsPage.clickPaginationButton('Next');
  948. check(done);
  949. }
  950. })
  951. });
  952.  
  953. it('should switch to previous tab', function () {
  954. commonHelper.switchToPreviousTab();
  955. });
  956. });
  957.  
  958. describe('auto-add product by product title is exactly', function () {
  959.  
  960. var unique_value = commonHelper.uniqueValue();
  961. var collectionTitle = firstCollectionTitle + unique_value;
  962. var productTitle = product.firstTitle + unique_value;
  963.  
  964. beforeAll(function () {
  965. commonHelper.acceptAlert();
  966. browser.get(signInData.link);
  967. });
  968.  
  969. afterAll(function () {
  970. commonHelper.clearAllData();
  971. });
  972.  
  973. it('should redirect on dashboard page after login', function () {
  974. signInPage.login(username, password);
  975. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  976. });
  977.  
  978. it('should redirect on add product page', function () {
  979. browser.get(productData.addLink);
  980. addProductPage.waitForPublishButton();
  981. });
  982.  
  983. it('should add new product', function () {
  984. addProductPage.selectType(product.type);
  985. addProductPage.selectFirstCollection();
  986. addProductPage.fillTitle(productTitle);
  987. addProductPage.fillPrice(product.price);
  988. addProductPage.clickPublish();
  989. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  990. });
  991.  
  992. it('should open new collection page', function () {
  993. browser.get(addCollectionLink);
  994. });
  995.  
  996. it('should fill title and description fields', function () {
  997. addCollectionPage.fillTitle(collectionTitle);
  998. addCollectionPage.fillDescription(firstCollectionDescription);
  999. });
  1000.  
  1001. it('should click auto add product radio button', function () {
  1002. addCollectionPage.clickAddAuto();
  1003. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1004. });
  1005.  
  1006. it('should add condition', function () {
  1007. addCollectionPage.selectConditionVariant(0, 'Product title');
  1008. addCollectionPage.selectConditionRule(0, 'is exactly');
  1009. addCollectionPage.fillConditionValue(0, productTitle);
  1010. });
  1011.  
  1012. it('should add new collection', function () {
  1013. addCollectionPage.clickPublish();
  1014. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1015. });
  1016.  
  1017. it('should show collection page after click on collection link', function () {
  1018. collectionListPage.clickCollection(collectionTitle);
  1019. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1020.  
  1021. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1022. commonHelper.switchToPreviousTab();
  1023. });
  1024. });
  1025.  
  1026. describe('auto-add product by product title starts with', function () {
  1027.  
  1028. var unique_value = commonHelper.uniqueValue();
  1029. var collectionTitle = firstCollectionTitle + unique_value;
  1030. var productTitle = unique_value + product.firstTitle;
  1031.  
  1032. beforeAll(function () {
  1033. commonHelper.acceptAlert();
  1034. browser.get(signInData.link);
  1035. });
  1036.  
  1037. afterAll(function () {
  1038. commonHelper.clearAllData();
  1039. });
  1040.  
  1041. it('should redirect on dashboard page after login', function () {
  1042. signInPage.login(username, password);
  1043. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1044. });
  1045.  
  1046. it('should redirect on add product page', function () {
  1047. browser.get(productData.addLink);
  1048. addProductPage.waitForPublishButton();
  1049. });
  1050.  
  1051. it('should add new product', function () {
  1052. addProductPage.selectType(product.type);
  1053. addProductPage.selectFirstCollection();
  1054. addProductPage.fillTitle(productTitle);
  1055. addProductPage.fillPrice(product.price);
  1056. addProductPage.clickPublish();
  1057. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1058. });
  1059.  
  1060. it('should open new collection page', function () {
  1061. browser.get(addCollectionLink);
  1062. });
  1063.  
  1064. it('should fill title and description fields', function () {
  1065. addCollectionPage.fillTitle(collectionTitle);
  1066. addCollectionPage.fillDescription(firstCollectionDescription);
  1067. });
  1068.  
  1069. it('should click auto add product radio button', function () {
  1070. addCollectionPage.clickAddAuto();
  1071. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1072. });
  1073.  
  1074. it('should add condition', function () {
  1075. addCollectionPage.selectConditionVariant(0, 'Product title');
  1076. addCollectionPage.selectConditionRule(0, 'starts with');
  1077. addCollectionPage.fillConditionValue(0, unique_value);
  1078. });
  1079.  
  1080. it('should add new collection', function () {
  1081. addCollectionPage.clickPublish();
  1082. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1083. });
  1084.  
  1085. it('should show collection page after click on collection link', function () {
  1086. collectionListPage.clickCollection(collectionTitle);
  1087. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1088.  
  1089. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1090. commonHelper.switchToPreviousTab();
  1091. });
  1092. });
  1093.  
  1094. describe('auto-add product by product title ends with', function () {
  1095.  
  1096. var unique_value = commonHelper.uniqueValue();
  1097. var collectionTitle = firstCollectionTitle + unique_value;
  1098. var productTitle = product.firstTitle + unique_value;
  1099.  
  1100. beforeAll(function () {
  1101. commonHelper.acceptAlert();
  1102. browser.get(signInData.link);
  1103. });
  1104.  
  1105. afterAll(function () {
  1106. commonHelper.clearAllData();
  1107. });
  1108.  
  1109. it('should redirect on dashboard page after login', function () {
  1110. signInPage.login(username, password);
  1111. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1112. });
  1113.  
  1114. it('should redirect on add product page', function () {
  1115. browser.get(productData.addLink);
  1116. addProductPage.waitForPublishButton();
  1117. });
  1118.  
  1119. it('should add new product', function () {
  1120. addProductPage.selectType(product.type);
  1121. addProductPage.selectFirstCollection();
  1122. addProductPage.fillTitle(productTitle);
  1123. addProductPage.fillPrice(product.price);
  1124. addProductPage.clickPublish();
  1125. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1126. });
  1127.  
  1128. it('should open new collection page', function () {
  1129. browser.get(addCollectionLink);
  1130. });
  1131.  
  1132. it('should fill title and description fields', function () {
  1133. addCollectionPage.fillTitle(collectionTitle);
  1134. addCollectionPage.fillDescription(firstCollectionDescription);
  1135. });
  1136.  
  1137. it('should click auto add product radio button', function () {
  1138. addCollectionPage.clickAddAuto();
  1139. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1140. });
  1141.  
  1142. it('should add condition', function () {
  1143. addCollectionPage.selectConditionVariant(0, 'Product title');
  1144. addCollectionPage.selectConditionRule(0, 'ends with');
  1145. addCollectionPage.fillConditionValue(0, unique_value);
  1146. });
  1147.  
  1148. it('should add new collection', function () {
  1149. addCollectionPage.clickPublish();
  1150. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1151. });
  1152.  
  1153. it('should show collection page after click on collection link', function () {
  1154. collectionListPage.clickCollection(collectionTitle);
  1155. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1156.  
  1157. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1158. commonHelper.switchToPreviousTab();
  1159. });
  1160. });
  1161.  
  1162. describe('auto-add product by product title contains', function () {
  1163.  
  1164. var unique_value = commonHelper.uniqueValue();
  1165. var collectionTitle = firstCollectionTitle + unique_value;
  1166. var productTitle = product.firstTitle + unique_value + 'contains';
  1167.  
  1168. beforeAll(function () {
  1169. commonHelper.acceptAlert();
  1170. browser.get(signInData.link);
  1171. });
  1172.  
  1173. afterAll(function () {
  1174. commonHelper.clearAllData();
  1175. });
  1176.  
  1177. it('should redirect on dashboard page after login', function () {
  1178. signInPage.login(username, password);
  1179. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1180. });
  1181.  
  1182. it('should redirect on add product page', function () {
  1183. browser.get(productData.addLink);
  1184. addProductPage.waitForPublishButton();
  1185. });
  1186.  
  1187. it('should add new product', function () {
  1188. addProductPage.selectType(product.type);
  1189. addProductPage.selectFirstCollection();
  1190. addProductPage.fillTitle(productTitle);
  1191. addProductPage.fillPrice(product.price);
  1192. addProductPage.clickPublish();
  1193. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1194. });
  1195.  
  1196. it('should open new collection page', function () {
  1197. browser.get(addCollectionLink);
  1198. });
  1199.  
  1200. it('should fill title and description fields', function () {
  1201. addCollectionPage.fillTitle(collectionTitle);
  1202. addCollectionPage.fillDescription(firstCollectionDescription);
  1203. });
  1204.  
  1205. it('should click auto add product radio button', function () {
  1206. addCollectionPage.clickAddAuto();
  1207. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1208. });
  1209.  
  1210. it('should add condition', function () {
  1211. addCollectionPage.selectConditionVariant(0, 'Product title');
  1212. addCollectionPage.selectConditionRule(0, 'contains');
  1213. addCollectionPage.fillConditionValue(0, unique_value);
  1214. });
  1215.  
  1216. it('should add new collection', function () {
  1217. addCollectionPage.clickPublish();
  1218. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1219. });
  1220.  
  1221. it('should show collection page after click on collection link', function () {
  1222. collectionListPage.clickCollection(collectionTitle);
  1223. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1224.  
  1225. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1226. commonHelper.switchToPreviousTab();
  1227. });
  1228. });
  1229. });
  1230. ---------------------------------------------------------------------------------------------------------------------------
  1231. by_type.spec.js
  1232.  
  1233. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  1234. var signInPage = pageObject.getSignInPage();
  1235. var dashboardPage = pageObject.getDashboardPage();
  1236. var addCollectionPage = pageObject.getAddCollectionPage();
  1237. var collectionListPage = pageObject.getCollectionListPage();
  1238. var collectionsPage = pageObject.getCollectionsPage();
  1239. var addProductPage = pageObject.getAddProductPage();
  1240. var productListPage = pageObject.getProductListPage();
  1241. var signInData = require('./../../../../../../data/admin/sign_in/index');
  1242. var collectionData = require('./../../../../../../data/admin/collection/index');
  1243. var productData = require('./../../../../../../data/admin/product/index');
  1244. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  1245.  
  1246. describe('Add Collection - Auto Adding - By Type', function () {
  1247.  
  1248. var username = signInData.adminAccount.username;
  1249. var password = signInData.adminAccount.password;
  1250. var firstCollectionTitle = commonHelper.uniqueProductName('type1');
  1251. var firstCollectionDescription = collectionData.collection.description.first;
  1252.  
  1253. var addCollectionLink = signInData.link + '/collections/create';
  1254.  
  1255. var product = {
  1256. firstTitle: commonHelper.uniqueProductName('type2'),
  1257. type: productData.product.type,
  1258. price: productData.product.price
  1259. };
  1260.  
  1261. describe('auto-add product by product type does not contain', function () {
  1262.  
  1263. var unique_value = commonHelper.uniqueValue();
  1264. var collectionTitle = firstCollectionTitle + unique_value;
  1265. var productTitle = product.firstTitle + unique_value;
  1266. var productType = 'cups' + unique_value;
  1267.  
  1268. beforeAll(function () {
  1269. commonHelper.acceptAlert();
  1270. browser.get(signInData.link);
  1271. });
  1272.  
  1273. afterAll(function () {
  1274. commonHelper.clearAllData();
  1275. });
  1276.  
  1277. it('should redirect on dashboard page after login', function () {
  1278. signInPage.login(username, password);
  1279. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1280. });
  1281.  
  1282. it('should redirect on add product page', function () {
  1283. browser.get(productData.addLink);
  1284. addProductPage.waitForPublishButton();
  1285. });
  1286.  
  1287. it('should add new product', function () {
  1288. addProductPage.selectType(productType);
  1289. addProductPage.selectFirstCollection();
  1290. addProductPage.fillTitle(productTitle);
  1291. addProductPage.fillPrice(product.price);
  1292. addProductPage.clickPublish();
  1293. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1294. });
  1295.  
  1296. it('should open new collection page', function () {
  1297. browser.get(addCollectionLink);
  1298. });
  1299.  
  1300. it('should fill title and description fields', function () {
  1301. addCollectionPage.fillTitle(collectionTitle);
  1302. addCollectionPage.fillDescription(firstCollectionDescription);
  1303. });
  1304.  
  1305. it('should click auto add product radio button', function () {
  1306. addCollectionPage.clickAddAuto();
  1307. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1308. });
  1309.  
  1310. it('should add condition', function () {
  1311. addCollectionPage.selectConditionVariant(0, 'Product type');
  1312. addCollectionPage.selectConditionRule(0, 'does not contain');
  1313. addCollectionPage.fillConditionValue(0, product.type);
  1314. });
  1315.  
  1316. it('should add new collection', function () {
  1317. addCollectionPage.clickPublish();
  1318. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1319. });
  1320.  
  1321. it('should show collection page after click on collection link', function () {
  1322. collectionListPage.clickCollection(collectionTitle);
  1323. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1324.  
  1325. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1326. commonHelper.switchToPreviousTab();
  1327. });
  1328. });
  1329.  
  1330. describe('auto-add product by product type is exactly', function () {
  1331.  
  1332. var unique_value = commonHelper.uniqueValue();
  1333. var collectionTitle = firstCollectionTitle + unique_value;
  1334. var productTitle = product.firstTitle + unique_value;
  1335. var productType = product.type + unique_value;
  1336.  
  1337. beforeAll(function () {
  1338. commonHelper.acceptAlert();
  1339. browser.get(signInData.link);
  1340. });
  1341.  
  1342. afterAll(function () {
  1343. commonHelper.clearAllData();
  1344. });
  1345.  
  1346. it('should redirect on dashboard page after login', function () {
  1347. signInPage.login(username, password);
  1348. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1349. });
  1350.  
  1351. it('should redirect on add product page', function () {
  1352. browser.get(productData.addLink);
  1353. addProductPage.waitForPublishButton();
  1354. });
  1355.  
  1356. it('should add new product', function () {
  1357. addProductPage.selectType(productType);
  1358. addProductPage.selectFirstCollection();
  1359. addProductPage.fillTitle(productTitle);
  1360. addProductPage.fillPrice(product.price);
  1361. addProductPage.clickPublish();
  1362. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1363. });
  1364.  
  1365. it('should open new collection page', function () {
  1366. browser.get(addCollectionLink);
  1367. });
  1368.  
  1369. it('should fill title and description fields', function () {
  1370. addCollectionPage.fillTitle(collectionTitle);
  1371. addCollectionPage.fillDescription(firstCollectionDescription);
  1372. });
  1373.  
  1374. it('should click auto add product radio button', function () {
  1375. addCollectionPage.clickAddAuto();
  1376. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1377. });
  1378.  
  1379. it('should add condition', function () {
  1380. addCollectionPage.selectConditionVariant(0, 'Product type');
  1381. addCollectionPage.selectConditionRule(0, 'is exactly');
  1382. addCollectionPage.fillConditionValue(0, productType);
  1383. });
  1384.  
  1385. it('should add new collection', function () {
  1386. addCollectionPage.clickPublish();
  1387. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1388. });
  1389.  
  1390. it('should show collection page after click on collection link', function () {
  1391. collectionListPage.clickCollection(collectionTitle);
  1392. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1393.  
  1394. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1395. commonHelper.switchToPreviousTab();
  1396. });
  1397. });
  1398.  
  1399. describe('auto-add product by product type starts with', function () {
  1400.  
  1401. var unique_value = commonHelper.uniqueValue();
  1402. var collectionTitle = firstCollectionTitle + unique_value;
  1403. var productTitle = product.firstTitle + unique_value;
  1404. var productType = firstCollectionTitle + product.type;
  1405.  
  1406. beforeAll(function () {
  1407. commonHelper.acceptAlert();
  1408. browser.get(signInData.link);
  1409. });
  1410.  
  1411. afterAll(function () {
  1412. commonHelper.clearAllData();
  1413. });
  1414.  
  1415. it('should redirect on dashboard page after login', function () {
  1416. signInPage.login(username, password);
  1417. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1418. });
  1419.  
  1420. it('should redirect on add product page', function () {
  1421. browser.get(productData.addLink);
  1422. addProductPage.waitForPublishButton();
  1423. });
  1424.  
  1425. it('should add new product', function () {
  1426. addProductPage.selectType(productType);
  1427. addProductPage.selectFirstCollection();
  1428. addProductPage.fillTitle(productTitle);
  1429. addProductPage.fillPrice(product.price);
  1430. addProductPage.clickPublish();
  1431. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1432. });
  1433.  
  1434. it('should open new collection page', function () {
  1435. browser.get(addCollectionLink);
  1436. });
  1437.  
  1438. it('should fill title and description fields', function () {
  1439. addCollectionPage.fillTitle(collectionTitle);
  1440. addCollectionPage.fillDescription(firstCollectionDescription);
  1441. });
  1442.  
  1443. it('should click auto add product radio button', function () {
  1444. addCollectionPage.clickAddAuto();
  1445. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1446. });
  1447.  
  1448. it('should add condition', function () {
  1449. addCollectionPage.selectConditionVariant(0, 'Product type');
  1450. addCollectionPage.selectConditionRule(0, 'starts with');
  1451. addCollectionPage.fillConditionValue(0, firstCollectionTitle);
  1452. });
  1453.  
  1454. it('should add new collection', function () {
  1455. addCollectionPage.clickPublish();
  1456. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1457. });
  1458.  
  1459. it('should show collection page after click on collection link', function () {
  1460. collectionListPage.clickCollection(collectionTitle);
  1461. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1462.  
  1463. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1464. commonHelper.switchToPreviousTab();
  1465. });
  1466. });
  1467.  
  1468. describe('auto-add product by product type ends with', function () {
  1469.  
  1470. var unique_value = commonHelper.uniqueValue();
  1471. var collectionTitle = firstCollectionTitle + unique_value;
  1472. var productTitle = product.firstTitle + unique_value;
  1473. var productType = product.type + unique_value;
  1474.  
  1475. beforeAll(function () {
  1476. commonHelper.acceptAlert();
  1477. browser.get(signInData.link);
  1478. });
  1479.  
  1480. afterAll(function () {
  1481. commonHelper.clearAllData();
  1482. });
  1483.  
  1484. it('should redirect on dashboard page after login', function () {
  1485. signInPage.login(username, password);
  1486. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1487. });
  1488.  
  1489. it('should redirect on add product page', function () {
  1490. browser.get(productData.addLink);
  1491. addProductPage.waitForPublishButton();
  1492. });
  1493.  
  1494. it('should add new product', function () {
  1495. addProductPage.selectType(productType);
  1496. addProductPage.selectFirstCollection();
  1497. addProductPage.fillTitle(productTitle);
  1498. addProductPage.fillPrice(product.price);
  1499. addProductPage.clickPublish();
  1500. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1501. });
  1502.  
  1503. it('should open new collection page', function () {
  1504. browser.get(addCollectionLink);
  1505. });
  1506.  
  1507. it('should fill title and description fields', function () {
  1508. addCollectionPage.fillTitle(collectionTitle);
  1509. addCollectionPage.fillDescription(firstCollectionDescription);
  1510. });
  1511.  
  1512. it('should click auto add product radio button', function () {
  1513. addCollectionPage.clickAddAuto();
  1514. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1515. });
  1516.  
  1517. it('should add condition', function () {
  1518. addCollectionPage.selectConditionVariant(0, 'Product type');
  1519. addCollectionPage.selectConditionRule(0, 'ends with');
  1520. addCollectionPage.fillConditionValue(0, unique_value);
  1521. });
  1522.  
  1523. it('should add new collection', function () {
  1524. addCollectionPage.clickPublish();
  1525. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1526. });
  1527.  
  1528. it('should show collection page after click on collection link', function () {
  1529. collectionListPage.clickCollection(collectionTitle);
  1530. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1531. });
  1532.  
  1533. it('should see product', function check(done) {
  1534. collectionsPage.allProducts(productTitle).count().then(function(result){
  1535. if(result == 1){
  1536. done();
  1537. }else {
  1538. collectionsPage.clickPaginationButton('Next');
  1539. check(done);
  1540. }
  1541. })
  1542. });
  1543.  
  1544. it('should switch to previous tab', function () {
  1545. commonHelper.switchToPreviousTab();
  1546. });
  1547. });
  1548.  
  1549. describe('auto-add product by product type contains', function () {
  1550.  
  1551. var unique_value = commonHelper.uniqueValue();
  1552. var collectionTitle = firstCollectionTitle + unique_value;
  1553. var productTitle = product.firstTitle + unique_value;
  1554. var productType = product.type + unique_value + 'contains';
  1555.  
  1556. beforeAll(function () {
  1557. commonHelper.acceptAlert();
  1558. browser.get(signInData.link);
  1559. });
  1560.  
  1561. afterAll(function () {
  1562. commonHelper.clearAllData();
  1563. });
  1564.  
  1565. it('should redirect on dashboard page after login', function () {
  1566. signInPage.login(username, password);
  1567. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1568. });
  1569.  
  1570. it('should redirect on add product page', function () {
  1571. browser.get(productData.addLink);
  1572. addProductPage.waitForPublishButton();
  1573. });
  1574.  
  1575. it('should add new product', function () {
  1576. addProductPage.selectType(productType);
  1577. addProductPage.selectFirstCollection();
  1578. addProductPage.fillTitle(productTitle);
  1579. addProductPage.fillPrice(product.price);
  1580. addProductPage.clickPublish();
  1581. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1582. });
  1583.  
  1584. it('should open new collection page', function () {
  1585. browser.get(addCollectionLink);
  1586. });
  1587.  
  1588. it('should fill title and description fields', function () {
  1589. addCollectionPage.fillTitle(collectionTitle);
  1590. addCollectionPage.fillDescription(firstCollectionDescription);
  1591. });
  1592.  
  1593. it('should click auto add product radio button', function () {
  1594. addCollectionPage.clickAddAuto();
  1595. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1596. });
  1597.  
  1598. it('should add condition', function () {
  1599. addCollectionPage.selectConditionVariant(0, 'Product type');
  1600. addCollectionPage.selectConditionRule(0, 'contains');
  1601. addCollectionPage.fillConditionValue(0, unique_value);
  1602. });
  1603.  
  1604. it('should add new collection', function () {
  1605. addCollectionPage.clickPublish();
  1606. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1607. });
  1608.  
  1609. it('should show collection page after click on collection link', function () {
  1610. collectionListPage.clickCollection(collectionTitle);
  1611. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1612.  
  1613. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1614. commonHelper.switchToPreviousTab();
  1615. });
  1616. });
  1617. });
  1618. ---------------------------------------------------------------------------------------------------------------------------
  1619. by_varian.spec.js
  1620.  
  1621. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  1622. var signInPage = pageObject.getSignInPage();
  1623. var dashboardPage = pageObject.getDashboardPage();
  1624. var addCollectionPage = pageObject.getAddCollectionPage();
  1625. var collectionListPage = pageObject.getCollectionListPage();
  1626. var collectionsPage = pageObject.getCollectionsPage();
  1627. var addProductPage = pageObject.getAddProductPage();
  1628. var productListPage = pageObject.getProductListPage();
  1629. var signInData = require('./../../../../../../data/admin/sign_in/index');
  1630. var collectionData = require('./../../../../../../data/admin/collection/index');
  1631. var productData = require('./../../../../../../data/admin/product/index');
  1632. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  1633.  
  1634. describe('Add Collection - Auto Adding - By Variant', function () {
  1635.  
  1636. var username = signInData.adminAccount.username;
  1637. var password = signInData.adminAccount.password;
  1638. var firstCollectionTitle = commonHelper.uniqueProductName('variant1');
  1639. var firstCollectionDescription = collectionData.collection.description.first;
  1640.  
  1641. var addCollectionLink = signInData.link + '/collections/create';
  1642.  
  1643. var product = {
  1644. firstTitle: commonHelper.uniqueProductName('variant2'),
  1645. type: productData.product.type,
  1646. price: productData.product.price,
  1647. firstColor: productData.product.color.first,
  1648. secondColor: productData.product.color.second,
  1649. firstSize: productData.product.size.first,
  1650. secondSize: productData.product.size.second,
  1651. firstVariant: productData.product.color.first + ' / ' + productData.product.size.first
  1652. };
  1653.  
  1654. describe('auto-add product by product variant does not contain', function () {
  1655.  
  1656. var unique_value = commonHelper.uniqueValue();
  1657. var collectionTitle = firstCollectionTitle + unique_value;
  1658. var productTitle = product.firstTitle + unique_value;
  1659. var productVariant = product.firstColor + '1';
  1660.  
  1661. beforeAll(function () {
  1662. commonHelper.acceptAlert();
  1663. browser.get(signInData.link);
  1664. });
  1665.  
  1666. afterAll(function () {
  1667. commonHelper.clearAllData();
  1668. });
  1669.  
  1670. it('should redirect on dashboard page after login', function () {
  1671. signInPage.login(username, password);
  1672. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1673. });
  1674.  
  1675. it('should redirect on add product page', function () {
  1676. browser.get(productData.addLink);
  1677. addProductPage.waitForPublishButton();
  1678. });
  1679.  
  1680. it('should add new product', function () {
  1681. addProductPage.clickMulti();
  1682. addProductPage.selectType(product.type);
  1683. addProductPage.selectFirstCollection();
  1684. addProductPage.fillTitle(productTitle);
  1685. addProductPage.fillOptionTitle(0, 'Color');
  1686. addProductPage.fillOptionValue(0, product.firstColor);
  1687. addProductPage.fillOptionValue(0, product.secondColor);
  1688. addProductPage.fillOptionTitle(1, 'Size');
  1689. addProductPage.fillOptionValue(1, product.firstSize);
  1690. addProductPage.fillOptionValue(1, product.secondSize);
  1691.  
  1692. addProductPage.fillVariantPrice(product.firstVariant ,product.price);
  1693. addProductPage.clickVariantPriceAutofill(product.firstVariant);
  1694.  
  1695. addProductPage.clickPublish();
  1696. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1697. });
  1698.  
  1699. it('should open new collection page', function () {
  1700. browser.get(addCollectionLink);
  1701. });
  1702.  
  1703. it('should fill title and description fields', function () {
  1704. addCollectionPage.fillTitle(collectionTitle);
  1705. addCollectionPage.fillDescription(firstCollectionDescription);
  1706. });
  1707.  
  1708. it('should click auto add product radio button', function () {
  1709. addCollectionPage.clickAddAuto();
  1710. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1711. });
  1712.  
  1713. it('should add condition', function () {
  1714. addCollectionPage.selectConditionVariant(0, 'Variant option value');
  1715. addCollectionPage.selectConditionRule(0, 'does not contain');
  1716. addCollectionPage.fillConditionValue(0, productVariant);
  1717. });
  1718.  
  1719. it('should add new collection', function () {
  1720. addCollectionPage.clickPublish();
  1721. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1722. });
  1723.  
  1724. it('should show collection page after click on collection link', function () {
  1725. collectionListPage.clickCollection(collectionTitle);
  1726. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1727. });
  1728.  
  1729. it('should see product', function check(done) {
  1730. collectionsPage.allProducts(productTitle).count().then(function(result){
  1731. if(result == 1){
  1732. done();
  1733. }else {
  1734. collectionsPage.clickPaginationButton('Next');
  1735. check(done);
  1736. }
  1737. })
  1738. });
  1739.  
  1740. it('should switch to previous tab', function () {
  1741. commonHelper.switchToPreviousTab();
  1742. });
  1743. });
  1744.  
  1745. describe('auto-add product by product variant is exactly', function () {
  1746.  
  1747. var unique_value = commonHelper.uniqueValue();
  1748. var collectionTitle = firstCollectionTitle + unique_value;
  1749. var productTitle = product.firstTitle + unique_value;
  1750.  
  1751. beforeAll(function () {
  1752. commonHelper.acceptAlert();
  1753. browser.get(signInData.link);
  1754. });
  1755.  
  1756. afterAll(function () {
  1757. commonHelper.clearAllData();
  1758. });
  1759.  
  1760. it('should redirect on dashboard page after login', function () {
  1761. signInPage.login(username, password);
  1762. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1763. });
  1764.  
  1765. it('should redirect on add product page', function () {
  1766. browser.get(productData.addLink);
  1767. addProductPage.waitForPublishButton();
  1768. });
  1769.  
  1770. it('should add new product', function () {
  1771. addProductPage.clickMulti();
  1772. addProductPage.selectType(product.type);
  1773. addProductPage.selectFirstCollection();
  1774. addProductPage.fillTitle(productTitle);
  1775. addProductPage.fillOptionTitle(0, 'Color');
  1776. addProductPage.fillOptionValue(0, product.firstColor);
  1777. addProductPage.fillOptionValue(0, product.secondColor);
  1778. addProductPage.fillOptionTitle(1, 'Size');
  1779. addProductPage.fillOptionValue(1, product.firstSize);
  1780. addProductPage.fillOptionValue(1, product.secondSize);
  1781.  
  1782. addProductPage.fillVariantPrice(product.firstVariant ,product.price);
  1783. addProductPage.clickVariantPriceAutofill(product.firstVariant);
  1784.  
  1785. addProductPage.clickPublish();
  1786. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1787. });
  1788.  
  1789. it('should open new collection page', function () {
  1790. browser.get(addCollectionLink);
  1791. });
  1792.  
  1793. it('should fill title and description fields', function () {
  1794. addCollectionPage.fillTitle(collectionTitle);
  1795. addCollectionPage.fillDescription(firstCollectionDescription);
  1796. });
  1797.  
  1798. it('should click auto add product radio button', function () {
  1799. addCollectionPage.clickAddAuto();
  1800. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1801. });
  1802.  
  1803. it('should add condition', function () {
  1804. addCollectionPage.selectConditionVariant(0, 'Variant option value');
  1805. addCollectionPage.selectConditionRule(0, 'is exactly');
  1806. addCollectionPage.fillConditionValue(0, product.firstSize);
  1807. });
  1808.  
  1809. it('should add new collection', function () {
  1810. addCollectionPage.clickPublish();
  1811. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1812. });
  1813.  
  1814. it('should show collection page after click on collection link', function () {
  1815. collectionListPage.clickCollection(collectionTitle);
  1816. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1817. });
  1818.  
  1819. it('should see product', function check(done) {
  1820. collectionsPage.allProducts(productTitle).count().then(function(result){
  1821. if(result == 1){
  1822. done();
  1823. }else {
  1824. collectionsPage.clickPaginationButton('Next');
  1825. check(done);
  1826. }
  1827. })
  1828. });
  1829.  
  1830. it('should switch to previous tab', function () {
  1831. commonHelper.switchToPreviousTab();
  1832. });
  1833. });
  1834.  
  1835. describe('auto-add product by product variant starts with', function () {
  1836.  
  1837. var unique_value = commonHelper.uniqueValue();
  1838. var collectionTitle = firstCollectionTitle + unique_value;
  1839. var productTitle = product.firstTitle + unique_value;
  1840. var productVariant = 'Re';
  1841.  
  1842. beforeAll(function () {
  1843. commonHelper.acceptAlert();
  1844. browser.get(signInData.link);
  1845. });
  1846.  
  1847. afterAll(function () {
  1848. commonHelper.clearAllData();
  1849. });
  1850.  
  1851. it('should redirect on dashboard page after login', function () {
  1852. signInPage.login(username, password);
  1853. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1854. });
  1855.  
  1856. it('should redirect on add product page', function () {
  1857. browser.get(productData.addLink);
  1858. addProductPage.waitForPublishButton();
  1859. });
  1860.  
  1861. it('should add new product', function () {
  1862. addProductPage.clickMulti();
  1863. addProductPage.selectType(product.type);
  1864. addProductPage.selectFirstCollection();
  1865. addProductPage.fillTitle(productTitle);
  1866. addProductPage.fillOptionTitle(0, 'Color');
  1867. addProductPage.fillOptionValue(0, product.firstColor);
  1868. addProductPage.fillOptionValue(0, product.secondColor);
  1869. addProductPage.fillOptionTitle(1, 'Size');
  1870. addProductPage.fillOptionValue(1, product.firstSize);
  1871. addProductPage.fillOptionValue(1, product.secondSize);
  1872.  
  1873. addProductPage.fillVariantPrice(product.firstVariant ,product.price);
  1874. addProductPage.clickVariantPriceAutofill(product.firstVariant);
  1875.  
  1876. addProductPage.clickPublish();
  1877. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1878. });
  1879.  
  1880. it('should open new collection page', function () {
  1881. browser.get(addCollectionLink);
  1882. });
  1883.  
  1884. it('should fill title and description fields', function () {
  1885. addCollectionPage.fillTitle(collectionTitle);
  1886. addCollectionPage.fillDescription(firstCollectionDescription);
  1887. });
  1888.  
  1889. it('should click auto add product radio button', function () {
  1890. addCollectionPage.clickAddAuto();
  1891. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1892. });
  1893.  
  1894. it('should add condition', function () {
  1895. addCollectionPage.selectConditionVariant(0, 'Variant option value');
  1896. addCollectionPage.selectConditionRule(0, 'starts with');
  1897. addCollectionPage.fillConditionValue(0, productVariant);
  1898. });
  1899.  
  1900. it('should add new collection', function () {
  1901. addCollectionPage.clickPublish();
  1902. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1903. });
  1904.  
  1905. it('should show collection page after click on collection link', function () {
  1906. collectionListPage.clickCollection(collectionTitle);
  1907. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1908.  
  1909. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1910. commonHelper.switchToPreviousTab();
  1911. });
  1912. });
  1913.  
  1914. describe('auto-add product by product variant ends with', function () {
  1915.  
  1916. var unique_value = commonHelper.uniqueValue();
  1917. var collectionTitle = firstCollectionTitle + unique_value;
  1918. var productTitle = product.firstTitle + unique_value;
  1919. var productVariant = 'all';
  1920.  
  1921. beforeAll(function () {
  1922. commonHelper.acceptAlert();
  1923. browser.get(signInData.link);
  1924. });
  1925.  
  1926. afterAll(function () {
  1927. commonHelper.clearAllData();
  1928. });
  1929.  
  1930. it('should redirect on dashboard page after login', function () {
  1931. signInPage.login(username, password);
  1932. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  1933. });
  1934.  
  1935. it('should redirect on add product page', function () {
  1936. browser.get(productData.addLink);
  1937. addProductPage.waitForPublishButton();
  1938. });
  1939.  
  1940. it('should add new product', function () {
  1941. addProductPage.clickMulti();
  1942. addProductPage.selectType(product.type);
  1943. addProductPage.selectFirstCollection();
  1944. addProductPage.fillTitle(productTitle);
  1945. addProductPage.fillOptionTitle(0, 'Color');
  1946. addProductPage.fillOptionValue(0, product.firstColor);
  1947. addProductPage.fillOptionValue(0, product.secondColor);
  1948. addProductPage.fillOptionTitle(1, 'Size');
  1949. addProductPage.fillOptionValue(1, product.firstSize);
  1950. addProductPage.fillOptionValue(1, product.secondSize);
  1951.  
  1952. addProductPage.fillVariantPrice(product.firstVariant ,product.price);
  1953. addProductPage.clickVariantPriceAutofill(product.firstVariant);
  1954.  
  1955. addProductPage.clickPublish();
  1956. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  1957. });
  1958.  
  1959. it('should open new collection page', function () {
  1960. browser.get(addCollectionLink);
  1961. });
  1962.  
  1963. it('should fill title and description fields', function () {
  1964. addCollectionPage.fillTitle(collectionTitle);
  1965. addCollectionPage.fillDescription(firstCollectionDescription);
  1966. });
  1967.  
  1968. it('should click auto add product radio button', function () {
  1969. addCollectionPage.clickAddAuto();
  1970. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  1971. });
  1972.  
  1973. it('should add condition', function () {
  1974. addCollectionPage.selectConditionVariant(0, 'Variant option value');
  1975. addCollectionPage.selectConditionRule(0, 'ends with');
  1976. addCollectionPage.fillConditionValue(0, productVariant);
  1977. });
  1978.  
  1979. it('should add new collection', function () {
  1980. addCollectionPage.clickPublish();
  1981. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  1982. });
  1983.  
  1984. it('should show collection page after click on collection link', function () {
  1985. collectionListPage.clickCollection(collectionTitle);
  1986. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  1987.  
  1988. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  1989. commonHelper.switchToPreviousTab();
  1990. });
  1991. });
  1992.  
  1993. describe('auto-add product by product variant contains', function () {
  1994.  
  1995. var unique_value = commonHelper.uniqueValue();
  1996. var collectionTitle = firstCollectionTitle + unique_value;
  1997. var productTitle = product.firstTitle + unique_value;
  1998.  
  1999. beforeAll(function () {
  2000. commonHelper.acceptAlert();
  2001. browser.get(signInData.link);
  2002. });
  2003.  
  2004. afterAll(function () {
  2005. commonHelper.clearAllData();
  2006. });
  2007.  
  2008. it('should redirect on dashboard page after login', function () {
  2009. signInPage.login(username, password);
  2010. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2011. });
  2012.  
  2013. it('should redirect on add product page', function () {
  2014. browser.get(productData.addLink);
  2015. addProductPage.waitForPublishButton();
  2016. });
  2017.  
  2018. it('should add new product', function () {
  2019. addProductPage.clickMulti();
  2020. addProductPage.selectType(product.type);
  2021. addProductPage.selectFirstCollection();
  2022. addProductPage.fillTitle(productTitle);
  2023. addProductPage.fillOptionTitle(0, 'Color');
  2024. addProductPage.fillOptionValue(0, product.firstColor);
  2025. addProductPage.fillOptionValue(0, product.secondColor);
  2026. addProductPage.fillOptionTitle(1, 'Size');
  2027. addProductPage.fillOptionValue(1, product.firstSize);
  2028. addProductPage.fillOptionValue(1, product.secondSize);
  2029.  
  2030. addProductPage.fillVariantPrice(product.firstVariant ,product.price);
  2031. addProductPage.clickVariantPriceAutofill(product.firstVariant);
  2032.  
  2033. addProductPage.clickPublish();
  2034. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2035. });
  2036.  
  2037. it('should open new collection page', function () {
  2038. browser.get(addCollectionLink);
  2039. });
  2040.  
  2041. it('should fill title and description fields', function () {
  2042. addCollectionPage.fillTitle(collectionTitle);
  2043. addCollectionPage.fillDescription(firstCollectionDescription);
  2044. });
  2045.  
  2046. it('should click auto add product radio button', function () {
  2047. addCollectionPage.clickAddAuto();
  2048. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2049. });
  2050.  
  2051. it('should add condition', function () {
  2052. addCollectionPage.selectConditionVariant(0, 'Variant option value');
  2053. addCollectionPage.selectConditionRule(0, 'contains');
  2054. addCollectionPage.fillConditionValue(0, product.secondColor);
  2055. });
  2056.  
  2057. it('should add new collection', function () {
  2058. addCollectionPage.clickPublish();
  2059. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2060. });
  2061.  
  2062. it('should show collection page after click on collection link', function () {
  2063. collectionListPage.clickCollection(collectionTitle);
  2064. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2065.  
  2066. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2067. commonHelper.switchToPreviousTab();
  2068. });
  2069. });
  2070. });
  2071. ---------------------------------------------------------------------------------------------------------------------------
  2072. by_vendor.spec.js
  2073.  
  2074. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  2075. var signInPage = pageObject.getSignInPage();
  2076. var dashboardPage = pageObject.getDashboardPage();
  2077. var addCollectionPage = pageObject.getAddCollectionPage();
  2078. var collectionListPage = pageObject.getCollectionListPage();
  2079. var collectionsPage = pageObject.getCollectionsPage();
  2080. var addProductPage = pageObject.getAddProductPage();
  2081. var productListPage = pageObject.getProductListPage();
  2082. var signInData = require('./../../../../../../data/admin/sign_in/index');
  2083. var collectionData = require('./../../../../../../data/admin/collection/index');
  2084. var productData = require('./../../../../../../data/admin/product/index');
  2085. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  2086.  
  2087. describe('Add Collection - Auto Adding - By Vendor', function () {
  2088.  
  2089. var username = signInData.adminAccount.username;
  2090. var password = signInData.adminAccount.password;
  2091. var firstCollectionTitle = commonHelper.uniqueProductName('vendor1');
  2092. var firstCollectionDescription = collectionData.collection.description.first;
  2093.  
  2094. var addCollectionLink = signInData.link + '/collections/create';
  2095.  
  2096. var product = {
  2097. firstTitle: commonHelper.uniqueProductName('vendor2'),
  2098. type: productData.product.type,
  2099. vendor: productData.product.vendor,
  2100. price: productData.product.price
  2101. };
  2102.  
  2103. describe('auto-add product by product vendor does not contain', function () {
  2104.  
  2105. var unique_value = commonHelper.uniqueValue();
  2106. var collectionTitle = firstCollectionTitle + unique_value;
  2107. var productTitle = product.firstTitle + unique_value;
  2108. var productVendor = 'glass' + unique_value;
  2109.  
  2110. beforeAll(function () {
  2111. commonHelper.acceptAlert();
  2112. browser.get(signInData.link);
  2113. });
  2114.  
  2115. afterAll(function () {
  2116. commonHelper.clearAllData();
  2117. });
  2118.  
  2119. it('should redirect on dashboard page after login', function () {
  2120. signInPage.login(username, password);
  2121. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2122. });
  2123.  
  2124. it('should redirect on add product page', function () {
  2125. browser.get(productData.addLink);
  2126. addProductPage.waitForPublishButton();
  2127. });
  2128.  
  2129. it('should add new product', function () {
  2130. addProductPage.selectType(product.type);
  2131. addProductPage.selectFirstCollection();
  2132. addProductPage.fillTitle(productTitle);
  2133. addProductPage.fillPrice(product.price);
  2134. addProductPage.selectVendor(productVendor);
  2135. addProductPage.clickPublish();
  2136. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2137. });
  2138.  
  2139. it('should open new collection page', function () {
  2140. browser.get(addCollectionLink);
  2141. });
  2142.  
  2143. it('should fill title and description fields', function () {
  2144. addCollectionPage.fillTitle(collectionTitle);
  2145. addCollectionPage.fillDescription(firstCollectionDescription);
  2146. });
  2147.  
  2148. it('should click auto add product radio button', function () {
  2149. addCollectionPage.clickAddAuto();
  2150. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2151. });
  2152.  
  2153. it('should add condition', function () {
  2154. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  2155. addCollectionPage.selectConditionRule(0, 'does not contain');
  2156. addCollectionPage.fillConditionValue(0, product.vendor);
  2157. });
  2158.  
  2159. it('should add new collection', function () {
  2160. addCollectionPage.clickPublish();
  2161. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2162. });
  2163.  
  2164. it('should show collection page after click on collection link', function () {
  2165. collectionListPage.clickCollection(collectionTitle);
  2166. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2167. });
  2168.  
  2169. it('should see product', function check(done) {
  2170. collectionsPage.allProducts(productTitle).count().then(function(result){
  2171. if(result == 1){
  2172. done();
  2173. }else {
  2174. collectionsPage.clickPaginationButton('Next');
  2175. check(done);
  2176. }
  2177. })
  2178. });
  2179.  
  2180. it('should switch to previous tab', function () {
  2181. commonHelper.switchToPreviousTab();
  2182. });
  2183. });
  2184.  
  2185. describe('auto-add product by product vendor is exactly', function () {
  2186.  
  2187. var unique_value = commonHelper.uniqueValue();
  2188. var collectionTitle = firstCollectionTitle + unique_value;
  2189. var productTitle = product.firstTitle + unique_value;
  2190. var productVendor = product.vendor + unique_value;
  2191.  
  2192. beforeAll(function () {
  2193. commonHelper.acceptAlert();
  2194. browser.get(signInData.link);
  2195. });
  2196.  
  2197. afterAll(function () {
  2198. commonHelper.clearAllData();
  2199. });
  2200.  
  2201. it('should redirect on dashboard page after login', function () {
  2202. signInPage.login(username, password);
  2203. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2204. });
  2205.  
  2206. it('should redirect on add product page', function () {
  2207. browser.get(productData.addLink);
  2208. addProductPage.waitForPublishButton();
  2209. });
  2210.  
  2211. it('should add new product', function () {
  2212. addProductPage.selectType(product.type);
  2213. addProductPage.selectFirstCollection();
  2214. addProductPage.selectVendor(productVendor);
  2215. addProductPage.fillTitle(productTitle);
  2216. addProductPage.fillPrice(product.price);
  2217. addProductPage.clickPublish();
  2218. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2219. });
  2220.  
  2221. it('should open new collection page', function () {
  2222. browser.get(addCollectionLink);
  2223. });
  2224.  
  2225. it('should fill title and description fields', function () {
  2226. addCollectionPage.fillTitle(collectionTitle);
  2227. addCollectionPage.fillDescription(firstCollectionDescription);
  2228. });
  2229.  
  2230. it('should click auto add product radio button', function () {
  2231. addCollectionPage.clickAddAuto();
  2232. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2233. });
  2234.  
  2235. it('should add condition', function () {
  2236. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  2237. addCollectionPage.selectConditionRule(0, 'is exactly');
  2238. addCollectionPage.fillConditionValue(0, productVendor);
  2239. });
  2240.  
  2241. it('should add new collection', function () {
  2242. addCollectionPage.clickPublish();
  2243. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2244. });
  2245.  
  2246. it('should show collection page after click on collection link', function () {
  2247. collectionListPage.clickCollection(collectionTitle);
  2248. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2249.  
  2250. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2251. commonHelper.switchToPreviousTab();
  2252. });
  2253. });
  2254.  
  2255. describe('auto-add product by product vendor starts with', function () {
  2256.  
  2257. var unique_value = commonHelper.uniqueValue();
  2258. var collectionTitle = firstCollectionTitle + unique_value;
  2259. var productTitle = product.firstTitle + unique_value;
  2260. var productVendor = firstCollectionTitle + product.vendor;
  2261.  
  2262. beforeAll(function () {
  2263. commonHelper.acceptAlert();
  2264. browser.get(signInData.link);
  2265. });
  2266.  
  2267. afterAll(function () {
  2268. commonHelper.clearAllData();
  2269. });
  2270.  
  2271. it('should redirect on dashboard page after login', function () {
  2272. signInPage.login(username, password);
  2273. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2274. });
  2275.  
  2276. it('should redirect on add product page', function () {
  2277. browser.get(productData.addLink);
  2278. addProductPage.waitForPublishButton();
  2279. });
  2280.  
  2281. it('should add new product', function () {
  2282. addProductPage.selectType(product.type);
  2283. addProductPage.selectFirstCollection();
  2284. addProductPage.selectVendor(productVendor);
  2285. addProductPage.fillTitle(productTitle);
  2286. addProductPage.fillPrice(product.price);
  2287. addProductPage.clickPublish();
  2288. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2289. });
  2290.  
  2291. it('should open new collection page', function () {
  2292. browser.get(addCollectionLink);
  2293. });
  2294.  
  2295. it('should fill title and description fields', function () {
  2296. addCollectionPage.fillTitle(collectionTitle);
  2297. addCollectionPage.fillDescription(firstCollectionDescription);
  2298. });
  2299.  
  2300. it('should click auto add product radio button', function () {
  2301. addCollectionPage.clickAddAuto();
  2302. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2303. });
  2304.  
  2305. it('should add condition', function () {
  2306. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  2307. addCollectionPage.selectConditionRule(0, 'starts with');
  2308. addCollectionPage.fillConditionValue(0, firstCollectionTitle);
  2309. });
  2310.  
  2311. it('should add new collection', function () {
  2312. addCollectionPage.clickPublish();
  2313. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2314. });
  2315.  
  2316. it('should show collection page after click on collection link', function () {
  2317. collectionListPage.clickCollection(collectionTitle);
  2318. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2319.  
  2320. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2321. commonHelper.switchToPreviousTab();
  2322. });
  2323. });
  2324.  
  2325. describe('auto-add product by product vendor ends with', function () {
  2326.  
  2327. var unique_value = commonHelper.uniqueValue();
  2328. var collectionTitle = firstCollectionTitle + unique_value;
  2329. var productTitle = product.firstTitle + unique_value;
  2330. var productVendor = product.tag + unique_value;
  2331.  
  2332. beforeAll(function () {
  2333. commonHelper.acceptAlert();
  2334. browser.get(signInData.link);
  2335. });
  2336.  
  2337. afterAll(function () {
  2338. commonHelper.clearAllData();
  2339. });
  2340.  
  2341. it('should redirect on dashboard page after login', function () {
  2342. signInPage.login(username, password);
  2343. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2344. });
  2345.  
  2346. it('should redirect on add product page', function () {
  2347. browser.get(productData.addLink);
  2348. addProductPage.waitForPublishButton();
  2349. });
  2350.  
  2351. it('should add new product', function () {
  2352. addProductPage.selectType(product.type);
  2353. addProductPage.selectFirstCollection();
  2354. addProductPage.fillTitle(productTitle);
  2355. addProductPage.fillPrice(product.price);
  2356. addProductPage.selectVendor(productVendor);
  2357. addProductPage.clickPublish();
  2358. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2359. });
  2360.  
  2361. it('should open new collection page', function () {
  2362. browser.get(addCollectionLink);
  2363. });
  2364.  
  2365. it('should fill title and description fields', function () {
  2366. addCollectionPage.fillTitle(collectionTitle);
  2367. addCollectionPage.fillDescription(firstCollectionDescription);
  2368. });
  2369.  
  2370. it('should click auto add product radio button', function () {
  2371. addCollectionPage.clickAddAuto();
  2372. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2373. });
  2374.  
  2375. it('should add condition', function () {
  2376. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  2377. addCollectionPage.selectConditionRule(0, 'ends with');
  2378. addCollectionPage.fillConditionValue(0, unique_value);
  2379. });
  2380.  
  2381. it('should add new collection', function () {
  2382. addCollectionPage.clickPublish();
  2383. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2384. });
  2385.  
  2386. it('should show collection page after click on collection link', function () {
  2387. collectionListPage.clickCollection(collectionTitle);
  2388. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2389.  
  2390. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2391. commonHelper.switchToPreviousTab();
  2392. });
  2393. });
  2394.  
  2395. describe('auto-add product by product vendor contains', function () {
  2396.  
  2397. var unique_value = commonHelper.uniqueValue();
  2398. var collectionTitle = firstCollectionTitle + unique_value;
  2399. var productTitle = product.firstTitle + unique_value;
  2400. var productVendor = product.type + unique_value + 'contains';
  2401.  
  2402. beforeAll(function () {
  2403. commonHelper.acceptAlert();
  2404. browser.get(signInData.link);
  2405. });
  2406.  
  2407. afterAll(function () {
  2408. commonHelper.clearAllData();
  2409. });
  2410.  
  2411. it('should redirect on dashboard page after login', function () {
  2412. signInPage.login(username, password);
  2413. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2414. });
  2415.  
  2416. it('should redirect on add product page', function () {
  2417. browser.get(productData.addLink);
  2418. addProductPage.waitForPublishButton();
  2419. });
  2420.  
  2421. it('should add new product', function () {
  2422. addProductPage.selectType(product.type);
  2423. addProductPage.selectFirstCollection();
  2424. addProductPage.fillTitle(productTitle);
  2425. addProductPage.fillPrice(product.price);
  2426. addProductPage.selectVendor(productVendor);
  2427. addProductPage.clickPublish();
  2428. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2429. });
  2430.  
  2431. it('should open new collection page', function () {
  2432. browser.get(addCollectionLink);
  2433. });
  2434.  
  2435. it('should fill title and description fields', function () {
  2436. addCollectionPage.fillTitle(collectionTitle);
  2437. addCollectionPage.fillDescription(firstCollectionDescription);
  2438. });
  2439.  
  2440. it('should click auto add product radio button', function () {
  2441. addCollectionPage.clickAddAuto();
  2442. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2443. });
  2444.  
  2445. it('should add condition', function () {
  2446. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  2447. addCollectionPage.selectConditionRule(0, 'contains');
  2448. addCollectionPage.fillConditionValue(0, unique_value);
  2449. });
  2450.  
  2451. it('should add new collection', function () {
  2452. addCollectionPage.clickPublish();
  2453. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2454. });
  2455.  
  2456. it('should show collection page after click on collection link', function () {
  2457. collectionListPage.clickCollection(collectionTitle);
  2458. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2459.  
  2460. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2461. commonHelper.switchToPreviousTab();
  2462. });
  2463. });
  2464. });
  2465. ---------------------------------------------------------------------------------------------------------------------------
  2466. by_weight.spec.js
  2467.  
  2468. var pageObject = require('./../../../../../../services/pages').container.PageObject;
  2469. var signInPage = pageObject.getSignInPage();
  2470. var dashboardPage = pageObject.getDashboardPage();
  2471. var addCollectionPage = pageObject.getAddCollectionPage();
  2472. var collectionListPage = pageObject.getCollectionListPage();
  2473. var collectionsPage = pageObject.getCollectionsPage();
  2474. var addProductPage = pageObject.getAddProductPage();
  2475. var productListPage = pageObject.getProductListPage();
  2476. var signInData = require('./../../../../../../data/admin/sign_in/index');
  2477. var collectionData = require('./../../../../../../data/admin/collection/index');
  2478. var productData = require('./../../../../../../data/admin/product/index');
  2479. var commonHelper = require('./../../../../../../services/helpers/common.helper.js');
  2480.  
  2481. describe('Add Collection - Auto Adding - By Weight', function () {
  2482.  
  2483. var username = signInData.adminAccount.username;
  2484. var password = signInData.adminAccount.password;
  2485. var firstCollectionTitle = commonHelper.uniqueProductName('weight1');
  2486. var firstCollectionDescription = collectionData.collection.description.first;
  2487.  
  2488. var addCollectionLink = signInData.link + '/collections/create';
  2489.  
  2490. var product = {
  2491. firstTitle: commonHelper.uniqueProductName('weight2'),
  2492. type: productData.product.type,
  2493. firstWeight: productData.product.weight,
  2494. secondWeight: '1',
  2495. thirdWeight: '3',
  2496. firstPrice: productData.product.price
  2497. };
  2498.  
  2499. describe('check weight metric', function () {
  2500.  
  2501. beforeAll(function () {
  2502. commonHelper.acceptAlert();
  2503. browser.get(signInData.link);
  2504. });
  2505.  
  2506. afterAll(function () {
  2507. commonHelper.clearAllData();
  2508. });
  2509.  
  2510. it('should redirect on dashboard page after login', function () {
  2511. signInPage.login(username, password);
  2512. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2513. });
  2514.  
  2515. it('should open new collection page', function () {
  2516. browser.get(addCollectionLink);
  2517. });
  2518.  
  2519. it('should click auto add product radio button', function () {
  2520. addCollectionPage.clickAddAuto();
  2521. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2522. });
  2523.  
  2524. it('should select condition', function () {
  2525. addCollectionPage.selectConditionVariant(0, 'Weight');
  2526. });
  2527.  
  2528. it('should show correct price placeholder', function () {
  2529. expect(addCollectionPage.txtConditionWeightPlaceholder()).toEqual('kg');
  2530. });
  2531.  
  2532. it('should select condition', function () {
  2533. addCollectionPage.selectConditionVariant(0, 'Product title');
  2534. });
  2535.  
  2536. it('should not show price placeholder', function () {
  2537. expect(addCollectionPage.plhWeight('kg').isPresent()).toBeFalsy();
  2538. });
  2539. });
  2540.  
  2541. describe('auto-add product by weight is equal', function () {
  2542.  
  2543. var unique_value = commonHelper.uniqueValue();
  2544. var collectionTitle = firstCollectionTitle + unique_value;
  2545. var productTitle = product.firstTitle + unique_value;
  2546.  
  2547. beforeAll(function () {
  2548. commonHelper.acceptAlert();
  2549. browser.get(signInData.link);
  2550. });
  2551.  
  2552. afterAll(function () {
  2553. commonHelper.clearAllData();
  2554. });
  2555.  
  2556. it('should redirect on dashboard page after login', function () {
  2557. signInPage.login(username, password);
  2558. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2559. });
  2560.  
  2561. it('should redirect on add product page', function () {
  2562. browser.get(productData.addLink);
  2563. addProductPage.waitForPublishButton();
  2564. });
  2565.  
  2566. it('should add new product', function () {
  2567. addProductPage.selectType(product.type);
  2568. addProductPage.selectFirstCollection();
  2569. addProductPage.fillTitle(productTitle);
  2570. addProductPage.fillPrice(product.firstPrice);
  2571. addProductPage.fillShippingWeight(product.firstWeight);
  2572. addProductPage.clickPublish();
  2573. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2574. });
  2575.  
  2576. it('should open new collection page', function () {
  2577. browser.get(addCollectionLink);
  2578. });
  2579.  
  2580. it('should fill title and description fields', function () {
  2581. addCollectionPage.fillTitle(collectionTitle);
  2582. addCollectionPage.fillDescription(firstCollectionDescription);
  2583. });
  2584.  
  2585. it('should click auto add product radio button', function () {
  2586. addCollectionPage.clickAddAuto();
  2587. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2588. });
  2589.  
  2590. it('should add condition', function () {
  2591. addCollectionPage.selectConditionVariant(0, 'Weight');
  2592. addCollectionPage.selectConditionRule(0, 'is equal to');
  2593. addCollectionPage.fillConditionValue(0, product.firstWeight);
  2594. });
  2595.  
  2596. it('should add new collection', function () {
  2597. addCollectionPage.clickPublish();
  2598. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2599. });
  2600.  
  2601. it('should show collection page after click on collection link', function () {
  2602. collectionListPage.clickCollection(collectionTitle);
  2603. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2604. });
  2605.  
  2606. it('should see product', function check(done) {
  2607. collectionsPage.allProducts(productTitle).count().then(function(result){
  2608. if(result == 1){
  2609. done();
  2610. }else {
  2611. collectionsPage.clickPaginationButton('Next');
  2612. check(done);
  2613. }
  2614. })
  2615. });
  2616.  
  2617. it('should go to previous tab', function () {
  2618. commonHelper.switchToPreviousTab();
  2619. });
  2620. });
  2621.  
  2622. describe('auto-add product by weight is not equal', function () {
  2623.  
  2624. var unique_value = commonHelper.uniqueValue();
  2625. var collectionTitle = firstCollectionTitle + unique_value;
  2626. var productTitle = product.firstTitle + unique_value;
  2627.  
  2628. beforeAll(function () {
  2629. commonHelper.acceptAlert();
  2630. browser.get(signInData.link);
  2631. });
  2632.  
  2633. afterAll(function () {
  2634. commonHelper.clearAllData();
  2635. });
  2636.  
  2637. it('should redirect on dashboard page after login', function () {
  2638. signInPage.login(username, password);
  2639. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2640. });
  2641.  
  2642. it('should redirect on add product page', function () {
  2643. browser.get(productData.addLink);
  2644. addProductPage.waitForPublishButton();
  2645. });
  2646.  
  2647. it('should add new product', function () {
  2648. addProductPage.selectType(product.type);
  2649. addProductPage.selectFirstCollection();
  2650. addProductPage.fillTitle(productTitle);
  2651. addProductPage.fillPrice(product.firstPrice);
  2652. addProductPage.fillShippingWeight(product.firstWeight);
  2653. addProductPage.clickPublish();
  2654. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2655. });
  2656.  
  2657. it('should open new collection page', function () {
  2658. browser.get(addCollectionLink);
  2659. });
  2660.  
  2661. it('should fill title and description fields', function () {
  2662. addCollectionPage.fillTitle(collectionTitle);
  2663. addCollectionPage.fillDescription(firstCollectionDescription);
  2664. });
  2665.  
  2666. it('should click auto add product radio button', function () {
  2667. addCollectionPage.clickAddAuto();
  2668. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2669. });
  2670.  
  2671. it('should add condition', function () {
  2672. addCollectionPage.selectConditionVariant(0, 'Weight');
  2673. addCollectionPage.selectConditionRule(0, 'is not equal to');
  2674. addCollectionPage.fillConditionValue(0, product.secondWeight);
  2675. });
  2676.  
  2677. it('should add new collection', function () {
  2678. addCollectionPage.clickPublish();
  2679. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2680. });
  2681.  
  2682. it('should show collection page after click on collection link', function () {
  2683. collectionListPage.clickCollection(collectionTitle);
  2684. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2685.  
  2686. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2687. commonHelper.switchToPreviousTab();
  2688. });
  2689. });
  2690.  
  2691. describe('auto-add product by weight is greater then', function () {
  2692.  
  2693. var unique_value = commonHelper.uniqueValue();
  2694. var collectionTitle = firstCollectionTitle + unique_value;
  2695. var productTitle = product.firstTitle + unique_value;
  2696.  
  2697. beforeAll(function () {
  2698. commonHelper.acceptAlert();
  2699. browser.get(signInData.link);
  2700. });
  2701.  
  2702. afterAll(function () {
  2703. commonHelper.clearAllData();
  2704. });
  2705.  
  2706. it('should redirect on dashboard page after login', function () {
  2707. signInPage.login(username, password);
  2708. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2709. });
  2710.  
  2711. it('should redirect on add product page', function () {
  2712. browser.get(productData.addLink);
  2713. addProductPage.waitForPublishButton();
  2714. });
  2715.  
  2716. it('should add new product', function () {
  2717. addProductPage.selectType(product.type);
  2718. addProductPage.selectFirstCollection();
  2719. addProductPage.fillTitle(productTitle);
  2720. addProductPage.fillPrice(product.firstPrice);
  2721. addProductPage.fillShippingWeight(product.firstWeight);
  2722. addProductPage.clickPublish();
  2723. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2724. });
  2725.  
  2726. it('should open new collection page', function () {
  2727. browser.get(addCollectionLink);
  2728. });
  2729.  
  2730. it('should fill title and description fields', function () {
  2731. addCollectionPage.fillTitle(collectionTitle);
  2732. addCollectionPage.fillDescription(firstCollectionDescription);
  2733. });
  2734.  
  2735. it('should click auto add product radio button', function () {
  2736. addCollectionPage.clickAddAuto();
  2737. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2738. });
  2739.  
  2740. it('should add condition', function () {
  2741. addCollectionPage.selectConditionVariant(0, 'Weight');
  2742. addCollectionPage.selectConditionRule(0, 'is greater then');
  2743. addCollectionPage.fillConditionValue(0, product.secondWeight);
  2744. });
  2745.  
  2746. it('should add new collection', function () {
  2747. addCollectionPage.clickPublish();
  2748. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2749. });
  2750.  
  2751. it('should show collection page after click on collection link', function () {
  2752. collectionListPage.clickCollection(collectionTitle);
  2753. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2754.  
  2755. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  2756. commonHelper.switchToPreviousTab();
  2757. });
  2758. });
  2759.  
  2760. describe('auto-add product by weight is less then', function () {
  2761.  
  2762. var unique_value = commonHelper.uniqueValue();
  2763. var collectionTitle = firstCollectionTitle + unique_value;
  2764. var productTitle = product.firstTitle + unique_value;
  2765.  
  2766. beforeAll(function () {
  2767. commonHelper.acceptAlert();
  2768. browser.get(signInData.link);
  2769. });
  2770.  
  2771. afterAll(function () {
  2772. commonHelper.clearAllData();
  2773. });
  2774.  
  2775. it('should redirect on dashboard page after login', function () {
  2776. signInPage.login(username, password);
  2777. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  2778. });
  2779.  
  2780. it('should redirect on add product page', function () {
  2781. browser.get(productData.addLink);
  2782. addProductPage.waitForPublishButton();
  2783. });
  2784.  
  2785. it('should add new product', function () {
  2786. addProductPage.selectType(product.type);
  2787. addProductPage.selectFirstCollection();
  2788. addProductPage.fillTitle(productTitle);
  2789. addProductPage.fillPrice(product.firstPrice);
  2790. addProductPage.fillShippingWeight(product.firstWeight);
  2791. addProductPage.clickPublish();
  2792. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  2793. });
  2794.  
  2795. it('should open new collection page', function () {
  2796. browser.get(addCollectionLink);
  2797. });
  2798.  
  2799. it('should fill title and description fields', function () {
  2800. addCollectionPage.fillTitle(collectionTitle);
  2801. addCollectionPage.fillDescription(firstCollectionDescription);
  2802. });
  2803.  
  2804. it('should click auto add product radio button', function () {
  2805. addCollectionPage.clickAddAuto();
  2806. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  2807. });
  2808.  
  2809. it('should add condition', function () {
  2810. addCollectionPage.selectConditionVariant(0, 'Weight');
  2811. addCollectionPage.selectConditionRule(0, 'is less then');
  2812. addCollectionPage.fillConditionValue(0, product.thirdWeight);
  2813. });
  2814.  
  2815. it('should add new collection', function () {
  2816. addCollectionPage.clickPublish();
  2817. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  2818. });
  2819.  
  2820. it('should show collection page after click on collection link', function () {
  2821. collectionListPage.clickCollection(collectionTitle);
  2822. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  2823. });
  2824.  
  2825. it('should see product', function check(done) {
  2826. collectionsPage.allProducts(productTitle).count().then(function(result){
  2827. if(result == 1){
  2828. done();
  2829. }else {
  2830. collectionsPage.clickPaginationButton('Next');
  2831. check(done);
  2832. }
  2833. })
  2834. });
  2835.  
  2836. it('should switch to previous tab', function () {
  2837. commonHelper.switchToPreviousTab();
  2838. });
  2839. });
  2840. });
  2841.  
  2842. ---------------------------------------------------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement