Advertisement
Guest User

by_tag.spec.js

a guest
Feb 7th, 2017
122
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.77 KB | None | 0 0
  1. by_tag.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 Tag', function () {
  17.  
  18. var username = signInData.adminAccount.username;
  19. var password = signInData.adminAccount.password;
  20. var firstCollectionTitle = commonHelper.uniqueProductName('tag1');
  21. var firstCollectionDescription = collectionData.collection.description.first;
  22.  
  23. var product = {
  24. firstTitle: commonHelper.uniqueProductName('tag2'),
  25. type: productData.product.type,
  26. tag: productData.product.tag,
  27. price: productData.product.price
  28. };
  29.  
  30. describe('auto-add product by product tag 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 productTag = 'mouse' + 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(productTag);
  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 tag');
  86. addCollectionPage.selectConditionRule(0, 'does not contain');
  87. addCollectionPage.fillConditionValue(0, product.tag);
  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 tag 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 productTag = product.tag + 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.addTag(productTag);
  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 tag');
  172. addCollectionPage.selectConditionRule(0, 'is exactly');
  173. addCollectionPage.fillConditionValue(0, productTag);
  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.  
  186. it('should see product', function check(done) {
  187. collectionsPage.allProducts(productTitle).count().then(function(result){
  188. if(result == 1){
  189. done();
  190. }else {
  191. collectionsPage.clickPaginationButton('Next');
  192. check(done);
  193. }
  194. })
  195. });
  196.  
  197. it('should switch to previous tab', function () {
  198. commonHelper.switchToPreviousTab();
  199. });
  200. });
  201.  
  202. describe('auto-add product by product tag starts with', function () {
  203.  
  204. var unique_value = commonHelper.uniqueValue();
  205. var collectionTitle = firstCollectionTitle + unique_value;
  206. var productTitle = product.firstTitle + unique_value;
  207. var productTag = firstCollectionTitle + product.tag;
  208.  
  209. beforeAll(function () {
  210. commonHelper.acceptAlert();
  211. browser.get(signInData.link);
  212. });
  213.  
  214. afterAll(function () {
  215. commonHelper.clearAllData();
  216. });
  217.  
  218. it('should redirect on dashboard page after login', function () {
  219. signInPage.login(username, password);
  220. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  221. });
  222.  
  223. it('should open products list page', function () {
  224. dashboardPage.openProductListPage();
  225. });
  226.  
  227. it('should open new product page', function () {
  228. productListPage.clickAddProduct();
  229. addProductPage.waitForPublishButton();
  230. });
  231.  
  232. it('should add new product', function () {
  233. addProductPage.selectType(product.type);
  234. addProductPage.selectFirstCollection();
  235. addProductPage.addTag(productTag);
  236. addProductPage.fillTitle(productTitle);
  237. addProductPage.fillPrice(product.price);
  238. addProductPage.clickPublish();
  239. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  240. });
  241.  
  242. it('should open new collection page', function () {
  243. dashboardPage.openAddCollectionPage();
  244. });
  245.  
  246. it('should fill title and description fields', function () {
  247. addCollectionPage.fillTitle(collectionTitle);
  248. addCollectionPage.fillDescription(firstCollectionDescription);
  249. });
  250.  
  251. it('should click auto add product radio button', function () {
  252. addCollectionPage.clickAddAuto();
  253. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  254. });
  255.  
  256. it('should add condition', function () {
  257. addCollectionPage.selectConditionVariant(0, 'Product tag');
  258. addCollectionPage.selectConditionRule(0, 'starts with');
  259. addCollectionPage.fillConditionValue(0, firstCollectionTitle);
  260. });
  261.  
  262. it('should add new collection', function () {
  263. addCollectionPage.clickPublish();
  264. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  265. });
  266.  
  267. it('should show collection page after click on collection link', function () {
  268. collectionListPage.clickCollection(collectionTitle);
  269. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  270. });
  271.  
  272. it('should see product', function check(done) {
  273. collectionsPage.allProducts(productTitle).count().then(function(result){
  274. if(result == 1){
  275. done();
  276. }else {
  277. collectionsPage.clickPaginationButton('Next');
  278. check(done);
  279. }
  280. })
  281. });
  282.  
  283. it('should switch to previous tab', function () {
  284. commonHelper.switchToPreviousTab();
  285. });
  286. });
  287.  
  288. describe('auto-add product by product tag ends with', function () {
  289.  
  290. var unique_value = commonHelper.uniqueValue();
  291. var collectionTitle = firstCollectionTitle + unique_value;
  292. var productTitle = product.firstTitle + unique_value;
  293. var productTag = product.tag + unique_value;
  294.  
  295. beforeAll(function () {
  296. commonHelper.acceptAlert();
  297. browser.get(signInData.link);
  298. });
  299.  
  300. afterAll(function () {
  301. commonHelper.clearAllData();
  302. });
  303.  
  304. it('should redirect on dashboard page after login', function () {
  305. signInPage.login(username, password);
  306. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  307. });
  308.  
  309. it('should open products list page', function () {
  310. dashboardPage.openProductListPage();
  311. });
  312.  
  313. it('should open new product page', function () {
  314. productListPage.clickAddProduct();
  315. addProductPage.waitForPublishButton();
  316. });
  317.  
  318. it('should add new product', function () {
  319. addProductPage.selectType(product.type);
  320. addProductPage.selectFirstCollection();
  321. addProductPage.fillTitle(productTitle);
  322. addProductPage.fillPrice(product.price);
  323. addProductPage.addTag(productTag);
  324. addProductPage.clickPublish();
  325. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  326. });
  327.  
  328. it('should open new collection page', function () {
  329. dashboardPage.openAddCollectionPage();
  330. });
  331.  
  332. it('should fill title and description fields', function () {
  333. addCollectionPage.fillTitle(collectionTitle);
  334. addCollectionPage.fillDescription(firstCollectionDescription);
  335. });
  336.  
  337. it('should click auto add product radio button', function () {
  338. addCollectionPage.clickAddAuto();
  339. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  340. });
  341.  
  342. it('should add condition', function () {
  343. addCollectionPage.selectConditionVariant(0, 'Product tag');
  344. addCollectionPage.selectConditionRule(0, 'ends with');
  345. addCollectionPage.fillConditionValue(0, unique_value);
  346. });
  347.  
  348. it('should add new collection', function () {
  349. addCollectionPage.clickPublish();
  350. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  351. });
  352.  
  353. it('should show collection page after click on collection link', function () {
  354. collectionListPage.clickCollection(collectionTitle);
  355. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  356. });
  357.  
  358. it('should see product', function check(done) {
  359. collectionsPage.allProducts(productTitle).count().then(function(result){
  360. if(result == 1){
  361. done();
  362. }else {
  363. collectionsPage.clickPaginationButton('Next');
  364. check(done);
  365. }
  366. })
  367. });
  368.  
  369. it('should switch to previous tab', function () {
  370. commonHelper.switchToPreviousTab();
  371. });
  372. });
  373.  
  374. describe('auto-add product by product tag contains', function () {
  375.  
  376. var unique_value = commonHelper.uniqueValue();
  377. var collectionTitle = firstCollectionTitle + unique_value;
  378. var productTitle = product.firstTitle + unique_value;
  379. var productTag = product.type + unique_value + 'contains';
  380.  
  381. beforeAll(function () {
  382. commonHelper.acceptAlert();
  383. browser.get(signInData.link);
  384. });
  385.  
  386. afterAll(function () {
  387. commonHelper.clearAllData();
  388. });
  389.  
  390. it('should redirect on dashboard page after login', function () {
  391. signInPage.login(username, password);
  392. commonHelper.waitUntilElementPresent(dashboardPage.txtSearch);
  393. });
  394.  
  395. it('should open products list page', function () {
  396. dashboardPage.openProductListPage();
  397. });
  398.  
  399. it('should open new product page', function () {
  400. productListPage.clickAddProduct();
  401. addProductPage.waitForPublishButton();
  402. });
  403.  
  404. it('should add new product', function () {
  405. addProductPage.selectType(product.type);
  406. addProductPage.selectFirstCollection();
  407. addProductPage.fillTitle(productTitle);
  408. addProductPage.fillPrice(product.price);
  409. addProductPage.addTag(productTag);
  410. addProductPage.clickPublish();
  411. commonHelper.waitUntilElementVisible(productListPage.productEntry(productTitle));
  412. });
  413.  
  414. it('should open new collection page', function () {
  415. dashboardPage.openAddCollectionPage();
  416. });
  417.  
  418. it('should fill title and description fields', function () {
  419. addCollectionPage.fillTitle(collectionTitle);
  420. addCollectionPage.fillDescription(firstCollectionDescription);
  421. });
  422.  
  423. it('should click auto add product radio button', function () {
  424. addCollectionPage.clickAddAuto();
  425. commonHelper.waitUntilElementVisible(addCollectionPage.sel2Type);
  426. });
  427.  
  428. it('should add condition', function () {
  429. addCollectionPage.selectConditionVariant(0, 'Product tag');
  430. addCollectionPage.selectConditionRule(0, 'contains');
  431. addCollectionPage.fillConditionValue(0, unique_value);
  432. });
  433.  
  434. it('should add new collection', function () {
  435. addCollectionPage.clickPublish();
  436. commonHelper.waitUntilElementVisible(collectionListPage.collectionEntry(collectionTitle));
  437. });
  438.  
  439. it('should show collection page after click on collection link', function () {
  440. collectionListPage.clickCollection(collectionTitle);
  441. commonHelper.waitUntilElementVisible(collectionsPage.txtTitle);
  442. });
  443.  
  444. it('should see product', function check(done) {
  445. collectionsPage.allProducts(productTitle).count().then(function(result){
  446. if(result == 1){
  447. done();
  448. }else {
  449. collectionsPage.clickPaginationButton('Next');
  450. check(done);
  451. }
  452. })
  453. });
  454.  
  455. it('should switch to previous tab', function () {
  456. commonHelper.switchToPreviousTab();
  457. });
  458. });
  459. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement