Skip to content

Playwright is a framework for Web Testing and Automation. It allows testing Chromium, Firefox and WebKit with a single API.

test: fix chromium tests (#155)

Andrey Lushnikov929a5944bd6a
diff --git a/test/chromiumonly.spec.js b/test/chromiumonly.spec.js
index 2f6f488f1c..b0adeacc6e 100644
--- a/test/chromiumonly.spec.js
+++ b/test/chromiumonly.spec.js
@@ -14,7 +14,15 @@
* 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}) {
const {describe, xdescribe, fdescribe} = testRunner;
@@ -162,7 +170,7 @@ module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOp
remoteBrowser2.on('disconnected', () => ++disconnectedRemote2);
await Promise.all([
- utils.waitEvent(remoteBrowser2, 'disconnected'),
+ waitEvent(remoteBrowser2, 'disconnected'),
remoteBrowser2.disconnect(),
]);
@@ -171,8 +179,8 @@ module.exports.addLauncherTests = function({testRunner, expect, defaultBrowserOp
expect(disconnectedRemote2).toBe(1);
await Promise.all([
- utils.waitEvent(remoteBrowser1, 'disconnected'),
- utils.waitEvent(originalBrowser, 'disconnected'),
+ waitEvent(remoteBrowser1, 'disconnected'),
+ waitEvent(originalBrowser, 'disconnected'),
originalBrowser.close(),
]);
diff --git a/test/click.spec.js b/test/click.spec.js
index d80c0217c5..18738cafc2 100644
--- a/test/click.spec.js
+++ b/test/click.spec.js
@@ -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}) => {
await page.goto(server.PREFIX + '/input/button.html');
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 } });
expect(await page.evaluate(() => result)).toBe('Clicked');
expect(await page.evaluate(() => offsetX)).toBe(20);