Skip to content

Commit 7f845cb

Browse files
ktranDevtools-frontend LUCI CQ
authored andcommitted
Add device emulation test to check for pixel ratios on new device
This is going to replace a layout test: http/tests/devtools/a11y-axe-core/settings/emulated-device-a11y-test.js Bug: 368238837 Change-Id: I143877e86091982c87daebd29a3edd15979bd409 Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/5952205 Reviewed-by: Simon Zünd <[email protected]> Commit-Queue: Simon Zünd <[email protected]> Auto-Submit: Kim-Anh Tran <[email protected]>
1 parent 8baf957 commit 7f845cb

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

test/e2e/emulation/custom-devices_test.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,4 +225,22 @@ describe('Custom devices', () => {
225225
assert.strictEqual(await elementTextContent(fitButton), 'Fit to window (51%)');
226226
assert.strictEqual(await elementTextContent(zoomButton), '100%');
227227
});
228+
229+
it('shows an error if the pixel ratio is not a number', async () => {
230+
await selectEdit();
231+
await click(ADD_DEVICE_BUTTON_SELECTOR);
232+
await waitFor(FOCUSED_DEVICE_NAME_FIELD_SELECTOR);
233+
await typeText('Prime numbers');
234+
235+
await tabForward(); // Focus width.
236+
await typeText('700');
237+
await tabForward(); // Focus height.
238+
await typeText('400');
239+
await tabForward(); // Focus DPR.
240+
await typeText('zzz.213213');
241+
242+
const error = await waitFor('.list-widget-input-validation-error');
243+
const errorText = await error.evaluate(element => element.textContent);
244+
assert.strictEqual(errorText, 'Device pixel ratio must be a number or blank.');
245+
});
228246
});

0 commit comments

Comments
 (0)