-
Notifications
You must be signed in to change notification settings - Fork 11
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
[Form] Don't reset value, if the target input is non-ddg or unknown #748
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
import { expect } from '@playwright/test'; | ||
import { mockedCalls } from '../harness.js'; | ||
|
||
/** | ||
* A wrapper around interactions for `integration-test/pages/address-form.html` | ||
* | ||
* @param {import("@playwright/test").Page} page | ||
*/ | ||
export function addressPage(page) { | ||
class AddressPage { | ||
/** | ||
* @return {Promise<void>} | ||
*/ | ||
async navigate() { | ||
await page.goto('integration-test/pages/address-form.html'); | ||
} | ||
|
||
/** | ||
* Fill in all address form fields | ||
*/ | ||
async fillAddressForm(data) { | ||
await page.fill('#firstName', data.firstName); | ||
await page.fill('#lastName', data.lastName); | ||
await page.fill('#address1', data.addressStreet); | ||
await page.fill('#address2', data.addressStreet2); | ||
await page.fill('#city', data.addressCity); | ||
await page.fill('#state', data.addressProvince); | ||
await page.fill('#postalCode', data.addressPostalCode); | ||
await page.fill('#country', data.addressCountryCode); | ||
await page.fill('#phone', data.phone); | ||
await page.fill('#notes', data.notes); | ||
} | ||
|
||
async submitFormViaTextbox() { | ||
const textbox = await page.$('#notes'); | ||
await textbox?.focus(); | ||
await page.keyboard.down('Enter'); | ||
} | ||
|
||
async shouldNotPromptToSave() { | ||
const mockCalls = await mockedCalls(page, { names: ['storeFormData'], minCount: 0 }); | ||
expect(mockCalls.length).toBe(0); | ||
} | ||
} | ||
|
||
return new AddressPage(); | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,79 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
<title>Address Form Test</title> | ||
<link rel="stylesheet" href="style.css"> | ||
</head> | ||
<body> | ||
<div class="container"> | ||
<form id="addressForm" method="POST" action="#"> | ||
<h2>Test address form, with an arbitrary text field</h2> | ||
<p>This form is used to test the address form, with an arbitrary text field</p> | ||
|
||
<!-- Name Fields --> | ||
<div class="form-group"> | ||
<label for="firstName">First Name</label> | ||
<input type="text" id="firstName" name="firstName" autocomplete="given-name" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="lastName">Last Name</label> | ||
<input type="text" id="lastName" name="lastName" autocomplete="name" required> | ||
</div> | ||
|
||
<!-- Address Fields --> | ||
<div class="form-group"> | ||
<label for="address1">Address Line 1</label> | ||
<input type="text" id="address1" name="address1" autocomplete="address-line1" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="address2">Address Line 2</label> | ||
<input type="text" id="address2" name="address2" autocomplete="address-line2"> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="city">City</label> | ||
<input type="text" id="city" name="city" autocomplete="address-level2" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="state">State/Province</label> | ||
<input type="text" id="state" name="state" autocomplete="address-level1" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="postalCode">Postal Code</label> | ||
<input type="text" id="postalCode" name="postalCode" autocomplete="postal-code" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="country">Country</label> | ||
<input type="text" id="country" name="country" autocomplete="country" required> | ||
</div> | ||
|
||
<div class="form-group"> | ||
<label for="phone">Phone Number</label> | ||
<input type="tel" id="phone" name="phone" autocomplete="tel"> | ||
</div> | ||
|
||
<!-- Additional Random Text Field --> | ||
<div class="form-group"> | ||
<label for="notes">Random Notes</label> | ||
<textarea id="notes" name="notes"></textarea> | ||
</div> | ||
|
||
<button type="submit">Save Address</button> | ||
</form> | ||
</div> | ||
<script type="module"> | ||
[...document.forms].forEach((form) => { | ||
form.addEventListener("submit", (e) => { | ||
e.preventDefault(); | ||
}) | ||
}) | ||
</script> | ||
</body> | ||
</html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think playwright is a very good candidate here. It's a very special user interaction that can be replicated with it, and we don't seem to have a similar form.