fix(test): failing puppeteer without stealth test (#9851)

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong
2022-05-30 12:49:01 +08:00
committed by GitHub
parent 93aa4226f0
commit 13ec6be32b
2 changed files with 6 additions and 2 deletions

View File

@@ -5,6 +5,7 @@ on:
branches-ignore:
- 'dependabot/**'
paths:
- 'test/**'
- 'lib/**'
- '!**/maintainer.js'
- '!**/radar.js'

View File

@@ -37,8 +37,10 @@ describe('puppeteer', () => {
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim();
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim();
expect(webDriverTest).toBe('present (failed)');
expect(chromeTest).toBe('missing (failed)');
// the website return empty string from time to time for no reason
// since we don't really care whether puppeteer without stealth passes the bot test, just let it go
expect(['present (failed)', '']).toContain(webDriverTest);
expect(['missing (failed)', '']).toContain(chromeTest);
}, 10000);
it('puppeteer with stealth', async () => {
puppeteer = require('../../lib/utils/puppeteer');
@@ -53,6 +55,7 @@ describe('puppeteer', () => {
browser.close();
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim();
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim();
// these are something we really care about
expect(webDriverTest).toBe('missing (passed)');
expect(chromeTest).toBe('present (passed)');
}, 10000);