Skip to content

Commit

Permalink
fix: update pw to 1.43.1 and fix expect types (#923)
Browse files Browse the repository at this point in the history
* fix: update pw to 1.43.1 and fix expect types

* fix chrome version
  • Loading branch information
vigneshshanmugam authored May 3, 2024
1 parent d2ae1ff commit 66eec16
Show file tree
Hide file tree
Showing 9 changed files with 31 additions and 189 deletions.
2 changes: 1 addition & 1 deletion __tests__/options.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ describe('options', () => {
ignoreHTTPSErrors: undefined,
isMobile: true,
userAgent:
'Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/121.0.6167.57 Mobile Safari/537.36',
'Mozilla/5.0 (Linux; Android 8.0.0; SM-G965U Build/R16NW) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.6367.29 Mobile Safari/537.36',
viewport: {
height: 658,
width: 320,
Expand Down
51 changes: 0 additions & 51 deletions bundles/build.js

This file was deleted.

56 changes: 0 additions & 56 deletions bundles/package-lock.json

This file was deleted.

13 changes: 0 additions & 13 deletions bundles/package.json

This file was deleted.

31 changes: 0 additions & 31 deletions bundles/src/index.js

This file was deleted.

28 changes: 14 additions & 14 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,9 @@
"kleur": "^4.1.5",
"micromatch": "^4.0.5",
"pirates": "^4.0.5",
"playwright": "=1.41.2",
"playwright-chromium": "=1.41.2",
"playwright-core": "=1.41.2",
"playwright": "=1.43.1",
"playwright-chromium": "=1.43.1",
"playwright-core": "=1.43.1",
"semver": "^7.5.4",
"sharp": "^0.32.6",
"snakecase-keys": "^4.0.1",
Expand Down
16 changes: 13 additions & 3 deletions src/core/expect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,19 @@
*
*/

import { join } from 'path';

/**
* This file is a workaround to extend the expect functionality from Playwright package
* with few extensions that we don't support in Synthetics.
*
* We are requiring the package using absolute path to workaround the Module
* resolution export issues.
*/

/* eslint-disable @typescript-eslint/no-var-requires */
const expectLib = require('../../dist/bundles/lib/index').expect;
const PW_PATH = require.resolve('playwright').replace('index.js', '');
const expectLib = require(join(PW_PATH, 'lib/matchers/expect')).expect;

function notSupported(name: string) {
throw new Error(`expect.${name} is not supported in @elastic/synthetics.`);
Expand All @@ -39,5 +50,4 @@ expectLib.extend({
toMatchSnapshot: () => notSupported('toMatchSnapshot'),
});

export const expect: typeof import('../../bundles/node_modules/playwright/types/test').expect =
expectLib;
export const expect: typeof import('playwright/types/test').expect = expectLib;
17 changes: 0 additions & 17 deletions utils/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,8 @@

/* eslint-disable @typescript-eslint/no-var-requires */
const { spawnSync } = require('child_process');
const { join } = require('path');
const { cyan } = require('kleur/colors');

const ROOT_DIR = join(__dirname, '..');
/**
* @typedef {{
* cmd: string,
Expand All @@ -41,21 +39,6 @@ const ROOT_DIR = join(__dirname, '..');
/** @type {Script[]} */
const scripts = [];

// bundles
const BUNDLES_DIR = join(ROOT_DIR, 'bundles');

scripts.push({
cmd: 'npm',
args: ['ci', '--no-fund', '--no-audit', '--no-save'],
cwd: BUNDLES_DIR,
});

scripts.push({
cmd: 'npm',
args: ['run', 'build'],
cwd: BUNDLES_DIR,
});

// test-runner
scripts.push({
cmd: 'npm',
Expand Down

0 comments on commit 66eec16

Please sign in to comment.