fix(tests): update expected values and increase timeout for Puppeteer tests

- Adjusted expected values in error handling tests to reflect updated application behavior.
- Increased timeout for Puppeteer tests from 20 seconds to 45 seconds to accommodate longer loading times.
This commit is contained in:
DIYgod 2025-08-22 17:45:39 +08:00
parent 3bf8f1ea90
commit 532619a8c2
No known key found for this signature in database
3 changed files with 11 additions and 9 deletions

View File

@ -75,19 +75,21 @@ describe('route throws an error', () => {
const value = $(item).find('.debug-value').html()?.trim();
switch (key) {
case 'Request Amount:':
expect(value).toBe('11');
expect(value).toBe('12');
break;
case 'Hot Routes:':
expect(value).toBe('8 /test/:id/:params?<br>');
expect(value).toBe('9 /test/:id/:params?<br>');
break;
case 'Hot Paths:':
expect(value).toBe('2 /test/error<br>2 /test/slow<br>2 /test/slow4<br>1 /test/httperror<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>1 /<br>');
expect(value).toBe(
'2 /test/error<br>2 /test/slow<br>2 /test/slow4<br>1 /test/httperror<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /test/captcha-error<br>1 /thisDoesNotExist<br>1 /<br>'
);
break;
case 'Hot Error Routes:':
expect(value).toBe('5 /test/:id/:params?<br>');
expect(value).toBe('6 /test/:id/:params?<br>');
break;
case 'Hot Error Paths:':
expect(value).toBe('2 /test/error<br>1 /test/httperror<br>1 /test/slow4<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /thisDoesNotExist<br>');
expect(value).toBe('2 /test/error<br>1 /test/httperror<br>1 /test/slow4<br>1 /test/config-not-found-error<br>1 /test/invalid-parameter-error<br>1 /test/captcha-error<br>1 /thisDoesNotExist<br>');
break;
default:
}

View File

@ -74,7 +74,7 @@ describe('puppeteer-utils', () => {
waitUntil: 'domcontentloaded',
});
expect((await getCookies(page, 'httpbingo.org')).split('; ').sort()).toEqual(['foo=bar', 'baz=qux'].sort());
}, 20000);
}, 45000);
it('setCookies httpbingo', async () => {
browser = await puppeteer();
@ -86,7 +86,7 @@ describe('puppeteer-utils', () => {
});
const data = await page.evaluate(() => JSON.parse(document.body.textContent || ''));
expect(data).toEqual(Object.fromEntries(cookieArrayExampleCom.map(({ name, value }) => [name, value])));
}, 20000);
}, 45000);
it('setCookies & getCookies example.org', async () => {
browser = await puppeteer();
@ -97,5 +97,5 @@ describe('puppeteer-utils', () => {
waitUntil: 'domcontentloaded',
});
expect((await getCookies(page, 'example.org')).split('; ').sort()).toEqual(cookieStrAll.split('; ').sort());
}, 20000);
}, 45000);
});

View File

@ -55,7 +55,7 @@ describe('puppeteer', () => {
// these are something we really care about
expect(webDriverTest).toBe('missing (passed)');
expect(chromeTest).toBe('present (passed)');
}, 20000);
}, 45000);
// }
it('puppeteer accept http proxy uri w/ auth', async () => {