Skip to content
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

feat: add nativeWebTapStrict cap #1186

Merged
merged 4 commits into from
Mar 25, 2020
Merged

Conversation

imurchie
Copy link
Contributor

Add a capability, nativeWebTapStrict, which skips the attempt to not convert the web coordinates. See appium/appium#14084

First, this makes sure the web coordinate conversion works for newer devices.

const [portraitHeight, portraitWidth] = height > width ? [height, width] : [width, height];
return (portraitHeight === IPHONE_X_HEIGHT && portraitWidth === IPHONE_X_WIDTH) ||
(portraitHeight === IPHONE_XR_HEIGHT && portraitWidth === IPHONE_XR_WIDTH);
extensions.getSafariDeviceSize = _.memoize(async function getSafariDeviceSize () {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what if screen orientation gets changed during the test?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is just for deciding on the device, and it is normalized to portrait. So it does not matter.

extensions.getSafariIsNotched = _.memoize(async function getSafariIsNotched () {
try {
const {width, height} = await this.getSafariDeviceSize();
for (const device of NOTCHED_DEVICE_SIZES) {
Copy link
Contributor

@mykola-mokhnach mykola-mokhnach Mar 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

return NOTCHED_DEVICE_SIZES.some(({w, h}) => w === width && h === height)

return await this.proxyCommand('/appium/settings', 'POST', {
settings: {[key]: value}
});
}
this.opts.nativeWebTap = !!value;
this.opts[key] = !!value;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure this is not going to break anything...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only two keys that get through to here are the native web tap ones. This is not a problem.

@mykola-mokhnach
Copy link
Contributor

mykola-mokhnach commented Mar 24, 2020

IMHO, this all logic that we implement on the driver level could be moved to WDA under a custom endpoint. This could speed up the execution a lot, because each proxy call requires additional time (and click method is called pretty often). Also, inside WDA we don't have to hardcode many magic constant, but retrieve them directly from the system instead.

@imurchie
Copy link
Contributor Author

Feel free to implement it there.

This should all be a last resort anyway. Most of the time atoms are a better way to do things in the web context.

@@ -217,7 +217,10 @@ let desiredCapConstraints = _.defaults({
},
appPushTimeout: {
isNumber: true
}
},
nativeWebTapStrict: {
Copy link
Member

@KazuCocoa KazuCocoa Mar 25, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add in readme, too?

@imurchie imurchie merged commit f2ef0a9 into appium:master Mar 25, 2020
khanayan123 pushed a commit to khanayan123/appium-xcuitest-driver that referenced this pull request May 10, 2021
* fix: make sure native web tap works with full conversion works for newer devices

* fix: better way of checking notch

* feat: add nativeWebTapStrict cap

* fix: work on failing test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants