我不确定为什么会出现此错误。我调用GET my_index/_search
{
"query": {
"nested": {
"path": "user",
"query": {
"bool": {
"must": [
{ "match": { "user.first": "Alice" }},
{ "match": { "user.last": "White" }},
{ "match": { "user.first": "John" }},
{ "match": { "user.last": "Smith" }}
]
}
}
}
}
}
函数并定义done()
。为什么会引发此错误。
超时-jasmine.DEFAULT_TIMEOUT_INTERVAL指定的超时时间内未调用异步回调。
jasmine.DEFAULT_TIMEOUT_INTERVAL
那什么都不做
describe('Puppeteer', () => {
let originalTimeout;
beforeEach(function () {
originalTimeout = jasmine.DEFAULT_TIMEOUT_INTERVAL;
jasmine.DEFAULT_TIMEOUT_INTERVAL = 10000;
});
it('Logs in, redirects and does something', async (done) => {
const browser = await puppeteer.launch({
headless: true,
args: [
'--incognito'
]
});
const page = await browser.newPage();
await page.goto('localhost:3000/login');
... // Login Credentials
await page.waitForNavigation({ waitUntil: 'load' }); // redirects
... // perform some action on website
expect(a < b)
.toEqual(true);
browser.close();
done();
});
afterEach(function () {
jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout;
});
});
以这种方式写是可行的,但是为什么呢?
describe('...', () => {
it('...', async (done) => {
....
}, 10000);
});