-
-
Notifications
You must be signed in to change notification settings - Fork 43
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
Enable special characters in UI5 control ids #159
Merged
Merged
Changes from 2 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
cc7e5f5
feat(118): change wdio id selector to xpath
dominikfeininger 787e9e6
feat: basic selector validation
dominikfeininger c9d1b2e
fix: test
dominikfeininger d131bba
style: apply perttier
dominikfeininger 65c7a07
refactor: extract selector validation function
dominikfeininger 4570d79
fix: test for selector validation
dominikfeininger b7d0615
fix: test for selector validation
dominikfeininger 2e68f6b
fix: test for selector validation
dominikfeininger 7e2904a
fix(docs): comments of pr, ts types etc
dominikfeininger File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,4 +9,43 @@ describe("ui5 basic", () => { | |
const title = await browser.getTitle() | ||
expect(title).toEqual("Sample UI5 Application") | ||
}) | ||
|
||
// #118 | ||
it('should use a control selector with dots and colons', async () => { | ||
const selector = { | ||
selector: { | ||
id: 'Title::NoAction.h1', | ||
viewName: "test.Sample.view.Main" | ||
} | ||
}; | ||
|
||
// ui5 | ||
const titleWUi5 = await browser.asControl(selector).getText(); | ||
|
||
// working webdriver example with xpath id selector | ||
const titleElement = await $('//*[@id="container-Sample---Main--Title::NoAction.h1"]'); | ||
const titleWwdio = await titleElement.getText(); | ||
|
||
expect(titleWUi5).toEqual('UI5 demo'); | ||
expect(titleWwdio).toEqual('UI5 demo'); | ||
}); | ||
|
||
it.only('check for invalid control selector', async () => { | ||
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. rm .only |
||
const selector1 = { | ||
selector_: { | ||
test: "some.test.string" | ||
} | ||
}; | ||
|
||
const selector2 = { | ||
id: "some.test.string" | ||
}; | ||
|
||
const invalidControl1 = await browser.asControl(selector1) | ||
const invalidControl2 = await browser.asControl(selector2) | ||
|
||
expect(invalidControl1).toEqual("specified selector is not valid -> abort") | ||
expect(invalidControl2).toEqual("specified selector is not valid -> abort") | ||
|
||
}); | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,6 +142,20 @@ function _createWdioUI5KeyFromSelector(selector: wdi5Selector): string { | |
|
||
export async function addWdi5Commands() { | ||
browser.addCommand("_asControl", async (wdi5Selector: wdi5Selector) => { | ||
if ( | ||
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 suggest to outsource this in a separate function.
|
||
!( | ||
wdi5Selector.hasOwnProperty("selector") && | ||
(wdi5Selector.selector.hasOwnProperty("id") || | ||
wdi5Selector.selector.hasOwnProperty("viewName") || | ||
wdi5Selector.selector.hasOwnProperty("bindingPath") || | ||
wdi5Selector.selector.hasOwnProperty("controlType") || | ||
wdi5Selector.selector.hasOwnProperty("properties")) | ||
) | ||
) { | ||
Logger.error("specified selector is not valid -> abort") | ||
return "specified selector is not valid -> abort" | ||
} | ||
|
||
const internalKey = wdi5Selector.wdio_ui5_key || _createWdioUI5KeyFromSelector(wdi5Selector) | ||
// either retrieve and cache a UI5 control | ||
// or return a cached version | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
please apply prettier formatting on the file :)