Сквозное тестирование: - Ошибка транспортира: неизвестная ошибка: результат вызова функции отсутствует «значение» - PullRequest
0 голосов
/ 23 мая 2018

здесь код в объекте страницы.

 getPageTitle () {
return browser.getTitle (); 
}

И в моем сценарии я записал этот код.:

it('Title should be Project', () => {

    page.navigateTo();
    page.getPageTitle()
      .then((title: string) => {
        expect(title).toEqual('Project');
      });
  });

После этого я получаю эту ошибку.Я понятия не имею, почему у меня это, в то время как мой заголовок написан правильно.

    1) project App Title should be Project
  - Failed: unknown error: call function result missing 'value'
  (Session info: chrome=66.0.3359.181)
  (Driver info: chromedriver=2.26.436382 (70eb799287ce4c2208441fc057053a5b07ceabac),platform=Linux 4.13.0-41-generic x86_64)

Executed 1 of 1 spec (1 FAILED) in 0.699 sec.
[11:55:50] I/launcher - 0 instance(s) of WebDriver still running
[11:55:50] I/launcher - chrome #01 failed 1 test(s)
[11:55:50] I/launcher - overall: 1 failed spec(s)
[11:55:50] E/launcher - Process exited with error code 1

(node:26179) [DEP0022] DeprecationWarning: os.tmpDir() is deprecated. Use os.tmpdir() instead.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! project@0.0.0 e2e: `protractor "./protractor.conf.js"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the project@0.0.0 e2e script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/student-08/.npm/_logs/2018-05-23T09_55_51_005Z-debug.log

Some end-to-end tests failed, see above.

Я также пытался с этим:

it('Title should be Project', () => {
page.navigateTo();
expect(page.getPageTitle()).toEqual('Project');
 })

Но все еще с той же проблемой.Есть идеи, что я сделал не так?

1 Ответ

0 голосов
/ 24 мая 2018

Я предполагаю, что загрузка заголовка задерживается.Поэтому вместо проверки названия попробуйте дождаться его после page.navigateTo():

browser.wait(ExpectedConditions.titleIs('Project'));
...