mirror of
https://github.com/microsoft/playwright.git
synced 2024-12-14 05:37:20 +03:00
fix(types): add missing properties to DeviceDescriptor (#3332)
This commit is contained in:
parent
83ac3f43f3
commit
c9409bf1b3
8
utils/generate_types/overrides.d.ts
vendored
8
utils/generate_types/overrides.d.ts
vendored
@ -168,7 +168,13 @@ export interface CDPSession {
|
||||
): Promise<Protocol.CommandReturnValues[T]>;
|
||||
}
|
||||
|
||||
type DeviceDescriptor = {viewport: BrowserNewContextOptionsViewport, userAgent: string};
|
||||
type DeviceDescriptor = {
|
||||
viewport: BrowserNewContextOptionsViewport;
|
||||
userAgent: string;
|
||||
deviceScaleFactor: number;
|
||||
isMobile: boolean;
|
||||
hasTouch: boolean;
|
||||
};
|
||||
|
||||
export namespace errors {
|
||||
|
||||
|
@ -714,11 +714,17 @@ playwright.chromium.launch().then(async browser => {
|
||||
{
|
||||
playwright.devices['my device'] = {
|
||||
userAgent: 'foo',
|
||||
viewport: {height: 123, width: 456}
|
||||
viewport: {height: 123, width: 456},
|
||||
deviceScaleFactor: 1,
|
||||
hasTouch: false,
|
||||
isMobile: true,
|
||||
};
|
||||
const iPhone = playwright.devices['iPhone 11'];
|
||||
const assertion: AssertType<string, typeof iPhone.userAgent> = true;
|
||||
const numberAssertion: AssertType<number, typeof iPhone.viewport.width> = true;
|
||||
const widthAssertion: AssertType<number, typeof iPhone.viewport.width> = true;
|
||||
const deviceScaleFactorAssertion: AssertType<number, typeof iPhone.deviceScaleFactor> = true;
|
||||
const hasTouchAssertion: AssertType<boolean, typeof iPhone.hasTouch> = true;
|
||||
const isMobileAssertion: AssertType<boolean, typeof iPhone.isMobile> = true;
|
||||
}
|
||||
{
|
||||
const agents = playwright.devices.map(x => x.userAgent);
|
||||
|
Loading…
Reference in New Issue
Block a user