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: CSS selector for iOS #1274

Merged
merged 6 commits into from
Feb 1, 2021
Merged

feat: CSS selector for iOS #1274

merged 6 commits into from
Feb 1, 2021

Conversation

dpgraham
Copy link
Contributor

Copies the same logic as what was done in UiAutomator2 Driver but makes some changes to make it work with iOS Class Chain.

@dpgraham dpgraham changed the title CSS selector for iOS feat: CSS selector for iOS Jan 31, 2021
package.json Outdated Show resolved Hide resolved
@mykola-mokhnach
Copy link
Contributor

It would make sense to add this locator to README

@dpgraham
Copy link
Contributor Author

@mykola-mokhnach the README.md doesn't talk about selectors. I'll add this to the Appium site docs.

@@ -0,0 +1,61 @@
import chai from 'chai';
Copy link
Member

Choose a reason for hiding this comment

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

👍

*/
function parsePseudo (cssPseudo) {
if (cssPseudo.valueType && cssPseudo.valueType !== 'string') {
throw new Error(`'${cssPseudo.name}=${cssPseudo.value}'. ` +
Copy link
Contributor

Choose a reason for hiding this comment

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

TypeError

iosClassChainSelector += `/${parseCssRule(cssRule.rule)}`;
}

if (cssRule.nestingOperator === '>') {
Copy link
Contributor

Choose a reason for hiding this comment

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

how about using a ternary operator?

if (cssRule.nestingOperator === '>') {
return iosClassChainSelector;
} else {
return `**/` + iosClassChainSelector;
Copy link
Contributor

Choose a reason for hiding this comment

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

`**/${iosClassChainSelector}`

@dpgraham dpgraham merged commit 047d3a8 into master Feb 1, 2021
@dpgraham dpgraham deleted the dpgraham-ios-css-selector branch February 1, 2021 19:55
github-actions bot pushed a commit that referenced this pull request Feb 1, 2021
# [3.36.0](v3.35.1...v3.36.0) (2021-02-01)

### Features

* CSS selector for iOS ([#1274](#1274)) ([047d3a8](047d3a8))
@github-actions
Copy link
Contributor

github-actions bot commented Feb 1, 2021

🎉 This PR is included in version 3.36.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

khanayan123 pushed a commit to khanayan123/appium-xcuitest-driver that referenced this pull request May 10, 2021
khanayan123 pushed a commit to khanayan123/appium-xcuitest-driver that referenced this pull request May 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants