Advertisement
Guest User

by_vendor.spec.js

a guest
Feb 7th, 2017
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 16.46 KB | None | 0 0
  1. by_vendor.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.  
  16. describe('Add Collection - Auto Adding - By Vendor', function () {
  17.  
  18. var username = signInData.adminAccount.username;
  19. var password = signInData.adminAccount.password;
  20. var firstCollectionTitle = commonHelper.uniqueProductName('vendor1');
  21. var firstCollectionDescription = collectionData.collection.description.first;
  22.  
  23. var product = {
  24. firstTitle: commonHelper.uniqueProductName('vendor2'),
  25. type: productData.product.type,
  26. vendor: productData.product.vendor,
  27. price: productData.product.price
  28. };
  29.  
  30. describe('auto-add product by product vendor does not contain', function () {
  31.  
  32. var unique_value = commonHelper.uniqueValue();
  33. var collectionTitle = firstCollectionTitle + unique_value;
  34. var productTitle = product.firstTitle + unique_value;
  35. var productVendor = 'glass' + unique_value;
  36.  
  37. beforeAll(function () {
  38. commonHelper.acceptAlert();
  39. browser.get(signInData.link);
  40. });
  41.  
  42. afterAll(function () {
  43. commonHelper.clearAllData();
  44. });
  45.  
  46. it('should redirect on dashboard page after login', function () {
  47. signInPage.login(username, password);
  48. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  49. });
  50.  
  51. it('should open products list page', function () {
  52. dashboardPage.openProductListPage();
  53. });
  54.  
  55. it('should open new product page', function () {
  56. productListPage.clickAddProduct();
  57. addProductPage.waitForPublishButton();
  58. });
  59.  
  60. it('should add new product', function () {
  61. addProductPage.selectType(product.type);
  62. addProductPage.selectFirstCollection();
  63. addProductPage.fillTitle(productTitle);
  64. addProductPage.fillPrice(product.price);
  65. addProductPage.selectVendor(productVendor);
  66. addProductPage.clickPublish();
  67. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  68. });
  69.  
  70. it('should open new collection page', function () {
  71. dashboardPage.openAddCollectionPage();
  72. });
  73.  
  74. it('should fill title and description fields', function () {
  75. addCollectionPage.fillTitle(collectionTitle);
  76. addCollectionPage.fillDescription(firstCollectionDescription);
  77. });
  78.  
  79. it('should click auto add product radio button', function () {
  80. addCollectionPage.clickAddAuto();
  81. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  82. });
  83.  
  84. it('should add condition', function () {
  85. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  86. addCollectionPage.selectConditionRule(0, 'does not contain');
  87. addCollectionPage.fillConditionValue(0, product.vendor);
  88. });
  89.  
  90. it('should add new collection', function () {
  91. addCollectionPage.clickPublish();
  92. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  93. });
  94.  
  95. it('should show collection page after click on collection link', function () {
  96. collectionListPage.clickCollection(collectionTitle);
  97. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  98. });
  99.  
  100. it('should see product', function check(done) {
  101. collectionsPage.allProducts(productTitle).count().then(function(result){
  102. if(result == 1){
  103. done();
  104. }else {
  105. collectionsPage.clickPaginationButton('Next');
  106. check(done);
  107. }
  108. })
  109. });
  110.  
  111. it('should switch to previous tab', function () {
  112. commonHelper.switchToPreviousTab();
  113. });
  114. });
  115.  
  116. describe('auto-add product by product vendor is exactly', function () {
  117.  
  118. var unique_value = commonHelper.uniqueValue();
  119. var collectionTitle = firstCollectionTitle + unique_value;
  120. var productTitle = product.firstTitle + unique_value;
  121. var productVendor = product.vendor + unique_value;
  122.  
  123. beforeAll(function () {
  124. commonHelper.acceptAlert();
  125. browser.get(signInData.link);
  126. });
  127.  
  128. afterAll(function () {
  129. commonHelper.clearAllData();
  130. });
  131.  
  132. it('should redirect on dashboard page after login', function () {
  133. signInPage.login(username, password);
  134. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  135. });
  136.  
  137. it('should open products list page', function () {
  138. dashboardPage.openProductListPage();
  139. });
  140.  
  141. it('should open new product page', function () {
  142. productListPage.clickAddProduct();
  143. addProductPage.waitForPublishButton();
  144. });
  145.  
  146. it('should add new product', function () {
  147. addProductPage.selectType(product.type);
  148. addProductPage.selectFirstCollection();
  149. addProductPage.selectVendor(productVendor);
  150. addProductPage.fillTitle(productTitle);
  151. addProductPage.fillPrice(product.price);
  152. addProductPage.clickPublish();
  153. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  154. });
  155.  
  156. it('should open new collection page', function () {
  157. dashboardPage.openAddCollectionPage();
  158. });
  159.  
  160. it('should fill title and description fields', function () {
  161. addCollectionPage.fillTitle(collectionTitle);
  162. addCollectionPage.fillDescription(firstCollectionDescription);
  163. });
  164.  
  165. it('should click auto add product radio button', function () {
  166. addCollectionPage.clickAddAuto();
  167. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  168. });
  169.  
  170. it('should add condition', function () {
  171. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  172. addCollectionPage.selectConditionRule(0, 'is exactly');
  173. addCollectionPage.fillConditionValue(0, productVendor);
  174. });
  175.  
  176. it('should add new collection', function () {
  177. addCollectionPage.clickPublish();
  178. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  179. });
  180.  
  181. it('should show collection page after click on collection link', function () {
  182. collectionListPage.clickCollection(collectionTitle);
  183. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  184.  
  185. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  186. commonHelper.switchToPreviousTab();
  187. });
  188. });
  189.  
  190. describe('auto-add product by product vendor starts with', function () {
  191.  
  192. var unique_value = commonHelper.uniqueValue();
  193. var collectionTitle = firstCollectionTitle + unique_value;
  194. var productTitle = product.firstTitle + unique_value;
  195. var productVendor = firstCollectionTitle + product.vendor;
  196.  
  197. beforeAll(function () {
  198. commonHelper.acceptAlert();
  199. browser.get(signInData.link);
  200. });
  201.  
  202. afterAll(function () {
  203. commonHelper.clearAllData();
  204. });
  205.  
  206. it('should redirect on dashboard page after login', function () {
  207. signInPage.login(username, password);
  208. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  209. });
  210.  
  211. it('should open products list page', function () {
  212. dashboardPage.openProductListPage();
  213. });
  214.  
  215. it('should open new product page', function () {
  216. productListPage.clickAddProduct();
  217. addProductPage.waitForPublishButton();
  218. });
  219.  
  220. it('should add new product', function () {
  221. addProductPage.selectType(product.type);
  222. addProductPage.selectFirstCollection();
  223. addProductPage.selectVendor(productVendor);
  224. addProductPage.fillTitle(productTitle);
  225. addProductPage.fillPrice(product.price);
  226. addProductPage.clickPublish();
  227. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  228. });
  229.  
  230. it('should open new collection page', function () {
  231. dashboardPage.openAddCollectionPage();
  232. });
  233.  
  234. it('should fill title and description fields', function () {
  235. addCollectionPage.fillTitle(collectionTitle);
  236. addCollectionPage.fillDescription(firstCollectionDescription);
  237. });
  238.  
  239. it('should click auto add product radio button', function () {
  240. addCollectionPage.clickAddAuto();
  241. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  242. });
  243.  
  244. it('should add condition', function () {
  245. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  246. addCollectionPage.selectConditionRule(0, 'starts with');
  247. addCollectionPage.fillConditionValue(0, firstCollectionTitle);
  248. });
  249.  
  250. it('should add new collection', function () {
  251. addCollectionPage.clickPublish();
  252. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  253. });
  254.  
  255. it('should show collection page after click on collection link', function () {
  256. collectionListPage.clickCollection(collectionTitle);
  257. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  258.  
  259. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  260. commonHelper.switchToPreviousTab();
  261. });
  262. });
  263.  
  264. describe('auto-add product by product vendor ends with', function () {
  265.  
  266. var unique_value = commonHelper.uniqueValue();
  267. var collectionTitle = firstCollectionTitle + unique_value;
  268. var productTitle = product.firstTitle + unique_value;
  269. var productVendor = product.tag + unique_value;
  270.  
  271. beforeAll(function () {
  272. commonHelper.acceptAlert();
  273. browser.get(signInData.link);
  274. });
  275.  
  276. afterAll(function () {
  277. commonHelper.clearAllData();
  278. });
  279.  
  280. it('should redirect on dashboard page after login', function () {
  281. signInPage.login(username, password);
  282. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  283. });
  284.  
  285. it('should open products list page', function () {
  286. dashboardPage.openProductListPage();
  287. });
  288.  
  289. it('should open new product page', function () {
  290. productListPage.clickAddProduct();
  291. addProductPage.waitForPublishButton();
  292. });
  293.  
  294. it('should add new product', function () {
  295. addProductPage.selectType(product.type);
  296. addProductPage.selectFirstCollection();
  297. addProductPage.fillTitle(productTitle);
  298. addProductPage.fillPrice(product.price);
  299. addProductPage.selectVendor(productVendor);
  300. addProductPage.clickPublish();
  301. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  302. });
  303.  
  304. it('should open new collection page', function () {
  305. dashboardPage.openAddCollectionPage();
  306. });
  307.  
  308. it('should fill title and description fields', function () {
  309. addCollectionPage.fillTitle(collectionTitle);
  310. addCollectionPage.fillDescription(firstCollectionDescription);
  311. });
  312.  
  313. it('should click auto add product radio button', function () {
  314. addCollectionPage.clickAddAuto();
  315. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  316. });
  317.  
  318. it('should add condition', function () {
  319. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  320. addCollectionPage.selectConditionRule(0, 'ends with');
  321. addCollectionPage.fillConditionValue(0, unique_value);
  322. });
  323.  
  324. it('should add new collection', function () {
  325. addCollectionPage.clickPublish();
  326. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  327. });
  328.  
  329. it('should show collection page after click on collection link', function () {
  330. collectionListPage.clickCollection(collectionTitle);
  331. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  332.  
  333. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  334. commonHelper.switchToPreviousTab();
  335. });
  336. });
  337.  
  338. describe('auto-add product by product vendor contains', function () {
  339.  
  340. var unique_value = commonHelper.uniqueValue();
  341. var collectionTitle = firstCollectionTitle + unique_value;
  342. var productTitle = product.firstTitle + unique_value;
  343. var productVendor = product.type + unique_value + 'contains';
  344.  
  345. beforeAll(function () {
  346. commonHelper.acceptAlert();
  347. browser.get(signInData.link);
  348. });
  349.  
  350. afterAll(function () {
  351. commonHelper.clearAllData();
  352. });
  353.  
  354. it('should redirect on dashboard page after login', function () {
  355. signInPage.login(username, password);
  356. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  357. });
  358.  
  359. it('should open products list page', function () {
  360. dashboardPage.openProductListPage();
  361. });
  362.  
  363. it('should open new product page', function () {
  364. productListPage.clickAddProduct();
  365. addProductPage.waitForPublishButton();
  366. });
  367.  
  368. it('should add new product', function () {
  369. addProductPage.selectType(product.type);
  370. addProductPage.selectFirstCollection();
  371. addProductPage.fillTitle(productTitle);
  372. addProductPage.fillPrice(product.price);
  373. addProductPage.selectVendor(productVendor);
  374. addProductPage.clickPublish();
  375. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  376. });
  377.  
  378. it('should open new collection page', function () {
  379. dashboardPage.openAddCollectionPage();
  380. });
  381.  
  382. it('should fill title and description fields', function () {
  383. addCollectionPage.fillTitle(collectionTitle);
  384. addCollectionPage.fillDescription(firstCollectionDescription);
  385. });
  386.  
  387. it('should click auto add product radio button', function () {
  388. addCollectionPage.clickAddAuto();
  389. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  390. });
  391.  
  392. it('should add condition', function () {
  393. addCollectionPage.selectConditionVariant(0, 'Product vendor');
  394. addCollectionPage.selectConditionRule(0, 'contains');
  395. addCollectionPage.fillConditionValue(0, unique_value);
  396. });
  397.  
  398. it('should add new collection', function () {
  399. addCollectionPage.clickPublish();
  400. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  401. });
  402.  
  403. it('should show collection page after click on collection link', function () {
  404. collectionListPage.clickCollection(collectionTitle);
  405. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  406.  
  407. expect(collectionsPage.productTitle(productTitle).isDisplayed()).toBeTruthy();
  408. commonHelper.switchToPreviousTab();
  409. });
  410. });
  411. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement