Skip to content

Commit 3044b13

Browse files
authored
Merge pull request #594 from DIYgod/master
[pull] master from diygod:master
2 parents 2d8e61a + b924cba commit 3044b13

File tree

4 files changed

+35
-47
lines changed

4 files changed

+35
-47
lines changed

.github/workflows/test.yml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,10 @@ jobs:
9393
run: yarn
9494
- name: Install Chromium
9595
if: ${{ matrix.chromium.dependency != '' }}
96-
# Chromium from Ubuntu is too old (85), but can still pass the tests
97-
# That's not really a problem since Chromium-bundled Docker image is based on Debian bullseye,
98-
# which updates Chromium frequently, and only on arm/arm64 the image needs Chromium from Debian.
96+
# 'chromium-browser' from Ubuntu APT repo is a dummy package. Its version (85.0.4183.83) means
97+
# nothing since it calls Snap (disgusting!) to install Chromium, which should be up-to-date.
98+
# That's not really a problem since the Chromium-bundled Docker image is based on Debian bullseye,
99+
# which provides up-to-date native packages.
99100
run: |
100101
set -ex
101102
curl -s "https://dl.google.com/linux/linux_signing_key.pub" | gpg --dearmor |

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191
"dependencies": {
9292
"@koa/router": "12.0.0",
9393
"@postlight/parser": "2.2.3",
94-
"@sentry/node": "7.21.0",
94+
"@sentry/node": "7.21.1",
9595
"aes-js": "3.1.2",
9696
"art-template": "4.13.2",
9797
"bbcodejs": "0.0.4",

test/utils/puppeteer.js

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
let puppeteer;
22
const wait = require('../../lib/utils/wait');
3-
const cheerio = require('cheerio');
43

54
let browser = null;
65

@@ -47,38 +46,26 @@ describe('puppeteer', () => {
4746
puppeteer = require('../../lib/utils/puppeteer');
4847
browser = await puppeteer({ stealth: false });
4948
const page = await browser.newPage();
50-
await page.goto('https://bot.sannysoft.com');
51-
52-
const html = await page.evaluate(() => document.body.innerHTML);
53-
const $ = cheerio.load(html);
54-
browser.close();
55-
browser = null;
56-
57-
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim();
58-
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim();
49+
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
50+
// page rendering is not instant, wait for expected elements to appear
51+
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.failed`).then((hd) => hd.evaluate((e) => e.textContent))));
5952
// the website return empty string from time to time for no reason
6053
// since we don't really care whether puppeteer without stealth passes the bot test, just let it go
6154
expect(['present (failed)', '']).toContain(webDriverTest);
6255
expect(['missing (failed)', '']).toContain(chromeTest);
63-
}, 10000);
56+
}, 15000);
6457

6558
it('puppeteer with stealth', async () => {
6659
puppeteer = require('../../lib/utils/puppeteer');
6760
browser = await puppeteer({ stealth: true });
6861
const page = await browser.newPage();
69-
await page.goto('https://bot.sannysoft.com');
70-
71-
const html = await page.evaluate(() => document.body.innerHTML);
72-
const $ = cheerio.load(html);
73-
browser.close();
74-
browser = null;
75-
76-
const webDriverTest = $('tbody tr').eq(2).find('td').eq(1).text().trim();
77-
const chromeTest = $('tbody tr').eq(4).find('td').eq(1).text().trim();
62+
await page.goto('https://bot.sannysoft.com', { waitUntil: 'networkidle0' });
63+
// page rendering is not instant, wait for expected elements to appear
64+
const [webDriverTest, chromeTest] = await Promise.all(['webdriver', 'chrome'].map((t) => page.waitForSelector(`td#${t}-result.result.passed`).then((hd) => hd.evaluate((e) => e.textContent))));
7865
// these are something we really care about
7966
expect(webDriverTest).toBe('missing (passed)');
8067
expect(chromeTest).toBe('present (passed)');
81-
}, 10000);
68+
}, 15000);
8269

8370
it('puppeteer accept proxy uri', async () => {
8471
process.env.PROXY_URI = 'http://user:pass@rsshub.proxy:2333';

yarn.lock

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1538,39 +1538,39 @@
15381538
domhandler "^4.2.0"
15391539
selderee "^0.6.0"
15401540

1541-
"@sentry/core@7.21.0":
1542-
version "7.21.0"
1543-
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.21.0.tgz#e0a7d7e772120ca0dbabd19049f340a2de74bb8a"
1544-
integrity sha512-5ZHwfHPm4svny7iXsNmlnRg0q1jw/N5/ugzAku+g98R769RCv2aSBaK9BIYlJmJ1SWwR7nQuR/GOCOdv5mA8jw==
1541+
"@sentry/core@7.21.1":
1542+
version "7.21.1"
1543+
resolved "https://registry.yarnpkg.com/@sentry/core/-/core-7.21.1.tgz#d0423282d90875625802dfe380f9657e9242b72b"
1544+
integrity sha512-Og5wEEsy24fNvT/T7IKjcV4EvVK5ryY2kxbJzKY6GU2eX+i+aBl+n/vp7U0Es351C/AlTkS+0NOUsp2TQQFxZA==
15451545
dependencies:
1546-
"@sentry/types" "7.21.0"
1547-
"@sentry/utils" "7.21.0"
1546+
"@sentry/types" "7.21.1"
1547+
"@sentry/utils" "7.21.1"
15481548
tslib "^1.9.3"
15491549

1550-
"@sentry/node@7.21.0":
1551-
version "7.21.0"
1552-
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.21.0.tgz#0c91f13a298d65108f46e1576e3ffafcbfb20300"
1553-
integrity sha512-jRwsX1tqA9R1VFcnHs3vkbNKCWCBb/eakqLQa1keEc+QxTDLAOqB/Z+z8kwEe8LC/Sj3RZIVw3VbvjrOENLEvg==
1550+
"@sentry/node@7.21.1":
1551+
version "7.21.1"
1552+
resolved "https://registry.yarnpkg.com/@sentry/node/-/node-7.21.1.tgz#929a2ad84c25f5374ec7323267f1171f6b0e261e"
1553+
integrity sha512-B+p1nQHaFWdCCRVmvqlr/+vdQCI3mGLObucNfK2YC22IQZg7+3u6tEbxJ7umITIjeSSKgf7ZoZwCxL9VfkrNXg==
15541554
dependencies:
1555-
"@sentry/core" "7.21.0"
1556-
"@sentry/types" "7.21.0"
1557-
"@sentry/utils" "7.21.0"
1555+
"@sentry/core" "7.21.1"
1556+
"@sentry/types" "7.21.1"
1557+
"@sentry/utils" "7.21.1"
15581558
cookie "^0.4.1"
15591559
https-proxy-agent "^5.0.0"
15601560
lru_map "^0.3.3"
15611561
tslib "^1.9.3"
15621562

1563-
"@sentry/types@7.21.0":
1564-
version "7.21.0"
1565-
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.21.0.tgz#b5611a60d4ce5c88e76429c3ad79af8f08de48fc"
1566-
integrity sha512-DqQi0HLp17x0++zCjI9jVST0cuszsQtrVIMQRQXpy8J/ay3IGxwFoX1qMrwFP2tmVQDsy8YKIz50J5e6caXwSw==
1563+
"@sentry/types@7.21.1":
1564+
version "7.21.1"
1565+
resolved "https://registry.yarnpkg.com/@sentry/types/-/types-7.21.1.tgz#408a7b95a66ddc30c4359979594e03bee8f9fbdc"
1566+
integrity sha512-3/IKnd52Ol21amQvI+kz+WB76s8/LR5YvFJzMgIoI2S8d82smIr253zGijRXxHPEif8kMLX4Yt+36VzrLxg6+A==
15671567

1568-
"@sentry/utils@7.21.0":
1569-
version "7.21.0"
1570-
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.21.0.tgz#50d841990953ea1ff006c2776e997620d091790f"
1571-
integrity sha512-Dn9zsPOfz1kbBua8KSYUPrka31Lh+am9BVJWnzqzGbALthf134oUTbp2vcwpMyEW7NxX+4Qd+36BvTzapfRINQ==
1568+
"@sentry/utils@7.21.1":
1569+
version "7.21.1"
1570+
resolved "https://registry.yarnpkg.com/@sentry/utils/-/utils-7.21.1.tgz#96582345178015fd32fe9159c25c44ccf2f99d2a"
1571+
integrity sha512-F0W0AAi8tgtTx6ApZRI2S9HbXEA9ENX1phTZgdNNWcMFm1BNbc21XEwLqwXBNjub5nlA6CE8xnjXRgdZKx4kzQ==
15721572
dependencies:
1573-
"@sentry/types" "7.21.0"
1573+
"@sentry/types" "7.21.1"
15741574
tslib "^1.9.3"
15751575

15761576
"@sinclair/typebox@^0.24.1":

0 commit comments

Comments
 (0)