Skip to content

add key literals to driver#10854

Merged
brad-decker merged 2 commits intodevelopfrom
abstract-key-into-driver
Apr 12, 2021
Merged

add key literals to driver#10854
brad-decker merged 2 commits intodevelopfrom
abstract-key-into-driver

Conversation

@brad-decker
Copy link
Contributor

@brad-decker brad-decker commented Apr 8, 2021

This PR aims to improve the abstraction around sending keystrokes/values to input fields. The API aims to match playwright's implementation to allow a more straightforward migration in the near future. There are a few pieces:

  1. Add the 'Key' constants to the driver itself, hardcoded instead of using selenium's. These can be later replaced with 'Enter' and 'Backspace' to match the playwright API for .press
  2. Add driver.fill API to the driver that matches playwright's fill method. Fill differs from sendKeys in that it replaces the current value instead of adding to it.
  3. Add driver.press API to the driver that matches playwright's press method. Playwright's implementation differs in that it expects key names like 'Enter' while selenium's expects unicode encoded key values.
  4. Wraps all elements returned from driver with fill and press methods.

This PR includes the refactor to use these.

@brad-decker brad-decker force-pushed the abstract-key-into-driver branch 2 times, most recently from 108a021 to fcee942 Compare April 8, 2021 22:00
@metamaskbot
Copy link
Collaborator

Builds ready [fcee942]
Page Load Metrics (585 ± 50 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint47855894
domContentLoaded33873358410651
load34073358510550
domInteractive33873258310651

@brad-decker brad-decker marked this pull request as ready for review April 8, 2021 22:40
@brad-decker brad-decker requested a review from a team as a code owner April 8, 2021 22:40
@brad-decker brad-decker requested a review from ryanml April 8, 2021 22:40
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Apart from the conflicts. I can re-review after those are resolved.

@brad-decker brad-decker dismissed a stale review via 1a9f286 April 12, 2021 14:52
@brad-decker brad-decker force-pushed the abstract-key-into-driver branch from fcee942 to 1a9f286 Compare April 12, 2021 14:52
@brad-decker brad-decker force-pushed the abstract-key-into-driver branch from 1a9f286 to 467121c Compare April 12, 2021 15:13
Copy link
Member

@Gudahtt Gudahtt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@metamaskbot
Copy link
Collaborator

Builds ready [467121c]
Page Load Metrics (634 ± 57 ms)
PlatformPageMetricMin (ms)Max (ms)Average (ms)StandardDeviation (ms)MarginOfError (ms)
ChromeHomefirstPaint469464126
domContentLoaded35177063311857
load35277163411857
domInteractive35176963311857

@brad-decker brad-decker merged commit 2f4e377 into develop Apr 12, 2021
@brad-decker brad-decker deleted the abstract-key-into-driver branch April 12, 2021 15:32
@github-actions github-actions bot locked and limited conversation to collaborators Apr 12, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants