从哪里开始这个量角器任务?

时间:2016-11-21 15:35:13

标签: javascript angularjs automation protractor automated-tests

我有一个准备任务,但我是量角器领域的新手。你可以帮帮我吗? 只有信息是“你将从自动化测试仪的位置做什么”

'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();
    });
});

这是一个棘手的问题吗?我应该询问更多细节,例如它将测试的页面,还是只准备一些方法? 我期待着您的回音, 托梅克

1 个答案:

答案 0 :(得分:0)

所以你应该知道茉莉花是如何工作的以及页面对象模式(http://martinfowler.com/bliki/PageObject.html)。

有了这个,就没有必要知道量角器来分析测试的作用,只是试着想象一下每个动作都能找到一些东西 - >点击那 - >断言

另外,您可以说他们没有测试角度页面(browser.ignoreSynchronization = true;

永远不会声明辅助对象。

我想还有很多事情要说。