Я пытаюсь запустить транспортир тест Agains URL http://na5.keylo.co/, цель:простого теста транспортира неудача с неожиданным результатом
- заполнить
_model
поля данных «Oracle Corporation» click
кнопки Поиска- ожидать результата против поиска является подсчет 508
спецификации код:
describe('keylocations home page', function() {
it('should search condos', function() {
browser.get('http://na5.keylo.co/');
element(by.model('_model')).sendKeys("Oracle Corporation");
element(by.css('.search__block.search__submit')).click();
var condos = element.all(by.repeater('condo in scrollResults'));
expect(condos.count()).toEqual(508);
// this also can be used to get desired test completed
//expect(element(by.css('.bar__number'))).toEqual("508 condos found");
});
});
Проблема:
Я всегда получаю 0
в by.repeater
результат, в то время как я вижу точный результат, когда я использую в браузере вручную, его простой, но я делаю ошибку, не знаю что?
EDIT:
Использование conf.js как предложено @Gunderson:
//this works and sows success
browser.driver.wait(browser.driver.isElementPresent(by.css('.bar__number')));
//this fails with following error log
expect(element(by.css('.bar__number')).getText()).toEqual("508 condos found");
//this also fails with following error log
browser.driver.wait(expect(element(by.css('.bar__number')).getText()).toEqual("508 condos found"));
Using the selenium server at http://localhost:4444/wd/hub [launcher] Running 1 instances of WebDriver Spec started Started WARNING - more than one element found for locator by.model("_model") - the first result will be used
keylocations home page ? should search condos - Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.2/ng/test"
F
- Failures *
1) keylocations home page should search condos - Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.2/ng/test"
Executed 1 of 1 spec (1 FAILED) in 14 secs.
Failures: 1) keylocations home page should search condos Message: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.2/ng/test" Stack: Error: Failed: Error while waiting for Protractor to sync with the page: "[ng:test] no injector found for element argument to getTestability\nhttp://errors.angularjs.org/1.5.2/ng/te st" at C:\Users\Hair\AppData\Roaming\npm\node_modules\protractor\node_modules\jasminewd2\index.js:101:16 at Promise.invokeCallback_ (C:\Users\Hair\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:1329:14) at TaskQueue.execute_ (C:\Users\Hair\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2790:14) at TaskQueue.executeNext_ (C:\Users\Hair\AppData\Roaming\npm\node_modules\protractor\node_modules\selenium-webdriver\lib\promise.js:2773:21)
1 spec, 1 failure Finished in 14.407 seconds [launcher] 0 instance(s) of WebDriver still running [launcher] chrome #01 failed 1 test(s) [launcher] overall: 1 failed spec(s) [launcher] Process exited with error code 1
Я ценю ваше усилие, если вы раскомментируете 'expect (element (by.css ('. Bar__number'))). ToEqual (« Найдено 508 кондоминиумов »); –
Я предполагаю, что вы имели в виду 'expect (element (by.css ('. Bar__number')). GetText()). ToEqual (« Найдено 508 объектов »);' - (добавлен getText), потому что в противном случае вы работаете объекты. Но я запустил это, и на данный момент сайт, похоже, не реагирует, поэтому он возвращает пустую строку на данный момент. – Gunderson
Я поддержал ваш ответ, я могу принять его, если он работает по своему желанию. Я пытаюсь получить то, что упоминается в OP. –