-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: don't reset value, if the target input is non-ddg
- Loading branch information
Showing
9 changed files
with
195 additions
and
11 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.