Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix e2e tests in dev mode #62642

Merged
merged 2 commits into from
Jun 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions package-lock.json

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

3 changes: 0 additions & 3 deletions packages/e2e-test-utils-playwright/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@
"main": "./build/index.js",
"types": "./build-types",
"dependencies": {
"@wordpress/api-fetch": "file:../api-fetch",
"@wordpress/keycodes": "file:../keycodes",
"@wordpress/url": "file:../url",
"change-case": "^4.1.2",
"form-data": "^4.0.0",
"get-port": "^5.1.1",
Expand Down
48 changes: 48 additions & 0 deletions packages/e2e-test-utils-playwright/src/page-utils/keycodes.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
/**
* This filed is partially copied from @wordpress/keycodes to keep the package
* (internal-)dependencies free.
*/

/**
* Keycode for ALT key.
*/
export const ALT = 'alt';

/**
* Keycode for CTRL key.
*/
export const CTRL = 'ctrl';

/**
* Keycode for COMMAND key.
*/
export const COMMAND = 'meta';

/**
* Keycode for SHIFT key.
*/
export const SHIFT = 'shift';

/**
* Object that contains functions that return the available modifier
* depending on platform.
*/
export const modifiers: Record<
string,
( _isApple: () => boolean ) => string[]
> = {
primary: ( _isApple ) => ( _isApple() ? [ COMMAND ] : [ CTRL ] ),
primaryShift: ( _isApple ) =>
_isApple() ? [ SHIFT, COMMAND ] : [ CTRL, SHIFT ],
primaryAlt: ( _isApple ) =>
_isApple() ? [ ALT, COMMAND ] : [ CTRL, ALT ],
secondary: ( _isApple ) =>
_isApple() ? [ SHIFT, ALT, COMMAND ] : [ CTRL, SHIFT, ALT ],
access: ( _isApple ) => ( _isApple() ? [ CTRL, ALT ] : [ SHIFT, ALT ] ),
ctrl: () => [ CTRL ],
alt: () => [ ALT ],
ctrlShift: () => [ CTRL, SHIFT ],
shift: () => [ SHIFT ],
shiftAlt: () => [ SHIFT, ALT ],
undefined: () => [],
};
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,7 @@ import type { Page } from '@playwright/test';
* Internal dependencies
*/
import type { PageUtils } from './';

/**
* WordPress dependencies
*/
import {
modifiers as baseModifiers,
SHIFT,
ALT,
CTRL,
} from '@wordpress/keycodes';
import { modifiers as baseModifiers, SHIFT, ALT, CTRL } from './keycodes';

let clipboardDataHolder: {
'text/plain': string;
Expand Down
5 changes: 0 additions & 5 deletions packages/e2e-test-utils-playwright/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,5 @@
"allowJs": true,
"checkJs": false
},
"references": [
{ "path": "../api-fetch" },
{ "path": "../keycodes" },
{ "path": "../url" }
],
"include": [ "src/**/*" ]
}
Loading