Running into Error while waiting for Protractor to sync with the page with basic protractor test

前端 未结 7 2002
南旧
南旧 2020-12-03 10:31
describe(\'my homepage\', function() {
    var ptor = protractor.getInstance();
    beforeEach(function(){
        // ptor.ignoreSynchronization = true;
        ptor         


        
7条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-03 11:06

    In my case, I encountered the error with the following code:

    describe("application", function() {
      it("should set the title", function() {
        browser.getTitle().then(function(title) {
          expect(title).toEqual("Welcome");
        });
      });
    });
    

    Fixed it by doing this:

    describe("application", function() {
      it("should set the title", function() {
        browser.get("#/home").then(function() {
          return browser.getTitle();
        }).then(function(title) {
          expect(title).toEqual("Welcome");
        });
      });
    });
    

    In other words, I was forgetting to navigate to the page I wanted to test, so Protractor was having trouble finding Angular. D'oh!

提交回复
热议问题