Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- dashboardPage
- this.btnAddCompany = $('[href="/companies/add/"]');
- this.companyTitle = $('h3');
- this.txtCompanyName = $('[ng-model="company.name"]');
- this.txtCompanySite = $('[ng-model="company.website"]');
- this.txtCompanyNote = $('[ng-model="company.notes"]');
- this.txtCompanyType = $('[ng-model="company.kind"]');
- this.btnSaveCompany = element(by.xpath('//span[text()="Save"]'));
- this.btnAddContacts = $('[href="/contacts/add/"]');
- this.txtSeachCompany = $('[ng-change="getCompanies()"]');
- this.imageCompany = $('[src="company.icon_path"]');
- this.btnDetails = $('[aria-label="Details"]');
- this.btnDetailsContact = element(by.xpath('//*[contains(@class,"md-whiteframe layout-padding")]//*[contains(@class, "material-icons")]'));
- this.txtContactName = $('[ng-model="contact.first_name"]');
- this.txtContactLastName = $('[ng-model="contact.last_name"]');
- this.txtContactTitte = $('[ng-model="contact.title"]');
- this.txtContactNumber = $('[ng-model="contact.phone_number"]');
- this.txtContactEmail = $('[ng-model="contact.email"]');
- this.txtContactsCompany = $('[ng-model="contact.company"]');
- this.txtContactsOffices = $('[ng-model="contact.offices"]');
- this.txtSeachContacts = $('[ng-change="getCallers()"]');
- }
- getTable(attribute) {
- return element(by.xpath('//span[text()=.,"'+ attribute +'"]'))
- }
- saveCompany(){
- browser.executeScript('document.querySelector(".md-select-backdrop").remove()');
- browser.executeScript('document.getElementsByClassName("md-scroll-mask")[0].style.display = "none"');
- this.btnSaveCompany.click();
- }
- selectContactOffices(name){
- browser.waitForAngular();
- commonHelper.waitUntilElementVisible(this.txtContactsOffices);
- browser.sleep(1000);
- this.txtContactsOffices.click();
- browser.sleep(2000);
- element(by.xpath('//div[contains(@class, "md-select-menu-container")]//div[contains(.,"'+ name +'")]')).click();
- browser.executeScript('document.getElementsByClassName("md-select-menu-container md-oc-theme md-active md-clickable")[0].style.display = "none"')
- }
- selectContactCompany(name){
- browser.waitForAngular();
- commonHelper.waitUntilElementVisible(this.txtContactsCompany);
- browser.sleep(1000);
- this.txtContactsCompany.click();
- browser.sleep(2000);
- element(by.xpath('//div[contains(@class, "md-select-menu-container md-oc-theme md-active md-clickable")]//div[contains(.,"'+ name +'")]')).click();
- }
- searchCompany(name){
- return element(by.xpath('//*[contains(@class, "md-cell ng-binding")][contains(.,"'+ name +'")]'));
- }
- selectCompanyType(type){
- browser.waitForAngular();
- commonHelper.waitUntilElementVisible(this.txtCompanyType);
- browser.sleep(1000);
- this.txtCompanyType.click();
- browser.sleep(2000);
- element(by.xpath('//div[contains(@class, "md-select-menu-container")]//div[contains(.,"'+ type +'")]')).click();
- }
- ---------------------------------
- dashboard.spec
- 'use strict';
- const pageObject = require('./../../services').container.PageObject;
- const signInPage = pageObject.getSignInPage();
- const dashboardPage = pageObject.getDashboardPage();
- const ticketsPage = pageObject.getTicketsPage();
- const editTicketPage = pageObject.getEditTicketPage();
- const signInData = require('./../../data/sign_in');
- const dashboardData = require('./../../data/dashboard');
- const ticketsData = require('./../../data/tickets');
- const commonHelper = require('./../../services/helpers/common.helper');
- var strftime = require('strftime');
- describe('Dashboard', () => {
- 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 company', () => {
- var time = commonHelper.uniqueValue();
- beforeAll(() => {
- browser.get(signInData.link);
- });
- afterAll(() => {
- commonHelper.clearAllData();
- });
- it('should open login page', () => {
- expect(signInPage.btnLogin.isDisplayed()).toBe(true);
- });
- it('should redirect on dashboard page after login', () => {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.menu);
- expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
- });
- it('should click on add company', () => {
- dashboardPage.btnAddCompany.click();
- expect(dashboardPage.companyTitle.getText()).toEqual('Add Company');
- });
- it('should add company', () => {
- dashboardPage.txtCompanyName.sendKeys('Microsoft' + time);
- dashboardPage.txtCompanySite.sendKeys('www.'+ time +'.com');
- dashboardPage.selectCompanyType('Service');
- dashboardPage.txtCompanyNote.sendKeys(time);
- });
- it('should add icon company',() => {
- editTicketPage.uploadAttachment('index.jpg');
- dashboardPage.btnSaveCompany.click();
- expect(dashboardPage.imageCompany.isDisplayed()).toBe(true);
- });
- it('should redirect to dashboard',() => {
- dashboardPage.openMenu('Dashboard');
- expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
- });
- it('should search company',() => {
- dashboardPage.txtSeachCompany.sendKeys('Microsoft' + time);
- commonHelper.waitUntilElementVisible(dashboardPage.searchCompany('Microsoft' + time));
- });
- it('should see company details',() => {
- dashboardPage.btnDetails.click();
- expect(dashboardPage.pageTittle.getText()).toEqual('Microsoft' + time);
- });
- });*/
- describe('checking for add contacts', () => {
- var time = commonHelper.uniqueValue();
- beforeAll(() => {
- browser.get(signInData.link);
- });
- afterAll(() => {
- commonHelper.clearAllData();
- });
- it('should open login page', () => {
- expect(signInPage.btnLogin.isDisplayed()).toBe(true);
- });
- it('should redirect on dashboard page after login', () => {
- signInPage.login(username, password);
- commonHelper.waitUntilElementPresent(dashboardPage.menu);
- expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
- });
- it('should click on add contacts', () => {
- dashboardPage.btnAddContacts.click();
- });
- it('should add contacts', () => {
- dashboardPage.txtContactName.sendKeys('Gabe' + time);
- dashboardPage.txtContactLastName.sendKeys('Malcovich'+ time);
- dashboardPage.txtContactTitte.sendKeys('QA' + time);
- dashboardPage.selectContactCompany('Chevron');
- dashboardPage.selectContactOffices('Chevron Corporate Offices');
- dashboardPage.txtContactNumber.sendKeys(time);
- dashboardPage.txtContactEmail.sendKeys(time + '@mailinator.com');
- });
- it('should save contacts', () => {
- dashboardPage.saveCompany();
- });
- it('should redirect to dashboard',() => {
- dashboardPage.openMenu('Dashboard');
- expect(dashboardPage.pageTittle.getText()).toEqual(dashboardData.title);
- });
- it('should search contacts',() => {
- dashboardPage.txtSeachContacts.sendKeys('Gabe' + time);
- commonHelper.waitUntilElementVisible(dashboardPage.searchCompany('Gabe' + time));
- });
- it('should see contacts details',() => {
- dashboardPage.btnDetailsContact.click();
- expect(dashboardPage.pageTittle.getText()).toEqual('QA' + time);
- expect(dashboardPage.getTable(time + '@mailinator.com'));
- expect(dashboardPage.getTable(time));
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement