Guest User

dashboard.spec

a guest
Oct 21st, 2016
26
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.17 KB | None | 0 0
  1. 'use strict';
  2.  
  3. const pageObject = require('./../../services').container.PageObject;
  4. const signInPage = pageObject.getSignInPage();
  5. const dashboardPage = pageObject.getDashboardPage();
  6. const ticketsPage = pageObject.getTicketsPage();
  7. const editTicketPage = pageObject.getEditTicketPage();
  8. const signInData = require('./../../data/sign_in');
  9. const dashboardData = require('./../../data/dashboard');
  10. const ticketsData = require('./../../data/tickets');
  11. const commonHelper = require('./../../services/helpers/common.helper');
  12. var strftime = require('strftime');
  13.  
  14. describe('Dashboard', () => {
  15.  
  16. var username = signInData.testAccount.username;
  17. var password = signInData.testAccount.password;
  18.  
  19. beforeAll(() => {
  20. browser.ignoreSynchronization = false;
  21. browser.driver.manage().window().setSize(1440, 900);
  22. });
  23.  
  24. afterAll(() => {
  25. commonHelper.clearAllData();
  26. });
  27.  
  28. describe('checking for add company', () => {
  29.  
  30. var time = commonHelper.uniqueValue();
  31.  
  32. beforeAll(() => {
  33. browser.get(signInData.link);
  34. });
  35.  
  36. afterAll(() => {
  37. commonHelper.clearAllData();
  38. });
  39.  
  40. it('should open login page', () => {
  41. expect(signInPage.btnLogin.isDisplayed()).toBe(true);
  42. });
  43.  
  44. it('should redirect on dashboard page after login', () => {
  45. signInPage.login(username, password);
  46. commonHelper.waitUntilElementPresent(dashboardPage.menu);
  47.  
  48. expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
  49. });
  50.  
  51. it('should click on add company', () => {
  52. dashboardPage.btnAddCompany.click();
  53. expect(dashboardPage.companyTitle.getText()).toEqual('Add Company');
  54. });
  55.  
  56. it('should add company', () => {
  57. dashboardPage.txtCompanyName.sendKeys('Microsoft' + time);
  58. dashboardPage.txtCompanySite.sendKeys('www.'+ time +'.com');
  59. dashboardPage.selectCompanyType('Service');
  60. dashboardPage.txtCompanyNote.sendKeys(time);
  61. });
  62.  
  63. it('should add icon company',() => {
  64. editTicketPage.uploadAttachment('index.jpg');
  65. dashboardPage.btnSaveCompany.click();
  66. expect(dashboardPage.imageCompany.isDisplayed()).toBe(true);
  67. });
  68.  
  69. it('should redirect to dashboard',() => {
  70. dashboardPage.openMenu('Dashboard');
  71. expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
  72. });
  73.  
  74. it('should search company',() => {
  75. dashboardPage.txtSeachCompany.sendKeys('Microsoft' + time);
  76. commonHelper.waitUntilElementVisible(dashboardPage.searchCompany('Microsoft' + time));
  77. });
  78.  
  79. it('should see company details',() => {
  80. dashboardPage.btnDetails.click();
  81. expect(dashboardPage.pageTittle.getText()).toEqual('Microsoft' + time);
  82. });
  83.  
  84. });
  85.  
  86. describe('checking for add contacts', () => {
  87.  
  88. var time = commonHelper.uniqueValue();
  89.  
  90. beforeAll(() => {
  91. browser.get(signInData.link);
  92. });
  93.  
  94. afterAll(() => {
  95. commonHelper.clearAllData();
  96. });
  97.  
  98. it('should open login page', () => {
  99. expect(signInPage.btnLogin.isDisplayed()).toBe(true);
  100. });
  101.  
  102. it('should redirect on dashboard page after login', () => {
  103. signInPage.login(username, password);
  104. commonHelper.waitUntilElementPresent(dashboardPage.menu);
  105.  
  106. expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
  107. });
  108.  
  109. it('should click on add contacts', () => {
  110. dashboardPage.btnAddContacts.click();
  111. // expect(dashboardPage.companyTitle.getText()).toEqual('Add Contact');
  112. });
  113.  
  114. it('should add contacts', () => {
  115. dashboardPage.txtContactName.sendKeys('Gabe' + time);
  116. dashboardPage.txtContactLastName.sendKeys('Malcovich'+ time);
  117. dashboardPage.txtContactTitte.sendKeys('QA' + time);
  118. dashboardPage.selectContactCompany('Chevron');
  119. dashboardPage.selectContactOffices('Chevron Corporate Offices');
  120. dashboardPage.txtContactNumber.sendKeys(time);
  121. dashboardPage.txtContactEmail.sendKeys(time + '@mailinator.com');
  122. });
  123.  
  124. it('should save contacts', () => {
  125. dashboardPage.btnSaveCompany.click();
  126. });
  127.  
  128. it('should redirect to dashboard',() => {
  129. dashboardPage.openMenu('Dashboard');
  130. expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
  131. });
  132.  
  133. it('should search contacts',() => {
  134. dashboardPage.txtSeachContacts.sendKeys('Gabe' + time);
  135. commonHelper.waitUntilElementVisible(dashboardPage.searchCompany('Gabe' + time));
  136. });
  137.  
  138. it('should see contacts details',() => {
  139. dashboardPage.btnDetails.click();
  140. expect(dashboardPage.pageTittle.getText()).toEqual('Gabe' + time);
  141. });
  142. });
  143. });
Add Comment
Please, Sign In to add comment