mirror of
https://github.com/DIYgod/RSSHub.git
synced 2026-09-24 23:12:34 +08:00
chore: skip stealth test in github actions
This commit is contained in:
@@ -49,6 +49,7 @@ jobs:
|
||||
run: npm run jest:coverage
|
||||
env:
|
||||
REDIS_URL: redis://localhost:${{ job.services.redis.ports[6379] }}/
|
||||
GH_ACTIONS: 1
|
||||
- name: Upload coverage to Codecov
|
||||
if: ${{ matrix.node-version == '18' }}
|
||||
uses: codecov/codecov-action@v3
|
||||
|
||||
+25
-23
@@ -42,30 +42,32 @@ describe('puppeteer', () => {
|
||||
browser = null;
|
||||
}, 45000);
|
||||
|
||||
it('puppeteer without stealth', async () => {
|
||||
puppeteer = require('../../lib/utils/puppeteer');
|
||||
browser = await puppeteer({ stealth: false });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
|
||||
// page rendering is not instant, wait for expected elements to appear
|
||||
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.failed`).then((hd) => hd.evaluate((e) => e.textContent))));
|
||||
// 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);
|
||||
}, 15000);
|
||||
if (!process.env.GH_ACTIONS) {
|
||||
it('puppeteer without stealth', async () => {
|
||||
puppeteer = require('../../lib/utils/puppeteer');
|
||||
browser = await puppeteer({ stealth: false });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
|
||||
// page rendering is not instant, wait for expected elements to appear
|
||||
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.failed`).then((hd) => hd.evaluate((e) => e.textContent))));
|
||||
// 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);
|
||||
}, 15000);
|
||||
|
||||
it('puppeteer with stealth', async () => {
|
||||
puppeteer = require('../../lib/utils/puppeteer');
|
||||
browser = await puppeteer({ stealth: true });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
|
||||
// page rendering is not instant, wait for expected elements to appear
|
||||
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.passed`).then((hd) => hd.evaluate((e) => e.textContent))));
|
||||
// these are something we really care about
|
||||
expect(webDriverTest).toBe('missing (passed)');
|
||||
expect(chromeTest).toBe('present (passed)');
|
||||
}, 15000);
|
||||
it('puppeteer with stealth', async () => {
|
||||
puppeteer = require('../../lib/utils/puppeteer');
|
||||
browser = await puppeteer({ stealth: true });
|
||||
const page = await browser.newPage();
|
||||
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
|
||||
// page rendering is not instant, wait for expected elements to appear
|
||||
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.passed`).then((hd) => hd.evaluate((e) => e.textContent))));
|
||||
// these are something we really care about
|
||||
expect(webDriverTest).toBe('missing (passed)');
|
||||
expect(chromeTest).toBe('present (passed)');
|
||||
}, 15000);
|
||||
}
|
||||
|
||||
it('puppeteer accept http proxy uri w/ auth', async () => {
|
||||
process.env.PROXY_URI = 'http://user:pass@rsshub.proxy:2333';
|
||||
|
||||
Reference in New Issue
Block a user