test: fix chromium tests (#155)

3 chromium tests were failing on Linux.
This commit is contained in:
Andrey Lushnikov 2019-12-05 14:12:22 -08:00 committed by Yury Semikhatsky
parent 51ca756efe
commit 929a5944bd
2 changed files with 13 additions and 4 deletions

View File

@ -14,7 +14,15 @@
* limitations under the License. * limitations under the License.
*/ */
const utils = require('./utils'); const {waitEvent} = require('./utils');
const util = require('util');
const fs = require('fs');
const path = require('path');
const os = require('os');
const rmAsync = util.promisify(require('rimraf'));
const mkdtempAsync = util.promisify(fs.mkdtemp);
const TMP_FOLDER = path.join(os.tmpdir(), 'pptr_tmp_folder-');
module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOptions, playwright}) { module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOptions, playwright}) {
const {describe, xdescribe, fdescribe} = testRunner; const {describe, xdescribe, fdescribe} = testRunner;
@ -162,7 +170,7 @@ module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOp
remoteBrowser2.on('disconnected', () => ++disconnectedRemote2); remoteBrowser2.on('disconnected', () => ++disconnectedRemote2);
await Promise.all([ await Promise.all([
utils.waitEvent(remoteBrowser2, 'disconnected'), waitEvent(remoteBrowser2, 'disconnected'),
remoteBrowser2.disconnect(), remoteBrowser2.disconnect(),
]); ]);
@ -171,8 +179,8 @@ module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOp
expect(disconnectedRemote2).toBe(1); expect(disconnectedRemote2).toBe(1);
await Promise.all([ await Promise.all([
utils.waitEvent(remoteBrowser1, 'disconnected'), waitEvent(remoteBrowser1, 'disconnected'),
utils.waitEvent(originalBrowser, 'disconnected'), waitEvent(originalBrowser, 'disconnected'),
originalBrowser.close(), originalBrowser.close(),
]); ]);

View File

@ -301,6 +301,7 @@ module.exports.addTests = function({testRunner, expect, playwright, FFOX, CHROME
it('should click the button with em border with relative point', async({page, server}) => { it('should click the button with em border with relative point', async({page, server}) => {
await page.goto(server.PREFIX + '/input/button.html'); await page.goto(server.PREFIX + '/input/button.html');
await page.$eval('button', button => button.style.borderWidth = '2em'); await page.$eval('button', button => button.style.borderWidth = '2em');
await page.$eval('button', button => button.style.fontSize = '12px');
await page.click('button', { relativePoint: { x: 20, y: 10 } }); await page.click('button', { relativePoint: { x: 20, y: 10 } });
expect(await page.evaluate(() => result)).toBe('Clicked'); expect(await page.evaluate(() => result)).toBe('Clicked');
expect(await page.evaluate(() => offsetX)).toBe(20); expect(await page.evaluate(() => offsetX)).toBe(20);