Javascript getCurrentUrl()给我的是;未处理的PromisejectionWarning“;在一次测试中

Javascript getCurrentUrl()给我的是;未处理的PromisejectionWarning“;在一次测试中,javascript,selenium,protractor,e2e-testing,Javascript,Selenium,Protractor,E2e Testing,我将测试更改为async/await,从那时起,browser.getCurrentUrl()工作正常,但此测试除外: (Filling out a Form) ... await element(by.id('auftrag-disponieren')).click(); await browser.wait(EC.visibilityOf($('list')), 1000).catch((e) => {

我将测试更改为async/await,从那时起,browser.getCurrentUrl()工作正常,但此测试除外:

        (Filling out a Form)
        ...
        await element(by.id('auftrag-disponieren')).click();

        await browser.wait(EC.visibilityOf($('list')), 1000).catch((e) => {
          console.log(e);
        });

        since('How it should be, but is #{actual}').
          expect(await browser.getCurrentUrl()).toContain("https://someRandomDomain.com");

      })
    });
抛出以下警告,但仍通过测试:

>(node:13760) UnhandledPromiseRejectionWarning: 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 runWaitForAngularScript.then (C:\Users\mat\AppData\Roaming\npm\node_modules\protractor\built\browser.js:463:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:13760) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
(node:13760) UnhandledPromiseRejectionWarning: 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 runWaitForAngularScript.then (C:\Users\mat\AppData\Roaming\npm\node_modules\protractor\built\browser.js:463:23)
    at process._tickCallback (internal/process/next_tick.js:68:7)
(node:13760) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
7.7 7 7 7.7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 7 e̶,c̶,l̶,I̶,c̶,k̶,I̶,t̶,a̶,l̶,s̶,o̶,f̶,a̶,I̶,l̶,s̶,在本研究中,我们的研究对象是一个城市和一个城市的城市,以及一个城市和一个城市的城市和一个城市的城市和一个城市的城市和一个城市的城市和一个城市的城市和一个城市的城市和一个城市的城市和一个城市之间的城市和一个城市和一个城市之间的城市和一个城市之间的城市之间的城市之间的相互之间的相互之间的相互之间的相互之间的影响,以及城市和城市之间的城市之间的城市之间的城市之间的之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的相互之间的本研究的目的是,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,P,c,c,c,c,c,c,c,c,c,c,a,c,c,c,c,P,c,c,P,c,c,P,c,c,c,c,P,c,c,c,c,c,c,P,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c,c"我,我,我,我,我,我,我,我,我,我,我,我,我,我,我,我

我在不同的测试中多次使用了
browser.getCurrentUrl()
,但这是我唯一得到此警告的测试

编辑:

禁用
since()。我得到了和以前一样的结果

我可能应该提到我有以下功能

毕竟(异步()=>{ 等待浏览器。获取(“https://someRandomDomain.com/dashboard") })

Edit2:

我认为警告源于
毕竟(async()=>{await browser.get(“https://someRandomDomain.com/dashboard)
函数。自从评论了这句话,我没有得到这些警告。但是我仍然在不同的测试中使用这个函数,他们不会抛出这些警告。

试试下面的一个

    since('How it should be, but is #{actual}').
      await browser.waiForAngularEnabled(false);//true if your application is angular
      await expect(await browser.getCurrentUrl()).toContain("https://someRandomDomain.com");

  })
试试下面这个

    since('How it should be, but is #{actual}').
      await browser.waiForAngularEnabled(false);//true if your application is angular
      await expect(await browser.getCurrentUrl()).toContain("https://someRandomDomain.com");

  })

expect
之前尝试
wait

await expect(...).toContain(...);

expect
之前尝试
wait

await expect(...).toContain(...);

我最终将其改为:

afterAll(async () => {
        await browser.driver.get("https://someRandomDomain.com/dashboard");
        await browser.driver.sleep(1000);
    });

我最终将其改为:

afterAll(async () => {
        await browser.driver.get("https://someRandomDomain.com/dashboard");
        await browser.driver.sleep(1000);
    });

从浏览器中记录时出错。等等?这可能是由于页面加载过快而找不到角度,但基于等待时间为1秒的事实,这是不太可能的。是否有其他与此页面交互的测试成功通过?@DublinDev这不是因为浏览器。等等,我禁用了日志记录,它仍然出现。我的意思是,我可以在没有“browser.getCurrentUrl”的情况下运行相同的测试,而且它不会给我这些警告。即使我收到这些警告,测试也会相应地通过/失败。我的意思是,如果错误是从
browser.wait().catch()
语句中记录的,那么您知道页面没有按预期加载,因此
expect
将失败。如果未记录该错误,则您有一个单独的问题,即从浏览器记录该错误。等等?这可能是由于页面加载过快而找不到角度,但基于等待时间为1秒的事实,这是不太可能的。是否有其他与此页面交互的测试成功通过?@DublinDev这不是因为浏览器。等等,我禁用了日志记录,它仍然出现。我的意思是,我可以在没有“browser.getCurrentUrl”的情况下运行相同的测试,而且它不会给我这些警告。即使我收到这些警告,测试也会相应地通过/失败。我的意思是,如果错误是从
browser.wait().catch()
语句中记录的,那么您知道页面没有按预期加载,因此
expect
将失败。如果这个错误没有被记录下来,那么你有一个单独的问题。由于它不起作用,我得到了相同的结果。这是一个角度page@Moke您是否尝试使用
wait browser.waiForAngularEnabled(true)在加载你的应用程序之前添加这个,可惜它不起作用,我得到了同样的结果。这是一个角度page@Moke您是否尝试使用
wait browser.waiForAngularEnabled(true)在加载应用程序url之前添加此项