forked from DIYgod/RSSHub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #594 from DIYgod/master
[pull] master from diygod:master
- Loading branch information
Showing
4 changed files
with
35 additions
and
47 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
let puppeteer; | ||
const wait = require('../../lib/utils/wait'); | ||
const cheerio = require('cheerio'); | ||
|
||
let browser = null; | ||
|
||
|
@@ -47,38 +46,26 @@ describe('puppeteer', () => { | |
puppeteer = require('../../lib/utils/puppeteer'); | ||
browser = await puppeteer({ stealth: false }); | ||
const page = await browser.newPage(); | ||
await page.goto('https://bot.sannysoft.com'); | ||
|
||
const html = await page.evaluate(() => document.body.innerHTML); | ||
const $ = cheerio.load(html); | ||
browser.close(); | ||
browser = null; | ||
|
||
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim(); | ||
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim(); | ||
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); | ||
}, 10000); | ||
}, 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'); | ||
|
||
const html = await page.evaluate(() => document.body.innerHTML); | ||
const $ = cheerio.load(html); | ||
browser.close(); | ||
browser = null; | ||
|
||
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim(); | ||
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim(); | ||
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)'); | ||
}, 10000); | ||
}, 15000); | ||
|
||
it('puppeteer accept proxy uri', async () => { | ||
process.env.PROXY_URI = 'http://user:[email protected]:2333'; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1538,39 +1538,39 @@ | |
domhandler "^4.2.0" | ||
selderee "^0.6.0" | ||
|
||
"@sentry/[email protected].0": | ||
version "7.21.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.21.0.tgz#e0a7d7e772120ca0dbabd19049f340a2de74bb8a" | ||
integrity sha512-5ZHwfHPm4svny7iXsNmlnRg0q1jw/N5/ugzAku+g98R769RCv2aSBaK9BIYlJmJ1SWwR7nQuR/GOCOdv5mA8jw== | ||
"@sentry/[email protected].1": | ||
version "7.21.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.21.1.tgz#d0423282d90875625802dfe380f9657e9242b72b" | ||
integrity sha512-Og5wEEsy24fNvT/T7IKjcV4EvVK5ryY2kxbJzKY6GU2eX+i+aBl+n/vp7U0Es351C/AlTkS+0NOUsp2TQQFxZA== | ||
dependencies: | ||
"@sentry/types" "7.21.0" | ||
"@sentry/utils" "7.21.0" | ||
"@sentry/types" "7.21.1" | ||
"@sentry/utils" "7.21.1" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected].0": | ||
version "7.21.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.21.0.tgz#0c91f13a298d65108f46e1576e3ffafcbfb20300" | ||
integrity sha512-jRwsX1tqA9R1VFcnHs3vkbNKCWCBb/eakqLQa1keEc+QxTDLAOqB/Z+z8kwEe8LC/Sj3RZIVw3VbvjrOENLEvg== | ||
"@sentry/[email protected].1": | ||
version "7.21.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.21.1.tgz#929a2ad84c25f5374ec7323267f1171f6b0e261e" | ||
integrity sha512-B+p1nQHaFWdCCRVmvqlr/+vdQCI3mGLObucNfK2YC22IQZg7+3u6tEbxJ7umITIjeSSKgf7ZoZwCxL9VfkrNXg== | ||
dependencies: | ||
"@sentry/core" "7.21.0" | ||
"@sentry/types" "7.21.0" | ||
"@sentry/utils" "7.21.0" | ||
"@sentry/core" "7.21.1" | ||
"@sentry/types" "7.21.1" | ||
"@sentry/utils" "7.21.1" | ||
cookie "^0.4.1" | ||
https-proxy-agent "^5.0.0" | ||
lru_map "^0.3.3" | ||
tslib "^1.9.3" | ||
|
||
"@sentry/[email protected].0": | ||
version "7.21.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.21.0.tgz#b5611a60d4ce5c88e76429c3ad79af8f08de48fc" | ||
integrity sha512-DqQi0HLp17x0++zCjI9jVST0cuszsQtrVIMQRQXpy8J/ay3IGxwFoX1qMrwFP2tmVQDsy8YKIz50J5e6caXwSw== | ||
"@sentry/[email protected].1": | ||
version "7.21.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.21.1.tgz#408a7b95a66ddc30c4359979594e03bee8f9fbdc" | ||
integrity sha512-3/IKnd52Ol21amQvI+kz+WB76s8/LR5YvFJzMgIoI2S8d82smIr253zGijRXxHPEif8kMLX4Yt+36VzrLxg6+A== | ||
|
||
"@sentry/[email protected].0": | ||
version "7.21.0" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.21.0.tgz#50d841990953ea1ff006c2776e997620d091790f" | ||
integrity sha512-Dn9zsPOfz1kbBua8KSYUPrka31Lh+am9BVJWnzqzGbALthf134oUTbp2vcwpMyEW7NxX+4Qd+36BvTzapfRINQ== | ||
"@sentry/[email protected].1": | ||
version "7.21.1" | ||
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.21.1.tgz#96582345178015fd32fe9159c25c44ccf2f99d2a" | ||
integrity sha512-F0W0AAi8tgtTx6ApZRI2S9HbXEA9ENX1phTZgdNNWcMFm1BNbc21XEwLqwXBNjub5nlA6CE8xnjXRgdZKx4kzQ== | ||
dependencies: | ||
"@sentry/types" "7.21.0" | ||
"@sentry/types" "7.21.1" | ||
tslib "^1.9.3" | ||
|
||
"@sinclair/typebox@^0.24.1": | ||
|
3044b13
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
rsshub-master – ./
rsshub-master.vercel.app
rsshub-master-git-master-auto-bot-ty.vercel.app
rsshub-master-auto-bot-ty.vercel.app