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

downgrade puppeteer from 1.1 to 0.13 (#1103)

上级 09ebb916
......@@ -59,7 +59,9 @@ RUN npm install \
&& sudo rm -fr /tmp/* ~/.npm
COPY . .
RUN ./script/safe-test.sh && npm run dist
# RUN npm run test:debug
RUN ./script/safe-test.sh
RUN npm run dist
# Loading from node_modules Folders: https://nodejs.org/api/modules.html
# If it is not found there, then it moves to the parent directory, and so on, until the root of the file system is reached.
......
......@@ -33,6 +33,7 @@
"test:shell": "shellcheck bin/*.sh",
"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",
"test:debug": "blue-tape -r ts-node/register -r source-map-support/register src/puppet-web/bridge.spec.ts",
"io-client": "ts-node bin/io-client",
"demo": "ts-node example/ding-dong-bot.ts",
"start": "npm run demo"
......@@ -100,7 +101,7 @@
"brolog": "^1.2.0",
"hot-import": "^0.1.0",
"mime": "^2.2.0",
"puppeteer": "^1.0.0",
"puppeteer": "^0.13.0",
"raven": "^2.2.0",
"read-pkg-up": "^3.0.0",
"request": "^2.83.0",
......
......@@ -746,6 +746,9 @@ export class Bridge extends EventEmitter {
public async clickSwitchAccount(page: Page): Promise<boolean> {
log.verbose('PuppetWebBridge', 'clickSwitchAccount()')
// TODO: use page.$x() (with puppeteer v1.1 or above) to replace DIY version of listXpath() instead.
// See: https://github.com/GoogleChrome/puppeteer/blob/v1.1.0/docs/api.md#pagexexpression
// https://github.com/GoogleChrome/puppeteer/issues/537#issuecomment-334918553
async function listXpath(thePage: Page, xpath: string): Promise<ElementHandle[]> {
log.verbose('PuppetWebBridge', 'clickSwitchAccount() listXpath()')
......@@ -801,7 +804,7 @@ export class Bridge extends EventEmitter {
public async hostname(): Promise<string | null> {
log.verbose('PuppetWebBridge', 'hostname()')
try {
const hostname = await this.page.evaluate(() => location.hostname) as any as string
const hostname = await this.page.evaluate(() => location.hostname) as string
log.silly('PuppetWebBridge', 'hostname() got %s', hostname)
return hostname
} catch (e) {
......
......@@ -114,7 +114,8 @@ test('evaluate() a file and get the returns value', async t => {
}
})
test('page.on(console)', async t => {
// FIXME: restore me after upgrade puppeteer to v1.1 or above
test.skip('page.on(console)', async t => {
const EXPECTED_ARG1 = 'arg1'
const EXPECTED_ARG2 = 2
// const EXPECTED_ARG3 = { arg3: 3 }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册