提交 02e226b2 编写于 作者: Huan (李卓桓)'s avatar Huan (李卓桓)

follow the latest puppeteer v1.0 api

上级 492ecc3a
......@@ -31,7 +31,7 @@
"test:linux": "npm run pretest && parallel ts-node -- ./src/**/*.spec.ts ./test/**/*.spec.ts && npm run posttest",
"test:pack": "npm run dist && export TMPDIR=/tmp/wechaty.$$ && npm pack && mkdir $TMPDIR && mv wechaty-*.*.*.tgz $TMPDIR && cp test/fixture/smoke-testing.js $TMPDIR && cd $TMPDIR && npm init -y && npm i wechaty-*.*.*.tgz && node smoke-testing.js",
"test:shell": "shellcheck bin/*.sh",
"test:unit": "blue-tape -r ts-node/register -r source-map-support/register \"src/**/*.spec.ts\" \"tests/**/*.spec.ts\"",
"test:unit": "blue-tape -r ts-node/register -r source-map-support/register \"src/**/*.spec.ts\" \"src/*.spec.ts\" \"test/*.spec.ts\" \"tests/**/*.spec.ts\"",
"test:win32": "npm run test:unit",
"io-client": "ts-node bin/io-client",
"demo": "ts-node example/ding-dong-bot.ts",
......
......@@ -119,7 +119,7 @@ test('page.on(console)', async t => {
const spy = sinon.spy()
page.on('console', spy)
await (page.evaluate as any)((...args) => {
await page.evaluate((...args) => {
console.log.apply(console, args)
}, EXPECTED_ARG1, EXPECTED_ARG2) // , EXPECTED_ARG3)
......@@ -129,8 +129,8 @@ test('page.on(console)', async t => {
t.ok(spy.calledOnce, 'should be called once')
const consoleMessage = spy.firstCall.args[0]
t.equal(consoleMessage['type'], 'log', 'should get log type')
t.equal(consoleMessage['text'], EXPECTED_ARG1 + ' ' + EXPECTED_ARG2, 'should get console.log 1st/2nd arg')
t.equal(consoleMessage.type(), 'log', 'should get log type')
t.equal(consoleMessage.text(), EXPECTED_ARG1 + ' ' + EXPECTED_ARG2, 'should get console.log 1st/2nd arg')
await page.close()
await browser.close()
......@@ -190,8 +190,8 @@ test('other demos', async t => {
// await page.setRequestInterception(true)
page.on('request', interceptedRequest => {
if (interceptedRequest.url.endsWith('.png')
|| interceptedRequest.url.endsWith('.jpg')
if (interceptedRequest.url().endsWith('.png')
|| interceptedRequest.url().endsWith('.jpg')
) {
interceptedRequest.abort()
} else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册