Я новичок в транспортире, следуя инструкциям, приведенным на официальном сайте (http://protractortest.org). Закончилась этой ошибкой - PullRequest
0 голосов
/ 26 марта 2019

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

Я проверил связанные вопросы и ответил на них в переполнении стека, но ни один из них не решил мою проблему.

файл конфигурации: `` `

// An example configuration file
exports.config = {
    framework: 'jasmine',
    // The address of a running selenium server.
    seleniumAddress: 'http://localhost:4444/wd/hub',

    // Capabilities to be passed to the webdriver instance.
    capabilities: {
        browserName: 'firefox',
    },

    specs: ['./todo-spec.js']
    // Options to be passed to Jasmine-node.

};
spec file:
describe("Protractor Demo App", function() {
    it("should have a title", function() {
        browser.get("http://juliemr.github.io/protractor-demo/");
        expect(browser.getTitle()).toEqual("Super Calculator");
    });
});



error log:

Failures:
1) Protractor Demo App should have a title
  Message:
    Expected [object Promise] to equal 'Super Calculator'.
  Stack:
    Error: Expected [object Promise] to equal 'Super Calculator'.
        at <Jasmine>
        at UserContext.<anonymous> (E:\protractor\todo-spec.js:4:32)
        at <Jasmine>

1 spec, 1 failure
Finished in 0.047 seconds
C:\Users\M1049161\AppData\Roaming\npm\node_modules\protractor\node_modules\jasmine-core\lib\jasmine-core\jasmine.js:3190
        throw arguments[0];
        ^

Error: Error while waiting for Protractor to sync with the page: "both angularJS testability and angular testability are undefined.  This could be either because this is a non-angular page or because your test involves client-side navigation, which can interfere with Protractor's bootstrapping.  See http://git.io/v4gXM for details"
    at ProtractorBrowser.<anonymous> (C:\Users\M1049161\AppData\Roaming\npm\node_modules\protractor\built\browser.js:354:27)
    at Generator.next (<anonymous>)
    at fulfilled (C:\Users\M1049161\AppData\Roaming\npm\node_modules\protractor\built\browser.js:4:58)
    at process._tickCallback (internal/process/next_tick.js:68:7)


Ответы [ 2 ]

0 голосов
/ 26 марта 2019

Для решения проблемы используйте следующую опцию

  1. Добавить SELENIUM_PROMISE_MANAGER: true , в вашу конфигурацию. Js

    ИЛИ

  2. Используйте await в спецификации файла следующим образом:

    describe('Protractor Demo App', function() {
    it('should have a title', async function() {
        await browser.get('http://juliemr.github.io/protractor-demo/');
        expect(await browser.getTitle()).toEqual('Super Calculator');
    });    });
    
0 голосов
/ 26 марта 2019

Проблема с разрешением обещания. Попробуйте следующее в вашем файле спецификации.

describe("Protractor Demo App", () => {
    it("should have a title", async () => {
        await browser.get("http://juliemr.github.io/protractor-demo/");
        await browser.waitForAngularEnabled(true); // make true if your application is angular
        await expect(await browser.getTitle()).toEqual("Super Calculator");
    });
});

Надеюсь, это поможет вам

...