-
-
Notifications
You must be signed in to change notification settings - Fork 85
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
[plugin-web-app] Add mobile emulation steps #4656
Conversation
@@ -1353,6 +1353,45 @@ Then value `$value` is selected in slider located by `$locator` | |||
Then value `50` is selected in slider located by `id(test_slider)` | |||
---- | |||
|
|||
=== Emulation steps |
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.
=== Emulation steps | |
=== Mobile Emulation |
|
||
==== Override device metrics | ||
|
||
Overrides the values of device screen dimensions. |
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.
which browsers are supported?
what is an effect of this step execution?
the same for the step clearing metrics
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.
It turns out these steps are supported only on chrome browser, for other browsers:
- non-chromium browser like safari: class case exception during augumentation
- chromium browsers: Exception in thread "main" org.openqa.selenium.UnsupportedCommandException: unknown command: unknown command: session/6f209346788418b9ce82c8619162e1df/goog/cdp/execute
|
||
[source,gherkin] | ||
---- | ||
When I override device metrics:`$deviceMetrics` |
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.
When I override device metrics:`$deviceMetrics` | |
When I configure mobile device emulation:`$deviceMetrics` |
|
||
[source,gherkin] | ||
---- | ||
When I clear device metrics |
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.
When I clear device metrics | |
When I clear configuration of mobile device emulation |
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.
too cumbersome
import org.vividus.selenium.IWebDriverProvider; | ||
import org.vividus.util.json.JsonUtils; | ||
|
||
public class EmulationSteps |
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.
public class EmulationSteps | |
public class MobileEmulationSteps |
|
||
private void executeCdpCommand(String command, Map<String, Object> metrics) | ||
{ | ||
HasCdp hasCdp = webDriverProvider.getUnwrapped(HasCdp.class); |
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.
what if this interface is not implemented? what will the error be?
Qodana Community for JVMIt seems all right 👌 No new problems were found according to the checks applied 💡 Qodana analysis was run in the pull request mode: only the changed files were checked Contact Qodana teamContact us at [email protected]
|
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #4656 +/- ##
============================================
+ Coverage 89.13% 97.39% +8.25%
- Complexity 6778 6782 +4
============================================
Files 914 915 +1
Lines 18819 18832 +13
Branches 1253 1253
============================================
+ Hits 16774 18341 +1567
+ Misses 1917 384 -1533
+ Partials 128 107 -21 ☔ View full report in Codecov by Sentry. |
acd6de7
to
dce419c
Compare
|
||
==== Emulate mobile device | ||
|
||
Emulates mobile device using provided configuration. |
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.
Emulates mobile device using provided configuration. | |
Emulates mobile device using the provided configuration. |
When I emulate mobile device with configuration:`$deviceMetrics` | ||
---- | ||
|
||
* `$deviceMetrics` - The JSON containing device metrics to override, please see https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride[available metrics]. |
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.
* `$deviceMetrics` - The JSON containing device metrics to override, please see https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride[available metrics]. | |
* `$deviceMetrics` - The JSON containing https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride[device metrics] to override. |
|
||
==== Reset mobile device emulation | ||
|
||
Resets the mobile device emulation returning browser screen to its initial state. |
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.
Resets the mobile device emulation returning browser screen to its initial state. | |
Resets the mobile device emulation returning the browser to its initial state. |
When I reset mobile device emulation | ||
---- | ||
|
||
.Clears device metrics to default |
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.
.Clears device metrics to default | |
.Resets device metrics to defaults |
* Emulates mobile device using provided configuration. | ||
* | ||
* <p> | ||
* <strong>The step is only supported in Chrome browser.</strong> |
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.
* <strong>The step is only supported in Chrome browser.</strong> | |
* <strong>The step is only supported by Chrome browser.</strong> |
?
@When("I reset mobile device emulation") | ||
public void clearDeviceMetrics() | ||
{ | ||
executeCdpCommand("Emulation.clearDeviceMetricsOverride", Map.of()); |
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.
what if the browser was started in mobile emulation mode?
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.
it will reset the mobile emulation, even if we have mobile emulation profile activated, technically the initial state of the browser doesn't include mobile emulation, its turned on after the browser is loaded
df997b6
to
c16840b
Compare
c16840b
to
bf52d02
Compare
Kudos, SonarCloud Quality Gate passed! |
No description provided.