量角器:当值彼此相等时测试失败

时间:2016-04-27 02:32:25

标签: angularjs testing protractor

下面是我的量角器测试,它在角应用程序中打开一个对话框。它添加正确,但即使值彼此相等,测试也会失败。

我想说它可能与整个ignoringSynchronization有关,但后来我遇到了整个超时,等待弹出的模式对话框或其他东西的同步。

信息是:预期'马铃薯'等于'马铃薯'。这些都只是虚拟的价值,但是只是为了得到它的要点。

describe('someTest', function(){
// beforeEach(function(){
//     browser.get("url");

// })

it('Add Test', function(){
    browser.get("url");
    var testEle = element(by.model('ng-model'));
    testEle.$('[value="0"]').click();

    browser.waitForAngular();
    //grabbing first object from the ng-repeat
    testEle = element(by.repeater("ng-repeat").row(0));
    testEle.element(by.tagName('span')).click();

    //A modal dialog pops open with an input box so you can type stuff into it and will show options to auto complete
    //that you can click on

    //need this or else it will timeout waiting for angular to sync
    browser.ignoreSynchronization = true;


    var EC = protractor.ExpectedConditions;
    browser.wait(EC.elementToBeClickable(element(by.id('an_input_tag'))));
    testEle = element(by.id('an_input_tag'));
    testEle.sendKeys("Potat");
    browser.wait(EC.elementToBeClickable(element(by.id('input_auto_completes'))));
    testEle = element(by.id('input_auto_completes'));
    testEle.click();
    browser.wait(EC.elementToBeClickable(element(by.buttonText('Add'))));
    element(by.buttonText('Add')).click();

    browser.wait(EC.textToBePresentInElement(element(by.repeater("ng-repeat").row(0)), 'Potato'));
    testEle = element(by.repeater("ng-repeat").row(0)).element(by.className('className'));
    expect(testEle.getText()).toEqual('Potato');

 })
}

0 个答案:

没有答案