2016-11-21 20 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