Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dashboard.po
- this.btnViewJob = $('[href="/jobs/"]');
- clickViewJob(){
- this.btnViewJob.click();
- }
- ------------------------------------------------------------
- job.spec
- 'use strict';
- const pageObject = require('./../../services').container.PageObject;
- const signInPage = pageObject.getSignInPage();
- const dashboardPage = pageObject.getDashboardPage();
- const jobCodePage = pageObject.getJobCodePage();
- const editTicketPage = pageObject.getEditTicketPage();
- const pipelineTicketPage = pageObject.getPipelineTicketPage();
- const addContactsPage = pageObject.getAddContactPage();
- const signInData = require('./../../data/sign_in');
- const ticketsData = require('./../../data/tickets/index');
- const dashboardData = require('./../../data/dashboard');
- const commonHelper = require('./../../services/helpers/common.helper');
- var strftime = require('strftime');
- describe('Jobs', () => {
- var username = signInData.testAccount.username;
- var password = signInData.testAccount.password;
- beforeAll(() => {
- browser.ignoreSynchronization = false;
- browser.driver.manage().window().setSize(1440, 900);
- });
- afterAll(() => {
- commonHelper.clearAllData();
- });
- describe('checking for add job code', () => {
- var time = commonHelper.uniqueValue();
- beforeAll(() => {
- browser.get(signInData.link);
- });
- afterAll(() => {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', () => {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.menu);
- expect(dashboardPage.pageTitle()).toEqual(dashboardData.title);
- });
- it('should open job code', () => {
- dashboardPage.openMenu('Jobs');
- dashboardPage.clickJobCode();
- });
- it('should click on add job code', () => {
- jobCodePage.clickAddCode();
- });
- it('should add job code', () => {
- jobCodePage.fillJobCode(time);
- jobCodePage.fillDescription('Job' + time);
- jobCodePage.clickSave();
- commonHelper.waitUntilElementVisible(jobCodePage.btnAddCode);
- });
- it('should search job code', () => {
- jobCodePage.fillSearch(time);
- commonHelper.waitUntilElementVisible(jobCodePage.searchCode(time));
- });
- it('should see job code details',()=>{
- jobCodePage.clickDetails();
- });
- });
- describe('checking for change job status', () => {
- var time = commonHelper.uniqueValue();
- var ticket;
- var ticketChaged;
- var password = signInData.testAccount.password;
- var afe = ticketsData.ticket.afe;
- var jobCode = ticketsData.ticket.jobCode;
- beforeAll(() => {
- browser.get(signInData.link);
- });
- afterAll(() => {
- commonHelper.clearAllData();
- });
- it('should redirect on dashboard page after login', () => {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.menu);
- expect(dashboardPage.pageTitle()).toEqual(dashboardData.title);
- });
- it('should click on plus button and select service ticket', () => {
- dashboardPage.selectItem('Service Ticket');
- expect(editTicketPage.btnSaveTicket.isDisplayed()).toBe(true);
- });
- it('should select status and get ticket number', () =>{
- pipelineTicketPage.selectStatus('Draft');
- pipelineTicketPage.fillTicketName(time);
- });
- it('should save ticket header', () => {
- editTicketPage.fillLocation('Location' + time);
- editTicketPage.fillAfe(afe);
- editTicketPage.fillJobCode(jobCode);
- editTicketPage.clickSave();
- });
- it('should click view job', () => {
- dashboardPage.openMenu('Jobs');
- dashboardPage.clickViewJob();
- });
- it('should take number of closed jobs', () => {
- jobCodePage.getJobs('Closed', '8').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to closed', () => {
- jobCodePage.changeStatus(time, 'Closed');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of closed jobs', () => {
- jobCodePage.getJobs('Closed', '8').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Disputed jobs', () => {
- jobCodePage.getJobs('Disputed', '7').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Disputed', () => {
- jobCodePage.changeStatus(time, 'Disputed');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Disputed jobs', () => {
- jobCodePage.getJobs('Disputed', '7').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Signed jobs', () => {
- jobCodePage.getJobs('Signed', '6').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Signed', () => {
- jobCodePage.changeStatus(time, 'Signed');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Signed jobs', () => {
- jobCodePage.getJobs('Signed', '6').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Needs Signature jobs', () => {
- jobCodePage.getJobs('Needs Signature', '5').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Needs Signature', () => {
- jobCodePage.changeStatus(time, 'Need Signature');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Needs Signature jobs', () => {
- jobCodePage.getJobs('Needs Signature', '5').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Open jobs', () => {
- jobCodePage.getJobs('Open', '4').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Open', () => {
- jobCodePage.changeStatus(time, 'Open');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Open jobs', () => {
- jobCodePage.getJobs('Open', '4').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Created jobs', () => {
- jobCodePage.getJobs('Created', '3').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Created', () => {
- jobCodePage.changeStatus(time, 'Created');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Created jobs', () => {
- jobCodePage.getJobs('Created', '3').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- it('should take number of Draft jobs', () => {
- jobCodePage.getJobs('Draft', '2').getText('value').then(function(value) {
- ticket = Number(value);
- });
- });
- it('should change job status to Draft', () => {
- jobCodePage.changeStatus(time, 'Draft');
- ticket += 1;
- });
- it('should reload page', () =>{
- dashboardPage.openMenu('Tickets');
- dashboardPage.clickViewJob();
- });
- it('should take number of Draft jobs', () => {
- jobCodePage.getJobs('Draft', '2').getText('value').then(function(value) {
- ticketChaged = Number(value);
- });
- });
- it('should be equal', () =>{
- expect(ticket).toEqual(ticketChaged);
- });
- });
- });
- ------------------------------------------------------------------------
- job_code.po
- getJobs(name, index){
- return element(by.xpath('//*[contains(.,"' + name +'")]/..//md-list-item['+ index +']//div[contains(@class, "md-subhead ng-binding")]'));
- }
- changeStatus(status, changedStatus){
- element(by.xpath('//*[text()="Service: #'+status+'" ]/ancestor::div[@class="layout-margin-sm layout-fill md-whiteframe-1dp"]//md-select')).click();
- element(by.xpath('//*[contains(@class, "md-active")]//div[contains(.,"' + changedStatus + '")]')).click();
- }
- -------------------------------------------------
- pipe;ine_ticket.po
- const commonHelper = require('./../helpers/common.helper.js');
- this.txtStatus = $('[aria-label="Select Status"]');
- this.txtTicketName = $('[ng-model="ticket.name"]');
- fillTicketName(value){
- this.txtTicketName.clear();
- this.txtTicketName.sendKeys(value);
- }
- selectStatus(type){
- browser.waitForAngular();
- commonHelper.waitUntilElementVisible(this.txtStatus);
- browser.sleep(1000);
- this.txtStatus.click();
- browser.sleep(2000);
- element(by.xpath('//div[contains(@class, "md-select-menu-container")]//div[contains(.,"'+ type +'")]')).click();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement