Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b20cc19

Browse files
authored
Merge pull request #2479 from michaelwarren1106/master
chore: add selectOption plugin correctly
2 parents 8596901 + d07fc49 commit b20cc19

File tree

7 files changed

+34
-5
lines changed

7 files changed

+34
-5
lines changed

.changeset/pink-socks-look.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@web/test-runner': patch
3+
'@web/test-runner-commands': patch
4+
---
5+
6+
Add the selectOption plugin's exports and types correctly

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ git remote add upstream [email protected]:modernweb-dev/web.git
2424
Now that you have cloned the repository, ensure you have node 18+ installed, then run the following command to set up the development environment.
2525

2626
```sh
27-
npm run install
27+
npm install
2828
npm run build
2929
```
3030

package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/test-runner-commands/browser/commands.d.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import {
88
RemoveFilePayload,
99
SnapshotPluginConfig,
1010
SaveSnapshotPayload,
11+
SelectOptionPayload,
1112
SendMousePayload,
1213
} from '../dist/index';
1314

@@ -135,6 +136,23 @@ export function sendKeys(payload: SendKeysPayload): Promise<void>;
135136
**/
136137
export function sendMouse(payload: SendMousePayload): Promise<void>;
137138

139+
/**
140+
* Selects an option in a <select> element by value or label
141+
*
142+
* @example
143+
* ```
144+
* it('natively selects an option by value', async () => {
145+
* const valueToSelect = 'first';
146+
* const select = document.querySelector('#testSelect');
147+
*
148+
* await selectOption({ selector: '#testSelect', value: valueToSelect });
149+
*
150+
* expect(select.value).to.equal(valueToSelect);
151+
*});
152+
*```
153+
*/
154+
export function selectOption(payload: SelectOptionPayload): Promise<void>;
155+
138156
/**
139157
* Resets the mouse position to (0, 0) and releases mouse buttons.
140158
*

packages/test-runner-commands/plugins.mjs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import cjsEntrypoint from './dist/index.js';
44
const {
55
setViewportPlugin,
66
emulateMediaPlugin,
7+
selectOptionPlugin,
78
setUserAgentPlugin,
89
sendKeysPlugin,
910
sendMousePlugin,
@@ -15,6 +16,7 @@ const {
1516
export {
1617
setViewportPlugin,
1718
emulateMediaPlugin,
19+
selectOptionPlugin,
1820
setUserAgentPlugin,
1921
sendKeysPlugin,
2022
sendMousePlugin,

packages/test-runner-commands/src/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
export { Viewport, setViewportPlugin } from './setViewportPlugin';
22
export { Media, emulateMediaPlugin } from './emulateMediaPlugin';
3+
export { selectOptionPlugin, SelectOptionPayload } from './selectOptionPlugin';
34
export { setUserAgentPlugin } from './setUserAgentPlugin';
45
export { sendKeysPlugin, SendKeysPayload } from './sendKeysPlugin';
56
export { sendMousePlugin, SendMousePayload } from './sendMousePlugin';

packages/test-runner/src/config/parseConfig.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { CoverageConfig, TestRunnerCoreConfig, TestRunnerGroupConfig } from '@we
22
import { chromeLauncher } from '@web/test-runner-chrome';
33
import {
44
emulateMediaPlugin,
5+
selectOptionPlugin,
56
setUserAgentPlugin,
67
setViewportPlugin,
78
sendKeysPlugin,
@@ -251,6 +252,7 @@ export async function parseConfig(
251252
setViewportPlugin(),
252253
emulateMediaPlugin(),
253254
setUserAgentPlugin(),
255+
selectOptionPlugin(),
254256
filePlugin(),
255257
sendKeysPlugin(),
256258
sendMousePlugin(),

0 commit comments

Comments
 (0)