Advertisement
Guest User

view job

a guest
Nov 24th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.41 KB | None | 0 0
  1. dashboard.po
  2. this.btnViewJob = $('[href="/jobs/"]');
  3. clickViewJob(){
  4. this.btnViewJob.click();
  5. }
  6. ------------------------------------------------------------
  7. job.spec
  8.  
  9. 'use strict';
  10.  
  11. const pageObject = require('./../../services').container.PageObject;
  12. const signInPage = pageObject.getSignInPage();
  13. const dashboardPage = pageObject.getDashboardPage();
  14. const jobCodePage = pageObject.getJobCodePage();
  15. const editTicketPage = pageObject.getEditTicketPage();
  16. const pipelineTicketPage = pageObject.getPipelineTicketPage();
  17. const addContactsPage = pageObject.getAddContactPage();
  18. const signInData = require('./../../data/sign_in');
  19. const ticketsData = require('./../../data/tickets/index');
  20. const dashboardData = require('./../../data/dashboard');
  21. const commonHelper = require('./../../services/helpers/common.helper');
  22. var strftime = require('strftime');
  23.  
  24. describe('Jobs', () => {
  25.  
  26. var username = signInData.testAccount.username;
  27. var password = signInData.testAccount.password;
  28.  
  29. beforeAll(() => {
  30. browser.ignoreSynchronization = false;
  31. browser.driver.manage().window().setSize(1440, 900);
  32. });
  33.  
  34. afterAll(() => {
  35. commonHelper.clearAllData();
  36. });
  37.  
  38. describe('checking for add job code', () => {
  39. var time = commonHelper.uniqueValue();
  40.  
  41. beforeAll(() => {
  42. browser.get(signInData.link);
  43. });
  44.  
  45. afterAll(() => {
  46. commonHelper.clearAllData();
  47. });
  48.  
  49. it('should redirect on dashboard page after login', () => {
  50. signInPage.login(username, password);
  51. commonHelper.waitUntilElementPresent(dashboardPage.menu);
  52.  
  53. expect(dashboardPage.pageTitle()).toEqual(dashboardData.title);
  54. });
  55.  
  56. it('should open job code', () => {
  57. dashboardPage.openMenu('Jobs');
  58. dashboardPage.clickJobCode();
  59. });
  60.  
  61. it('should click on add job code', () => {
  62. jobCodePage.clickAddCode();
  63. });
  64.  
  65. it('should add job code', () => {
  66. jobCodePage.fillJobCode(time);
  67. jobCodePage.fillDescription('Job' + time);
  68. jobCodePage.clickSave();
  69. commonHelper.waitUntilElementVisible(jobCodePage.btnAddCode);
  70. });
  71.  
  72. it('should search job code', () => {
  73. jobCodePage.fillSearch(time);
  74. commonHelper.waitUntilElementVisible(jobCodePage.searchCode(time));
  75. });
  76.  
  77. it('should see job code details',()=>{
  78. jobCodePage.clickDetails();
  79. });
  80. });
  81.  
  82. describe('checking for change job status', () => {
  83.  
  84. var time = commonHelper.uniqueValue();
  85. var ticket;
  86. var ticketChaged;
  87. var password = signInData.testAccount.password;
  88. var afe = ticketsData.ticket.afe;
  89. var jobCode = ticketsData.ticket.jobCode;
  90.  
  91. beforeAll(() => {
  92. browser.get(signInData.link);
  93. });
  94.  
  95. afterAll(() => {
  96. commonHelper.clearAllData();
  97. });
  98.  
  99. it('should redirect on dashboard page after login', () => {
  100. signInPage.login(username, password);
  101. commonHelper.waitUntilElementPresent(dashboardPage.menu);
  102.  
  103. expect(dashboardPage.pageTitle()).toEqual(dashboardData.title);
  104. });
  105.  
  106. it('should click on plus button and select service ticket', () => {
  107. dashboardPage.selectItem('Service Ticket');
  108.  
  109. expect(editTicketPage.btnSaveTicket.isDisplayed()).toBe(true);
  110. });
  111.  
  112. it('should select status and get ticket number', () =>{
  113. pipelineTicketPage.selectStatus('Draft');
  114. pipelineTicketPage.fillTicketName(time);
  115. });
  116.  
  117. it('should save ticket header', () => {
  118. editTicketPage.fillLocation('Location' + time);
  119. editTicketPage.fillAfe(afe);
  120. editTicketPage.fillJobCode(jobCode);
  121. editTicketPage.clickSave();
  122. });
  123.  
  124. it('should click view job', () => {
  125. dashboardPage.openMenu('Jobs');
  126. dashboardPage.clickViewJob();
  127. });
  128.  
  129. it('should take number of closed jobs', () => {
  130. jobCodePage.getJobs('Closed', '8').getText('value').then(function(value) {
  131. ticket = Number(value);
  132. });
  133. });
  134.  
  135. it('should change job status to closed', () => {
  136. jobCodePage.changeStatus(time, 'Closed');
  137. ticket += 1;
  138. });
  139.  
  140. it('should reload page', () =>{
  141. dashboardPage.openMenu('Tickets');
  142. dashboardPage.clickViewJob();
  143. });
  144.  
  145. it('should take number of closed jobs', () => {
  146. jobCodePage.getJobs('Closed', '8').getText('value').then(function(value) {
  147. ticketChaged = Number(value);
  148. });
  149. });
  150. it('should be equal', () =>{
  151. expect(ticket).toEqual(ticketChaged);
  152. });
  153.  
  154. it('should take number of Disputed jobs', () => {
  155. jobCodePage.getJobs('Disputed', '7').getText('value').then(function(value) {
  156. ticket = Number(value);
  157. });
  158. });
  159.  
  160. it('should change job status to Disputed', () => {
  161. jobCodePage.changeStatus(time, 'Disputed');
  162. ticket += 1;
  163. });
  164.  
  165. it('should reload page', () =>{
  166. dashboardPage.openMenu('Tickets');
  167. dashboardPage.clickViewJob();
  168. });
  169.  
  170. it('should take number of Disputed jobs', () => {
  171. jobCodePage.getJobs('Disputed', '7').getText('value').then(function(value) {
  172. ticketChaged = Number(value);
  173. });
  174. });
  175.  
  176. it('should be equal', () =>{
  177. expect(ticket).toEqual(ticketChaged);
  178. });
  179.  
  180. it('should take number of Signed jobs', () => {
  181. jobCodePage.getJobs('Signed', '6').getText('value').then(function(value) {
  182. ticket = Number(value);
  183. });
  184. });
  185.  
  186. it('should change job status to Signed', () => {
  187. jobCodePage.changeStatus(time, 'Signed');
  188. ticket += 1;
  189. });
  190.  
  191. it('should reload page', () =>{
  192. dashboardPage.openMenu('Tickets');
  193. dashboardPage.clickViewJob();
  194. });
  195.  
  196. it('should take number of Signed jobs', () => {
  197. jobCodePage.getJobs('Signed', '6').getText('value').then(function(value) {
  198. ticketChaged = Number(value);
  199. });
  200. });
  201.  
  202. it('should be equal', () =>{
  203. expect(ticket).toEqual(ticketChaged);
  204. });
  205.  
  206. it('should take number of Needs Signature jobs', () => {
  207. jobCodePage.getJobs('Needs Signature', '5').getText('value').then(function(value) {
  208. ticket = Number(value);
  209. });
  210. });
  211.  
  212. it('should change job status to Needs Signature', () => {
  213. jobCodePage.changeStatus(time, 'Need Signature');
  214. ticket += 1;
  215. });
  216.  
  217. it('should reload page', () =>{
  218. dashboardPage.openMenu('Tickets');
  219. dashboardPage.clickViewJob();
  220. });
  221.  
  222. it('should take number of Needs Signature jobs', () => {
  223. jobCodePage.getJobs('Needs Signature', '5').getText('value').then(function(value) {
  224. ticketChaged = Number(value);
  225. });
  226. });
  227.  
  228. it('should be equal', () =>{
  229. expect(ticket).toEqual(ticketChaged);
  230. });
  231.  
  232. it('should take number of Open jobs', () => {
  233. jobCodePage.getJobs('Open', '4').getText('value').then(function(value) {
  234. ticket = Number(value);
  235. });
  236. });
  237.  
  238. it('should change job status to Open', () => {
  239. jobCodePage.changeStatus(time, 'Open');
  240. ticket += 1;
  241. });
  242.  
  243. it('should reload page', () =>{
  244. dashboardPage.openMenu('Tickets');
  245. dashboardPage.clickViewJob();
  246. });
  247.  
  248. it('should take number of Open jobs', () => {
  249. jobCodePage.getJobs('Open', '4').getText('value').then(function(value) {
  250. ticketChaged = Number(value);
  251. });
  252. });
  253.  
  254. it('should be equal', () =>{
  255. expect(ticket).toEqual(ticketChaged);
  256. });
  257.  
  258. it('should take number of Created jobs', () => {
  259. jobCodePage.getJobs('Created', '3').getText('value').then(function(value) {
  260. ticket = Number(value);
  261. });
  262. });
  263.  
  264. it('should change job status to Created', () => {
  265. jobCodePage.changeStatus(time, 'Created');
  266. ticket += 1;
  267. });
  268.  
  269. it('should reload page', () =>{
  270. dashboardPage.openMenu('Tickets');
  271. dashboardPage.clickViewJob();
  272. });
  273.  
  274. it('should take number of Created jobs', () => {
  275. jobCodePage.getJobs('Created', '3').getText('value').then(function(value) {
  276. ticketChaged = Number(value);
  277. });
  278. });
  279.  
  280. it('should be equal', () =>{
  281. expect(ticket).toEqual(ticketChaged);
  282. });
  283.  
  284. it('should take number of Draft jobs', () => {
  285. jobCodePage.getJobs('Draft', '2').getText('value').then(function(value) {
  286. ticket = Number(value);
  287. });
  288. });
  289.  
  290. it('should change job status to Draft', () => {
  291. jobCodePage.changeStatus(time, 'Draft');
  292. ticket += 1;
  293. });
  294.  
  295. it('should reload page', () =>{
  296. dashboardPage.openMenu('Tickets');
  297. dashboardPage.clickViewJob();
  298. });
  299.  
  300. it('should take number of Draft jobs', () => {
  301. jobCodePage.getJobs('Draft', '2').getText('value').then(function(value) {
  302. ticketChaged = Number(value);
  303. });
  304. });
  305.  
  306. it('should be equal', () =>{
  307. expect(ticket).toEqual(ticketChaged);
  308. });
  309. });
  310. });
  311. ------------------------------------------------------------------------
  312. job_code.po
  313.  
  314. getJobs(name, index){
  315. return element(by.xpath('//*[contains(.,"' + name +'")]/..//md-list-item['+ index +']//div[contains(@class, "md-subhead ng-binding")]'));
  316. }
  317.  
  318. changeStatus(status, changedStatus){
  319. element(by.xpath('//*[text()="Service: #'+status+'" ]/ancestor::div[@class="layout-margin-sm layout-fill md-whiteframe-1dp"]//md-select')).click();
  320. element(by.xpath('//*[contains(@class, "md-active")]//div[contains(.,"' + changedStatus + '")]')).click();
  321. }
  322. -------------------------------------------------
  323. pipe;ine_ticket.po
  324.  
  325. const commonHelper = require('./../helpers/common.helper.js');
  326. this.txtStatus = $('[aria-label="Select Status"]');
  327. this.txtTicketName = $('[ng-model="ticket.name"]');
  328.  
  329. fillTicketName(value){
  330. this.txtTicketName.clear();
  331. this.txtTicketName.sendKeys(value);
  332. }
  333.  
  334. selectStatus(type){
  335. browser.waitForAngular();
  336. commonHelper.waitUntilElementVisible(this.txtStatus);
  337. browser.sleep(1000);
  338. this.txtStatus.click();
  339. browser.sleep(2000);
  340. element(by.xpath('//div[contains(@class, "md-select-menu-container")]//div[contains(.,"'+ type +'")]')).click();
  341. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement