2016-11-21 21 views
-3

我有一個任務準備,但我是量角器領域的新人。你可以幫幫我嗎? 只有信息是從哪裏開始這個量角器任務?

'use strict'; 
var constants = require('../../constants/other/constants.js'); 
var ContextMenuPage = require('../../page objects/base page/context_menu_page.js'); 
var functions = require('../../helper/functions.js'); 
var ClientScenariosPage = require('../../page objects/impairment analysis/client/scenarios_page.js'); 
var IADashboardPage = require('../../page objects/impairment analysis/ia_dashboard_page.js'); 
var BasePage = require('../../page objects/base page/base_page_object.js'); 
describe('Impairment analysis - dashboard', function() { 
    var individualAssessment = new IndividualAssessment(); 
    var iaDashboardPage = new IADashboardPage(); 
    var basePage = new BasePage(); 
    var footer = basePage.getFooter(); 
    var clientScenariosPage = new ClientScenariosPage(); 

    it('should log in', function() { 
     browser.ignoreSynchronization = true; 
     helper.login(); 
    }); 

    it('should change calcset', function() { 
     browser.sleep(4000) 
     var CalcSet = element(by.xpath('//div[@class="calcset"]/strong[@class="ng-binding"]')); 
     CalcSet.click(); 
     var input = element(by.xpath("//input[@class='k-input ng-pristine ng-untouched ng-valid ng-scope ng-empty']")); 
     input.clear(); 
     input.sendKeys('16080902'); 
     input.sendKeys(protractor.Key.ENTER); 
     footer.getCalcsetDialog().clickSetButton(); 
    }); 

    it('should go to individual assessment', function() { 
     individualAssessment.getBasePage().clickContextMenu(); 
     contextMenu.clickImpairmentAnalysisTile(); 
     iaDashboardPage.clickIndividualAssesmentTile(); 
    }); 

    it('should go to scenarios screen and assign collaterals', function() { 

     browser.sleep(5000); 

     for (var id of ["127-1", "129-1", "128", "125-1"]) { 
      var client = element(by.xpath("//div[@id='DashboardD1LISTTODO']/div[@class='k-grid-content k-auto-scrollable']/table[@class='k-selectable']/tbody/tr[@id='" + id + "']/td[@class='row-click'][2]/span[@class='link']")); 
      client.click(); 
      clientScenariosPage.getBasePage().getCarousel().clickIndicatorByName('Scenarios'); 
      browser.sleep(2000); 
      var coll_button = element(by.xpath("//trtd[5]/a[@title='Show collateral allocations']")); 
      coll_button.click(); 
      check_and_click(); 
      browser.sleep(3000); 
      var back = element(by.xpath("//div[@id='listClientCollModal']/div[@class='modal-dialog']/div[@class='modal-content']/div[@class='modal-body']/button[@class='close']")); 
      back.click(); 
      individualAssessment.getBasePage().clickContextMenu(); 
      contextMenu.clickImpairmentAnalysisTile(); 
      iaDashboardPage.clickIndividualAssesmentTile(); 
      browser.sleep(5000); 
     }); 
    }); 

    it('should log out', function() { 
     helper.logout(); 
    }); 
}); 

這是一個棘手的問題:「你會從自動化測試儀的位置做這個?」我應該問一些關於更多細節的內容,比如測試,還是隻準備一些方法? 我期待着你, 聽見託梅克

+0

首先嚐試一下,但如果你正在努力,請回來問一個具體的問題。 – Hida

+0

@Hida我可以用它做的唯一一件事我可以運行它。運行後,我得到: '[16:46:22] E/launcher - Error:Error:Can not find module'../../constants/other constants.js' at Function.Module._resolveFilename (module.js:469:15) 在Function.Module._load(module.js:417:25) 在Module.require(module.js:497:17) 在需要(內部/ module.js:20 :19) at Object。 (Module.js:570:32) (Object.Module._extensions..js(module.js:579:10) at((C:\ Pro \ spec.js:2:17) at Module.load(module.js:487:32) 在tryModuleLoad(module.js:446:12)' – Tomasz

+0

量角器不能找到'constants.js'文件。確保文件路徑正確。你可以使用'require.resolve(path/to/module)'檢查那個' –

回答

0

所以,你應該知道如何茉莉工程和頁面對象模式(http://martinfowler.com/bliki/PageObject.html)。

有了,沒有必要知道量角器來分析一下測試呢,只是試圖想像這樣找到的每一個動作 - >點擊 - >斷言它

你也可以說他們沒有測試的角頁(browser.ignoreSynchronization = true;

所述幫助對象是從未宣佈過。

我想還有很多事情要說。

+0

謝謝,我會檢查它。 – Tomasz