简体   繁体   English

错误:function 超时,确保 promise 在 - Cucumber js 内解析

[英]Error: function timed out, ensure the promise resolves within - Cucumber js

I am using protractor with cucumber js i have all function with async and await and also set global timeout我正在使用 protractor 和 cucumber js 我有所有 function 与异步和等待,还设置全局超时

var {setDefaultTimeout} = require('cucumber'); var {setDefaultTimeout} = 要求('黄瓜'); setDefaultTimeout(60 * 1000);设置默认超时(60 * 1000);

Then('I click on tab', async ()=> {
  
    await organizationOperation.clickHeaderTab();

  });

Question - if i use wrong xpath/element is not located in UI, in that case getting below error问题 - 如果我使用错误的 xpath/element 不在 UI 中,在这种情况下会出现错误

Error: function timed out, ensure the promise resolves within 60000 milliseconds错误:function 超时,确保 promise 在 60000 毫秒内解析

It should throw an error locator not found (locator text)它应该抛出一个找不到错误定位器(定位器文本)

or if directly i use或者如果我直接使用

  Then('I click on tab', async ()=> {
      
 const d = await $('.xxxxx').getText();
     console.log(d)

});

getting same error --> Error: function timed out, ensure the promise resolves within 30000 milliseconds得到同样的错误 --> 错误:function 超时,确保 promise 在 30000 毫秒内解决

Why it is not showing - element not found error on console..?为什么它没有显示 - 在控制台上找不到元素错误..?

Are you using implicit wait in your code while launching a browser?您是否在启动浏览器时在代码中使用了隐式等待? If Yes, make sure your timeout is more than implicit wait time you provided.. If not, declare implicit wait time with less than the default setDefaultTimeout(60 * 1000);如果是,请确保您的超时时间大于您提供的隐式等待时间。如果不是,请声明隐式等待时间小于默认的 setDefaultTimeout(60 * 1000);

In case implicit wait is more than default time, we used to get this error function timed out, make sure to resolve with in ****.如果隐式等待超过默认时间,我们曾经收到此错误 function 超时,请确保使用 **** 解决。 In case implicit wait is less than the default time, waiting for an element via implicit wait will expire first and throws Element Not Found exception.如果隐式等待小于默认时间,则通过隐式等待等待元素将首先过期并抛出 Element Not Found 异常。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 WEBDRIVERIO / CUCUMBER:函数超时,确保Promise在10000毫秒内解析 - WEBDRIVERIO / CUCUMBER : Function timeout , Ensure Promise resolves within 10000 milliseconds 函数超时,请确保回调在60000毫秒内执行 - Function timed out, ensure the callback is executed within 60000 milliseconds TypeScript + Cucumber问题:错误:函数在10000毫秒后超时 - TypeScript + Cucumber Issue : Error: function timed out after 10000 milliseconds 黄瓜量角器-错误:函数在50000毫秒后超时 - Cucumber Protractor - Error: function timed out after 50000 milliseconds 对于异步测试和挂钩,如何解决超时超出错误,请确保调用了“ done()”; 如果返回承诺,请确保其解决 - How to fix Timeout exceeded error for async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves 摩卡:错误:超过 2000 毫秒超时。 对于异步测试和钩子,确保调用“done()”; 如果返回 Promise,请确保它已解决 - Mocha: Error: Timeout of 2000ms exceeded. For async tests and hooks, ensure "done()" is called; if returning a Promise, ensure it resolves 错误:超时超过30000ms。 对于异步测试和挂钩,请确保调用了“ done()”。 如果返回承诺,请确保其解决 - Error: Timeout of 30000ms exceeded. For async tests and hooks, ensure “done()” is called; if returning a Promise, ensure it resolves FileReader的Promise功能过早解决 - Promise function with FileReader resolves prematurely 如何创建一个函数,返回一个在内部承诺解决后解决的承诺 - How to create a function returning a promise that resolves after inner promise resolves 摩卡超时后承诺解决 - Promise resolves after Mocha times out
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM