Skip to content

Commit

Permalink
chore: bump playwright to 1.33.0
Browse files Browse the repository at this point in the history
  • Loading branch information
sand4rt committed May 8, 2023
1 parent 0d9ce4a commit 5f88cd2
Show file tree
Hide file tree
Showing 10 changed files with 194 additions and 242 deletions.
2 changes: 1 addition & 1 deletion ct-web-lit/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
},
"devDependencies": {
"@sand4rt/experimental-ct-web": "*",
"@playwright/test": "^1.32.1",
"@playwright/test": "^1.33.0",
"typescript": "^4.9.5",
"vite": "^4.1.4"
}
Expand Down
2 changes: 1 addition & 1 deletion ct-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
},
"devDependencies": {
"@sand4rt/experimental-ct-web": "*",
"@playwright/test": "^1.32.1",
"@playwright/test": "^1.33.0",
"typescript": "^4.9.5",
"vite": "^4.1.4"
}
Expand Down
2 changes: 1 addition & 1 deletion playwright-ct-web/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
module.exports = require('playwright-core/cli');
module.exports = require('@playwright/experimental-ct-core/cli');
5 changes: 1 addition & 4 deletions playwright-ct-web/hooks.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@
* limitations under the License.
*/

type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
type JsonArray = JsonValue[];
type JsonObject = { [Key in string]?: JsonValue };
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';

export declare function beforeMount<HooksConfig extends JsonObject>(
callback: (params: { hooksConfig: HooksConfig }) => Promise<void>
Expand Down
13 changes: 5 additions & 8 deletions playwright-ct-web/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,22 +23,18 @@ import type {
PlaywrightWorkerOptions,
Locator,
} from '@playwright/test';
import type { JsonObject } from '@playwright/experimental-ct-core/types/component';
import type { InlineConfig } from 'vite';

export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, "use"> & {
use?: BasePlaywrightTestConfig<T, W>["use"] & {
export type PlaywrightTestConfig<T = {}, W = {}> = Omit<BasePlaywrightTestConfig<T, W>, 'use'> & {
use?: BasePlaywrightTestConfig<T, W>['use'] & {
ctPort?: number;
ctTemplateDir?: string;
ctCacheDir?: string;
ctViteConfig?: InlineConfig | (() => Promise<InlineConfig>);
};
};

type JsonPrimitive = string | number | boolean | null;
type JsonValue = JsonPrimitive | JsonObject | JsonArray;
type JsonArray = JsonValue[];
type JsonObject = { [Key in string]?: JsonValue };

type PickByValue<T, ValueType> = Pick<T, { [Key in keyof T]-?: T[Key] extends ValueType ? Key : never }[keyof T]>;

type IfEquals<X, Y, A, B> = (<T>() => T extends X ? 1 : 2) extends (<T>() => T extends Y ? 1 : 2) ? A : B;
Expand Down Expand Up @@ -72,7 +68,8 @@ export interface ComponentFixtures {

export const test: TestType<
PlaywrightTestArgs & PlaywrightTestOptions & ComponentFixtures,
PlaywrightWorkerArgs & PlaywrightWorkerOptions>;
PlaywrightWorkerArgs & PlaywrightWorkerOptions
>;

export function defineConfig(config: PlaywrightTestConfig): PlaywrightTestConfig;
export function defineConfig<T>(config: PlaywrightTestConfig<T>): PlaywrightTestConfig<T>;
Expand Down
8 changes: 3 additions & 5 deletions playwright-ct-web/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@
*/

const { test: baseTest, expect, devices, defineConfig: originalDefineConfig } = require('@playwright/test');
const { fixtures } = require('@playwright/test/lib/mount');
const { fixtures } = require('@playwright/experimental-ct-core/lib/mount');
const path = require('path');

function plugin() {
// Only fetch upon request to avoid resolution in workers.
const { createPlugin } = require('@playwright/test/lib/plugins/vitePlugin');
return createPlugin(
path.join(__dirname, 'registerSource.mjs'),
() => {});
const { createPlugin } = require('@playwright/experimental-ct-core/lib/vitePlugin');
return createPlugin(path.join(__dirname, 'registerSource.mjs'), () => {});
};

const defineConfig = config => originalDefineConfig({ ...config, _plugins: [plugin] });
Expand Down
11 changes: 7 additions & 4 deletions playwright-ct-web/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@sand4rt/experimental-ct-web",
"version": "1.0.8",
"version": "1.33.1",
"description": "Playwright Component Testing for Web Components",
"homepage": "https://playwright.dev",
"repository": {
Expand Down Expand Up @@ -42,12 +42,15 @@
"default": "./hooks.mjs"
}
},
"dependencies": {
"@playwright/test": "1.33.0",
"@playwright/experimental-ct-core": "^1.33.0"
},
"devDependencies": {
"@playwright/test": "^1.32.1",
"vite": "^4.1.4"
"vite": "^4.3.5"
},
"peerDependencies": {
"@playwright/test": ">=1.31.0"
"@playwright/test": ">=1.33.0"
},
"bin": {
"playwright": "./cli.js"
Expand Down
4 changes: 1 addition & 3 deletions playwright-ct-web/register.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,4 @@
* limitations under the License.
*/

export default function register(
components: { [key: string]: any },
): void
export default function register(components: Record<string, any>): void
18 changes: 17 additions & 1 deletion playwright-ct-web/registerSource.mjs
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
/**
* Copyright (c) Microsoft Corporation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

// @ts-check
// This file is injected into the registry as text, no dependencies are allowed.

/** @typedef {import('@playwright/test/types/component').Component} Component */
/** @typedef {import('@playwright/experimental-ct-core/types/component').Component} Component */
/** @typedef {new (...args: any[]) => HTMLElement} FrameworkComponent */

/** @type {Map<string, FrameworkComponent>} */
Expand Down
Loading

0 comments on commit 5f88cd2

Please sign in to comment.