-
Notifications
You must be signed in to change notification settings - Fork 9.4k
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
core: add emulatedFormFactor setting #6098
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -991,8 +991,13 @@ class Driver { | |
* @return {Promise<void>} | ||
*/ | ||
async beginEmulation(settings) { | ||
// TODO(phulce): remove this flag on next breaking change | ||
if (!settings.disableDeviceEmulation) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add TODO somewhere to remove this flag in a breaking version? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done 👍 |
||
await emulation.enableNexus5X(this); | ||
if (settings.emulatedFormFactor === 'mobile') { | ||
await emulation.enableNexus5X(this); | ||
} else if (settings.emulatedFormFactor === 'desktop') { | ||
await emulation.enableDesktop(this); | ||
} | ||
} | ||
|
||
await this.setThrottling(settings, {useThrottling: true}); | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -94,7 +94,10 @@ describe('util helpers', () => { | |
it('builds device emulation string', () => { | ||
const get = opts => Util.getEmulationDescriptions(opts).deviceEmulation; | ||
assert.equal(get({disableDeviceEmulation: true}), 'No emulation'); | ||
assert.equal(get({disableDeviceEmulation: false}), 'Emulated Nexus 5X'); | ||
assert.equal(get({disableDeviceEmulation: false}), 'No emulation'); | ||
assert.equal(get({emulatedFormFactor: 'none'}), 'No emulation'); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this include the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. done :) |
||
assert.equal(get({emulatedFormFactor: 'mobile'}), 'Emulated Nexus 5X'); | ||
assert.equal(get({emulatedFormFactor: 'desktop'}), 'Emulated Desktop'); | ||
}); | ||
|
||
it('builds throttling strings when provided', () => { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -83,6 +83,7 @@ declare global { | |
gatherMode?: boolean | string; | ||
disableStorageReset?: boolean; | ||
disableDeviceEmulation?: boolean; | ||
emulatedFormFactor?: 'mobile'|'desktop'|'none'; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. makes me want to add a There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
yes pls :D There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we need to as it would be confusing if this one has a none but throttling does not. |
||
throttlingMethod?: 'devtools'|'simulate'|'provided'; | ||
throttling?: ThrottlingSettings; | ||
onlyAudits?: string[] | null; | ||
|
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.
let's set the default to mobile here in the CLI too?
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.
done!