Skip to content

Commit

Permalink
Merge branch 'main' of github.com:js-soft/wdi5 into main
Browse files Browse the repository at this point in the history
  • Loading branch information
Siolto committed Jul 4, 2022
2 parents 775b7d3 + 8ab2f89 commit 4a578d7
Show file tree
Hide file tree
Showing 10 changed files with 162 additions and 106 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ dist/**/*

# multi-version test artifacts
examples/ui5-js-app/wdio-wdi5*
examples/ui5-js-app/e2e-test-config/wdio-wdi5*
examples/ui5-js-app/webapp/index-*.html
examples/ui5-js-app/dist/**/*

Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,15 @@

All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.

### 0.9.7 (2022-07-04)


### Bug Fixes

* remove typo from error handling ([#297](https://github.com/js-soft/wdi5/issues/297)) ([d549c74](https://github.com/js-soft/wdi5/commit/d549c747f15c750d94884cefbb497c866ce5133c))

### 0.9.6 (2022-06-29)

### 0.9.5 (2022-06-24)


Expand Down
11 changes: 5 additions & 6 deletions client-side-js/executeControlMethod.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,16 +42,14 @@ async function clientSide_executeControlMethod(webElement, methodName, browserIn
returnType: "none"
})
} else {
// result mus be a primitive
if (window.wdi5.isPrimitive(result)) {
// getter
done({ status: 0, result: result, returnType: "result" })
} else if (
// we have an object that is not a UI5 control
typeof result === "object" &&
result !== null &&
// wdi5 returns a wdi5 control if the UI5 api return its control
// allows method chaining
!(result instanceof sap.ui.core.Control)
!(result instanceof sap.ui.core.Control) &&
!(result instanceof sap.ui.core.Item)
) {
// flatten the prototype so we have all funcs available
const collapsed = window.wdi5.collapseObject(result)
Expand All @@ -66,7 +64,8 @@ async function clientSide_executeControlMethod(webElement, methodName, browserIn
nonCircularResultObject: collapsedAndNonCyclic
})
} else {
// check if of control to verify if the method result is a different control
// we got ourselves a regular UI5 control
// check that we're not working against ourselves :)
if (result && result.getId && oControl.getId() !== result.getId()) {
// ui5 function like get parent might return another ui5 control -> return it to check with this wdi5 instance
result = window.wdi5.createControlId(result)
Expand Down
2 changes: 1 addition & 1 deletion examples/fe-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"@wdio/mocha-framework": "^7.19.7",
"@wdio/selenium-standalone-service": "^7.19.5",
"@wdio/spec-reporter": "^7.19.7",
"chromedriver": "^101.0.0",
"chromedriver": "^103.0.0",
"wdio-chromedriver-service": "^7.3.2",
"wdio-ui5-service": "*"
},
Expand Down
7 changes: 3 additions & 4 deletions examples/ui5-js-app/e2e-test-config/wdi5-multiversion.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,15 @@ const path = require("path")
const replace = require("replace-in-file")
const Launcher = require("@wdio/cli").default

// lts version - with 1.71.19 being the exception
// in that there seems to be stuff boken in ui5 > 1.71.19 <= 1.71.25
// lts versions (> 1.60)
// empty string will get the newest Version which can be a "SNAPSHOT" version
const versions = ["", "1.71.19", "1.84.3"]
const versions = ["", "1.71", "1.84", "1.96"]

;(async () => {
for (const version of versions) {
// create an index.html for bootstrapping per version
const targetIndex = path.resolve(__dirname, `../webapp/index-${version}.html`)
const bootstrapSrc = `https://openui5nightly.hana.ondemand.com/${version}/resources/sap-ui-core.js`
const bootstrapSrc = `https://ui5.sap.com/${version}/resources/sap-ui-core.js`
fsExtra.copySync(path.resolve(__dirname, `../webapp/index.html`), targetIndex)
const optionsIndex = {
files: targetIndex,
Expand Down
4 changes: 2 additions & 2 deletions examples/ui5-js-app/e2e-test-config/wdio.base.conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,15 +26,15 @@ exports.baseConfig = {
baseUrl: "http://localhost:8888",

waitforTimeout: 10000,
connectionRetryTimeout: 120000,
connectionRetryTimeout: process.argv.indexOf("--debug") > -1 ? 1200000 : 120000,
connectionRetryCount: 3,

services: ["chromedriver", "ui5"],

framework: "mocha",
mochaOpts: {
ui: "bdd",
timeout: 60000
timeout: process.argv.indexOf("--debug") > -1 ? 600000 : 60000
},
reporters: ["spec"]
}
29 changes: 29 additions & 0 deletions examples/ui5-js-app/webapp/test/e2e/locators-basic.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,33 @@ describe("mixed locators", () => {
wdi5.getLogger().log("retrievedClassNameStatus", retrievedClassNameStatus)
expect(retrievedClassNameStatus).toBeTruthy()
})

// #291
it("should find a sap.m.Select and get an entry", async () => {
const selector = {
selector: {
interaction: "root",
controlType: "sap.m.Select",
viewName
}
}
/**
* @type {import("sap/m/Select").default}
*/
const select = await browser.asControl(selector)
await select.open() // <- meh, but needed to have the select items in the DOM
// alternative:
// await browser.asControl({
// "controlType": "sap.m.Select"
// "interaction": {
// "idSuffix": "arrow"
// }
// }).press()
const selectedItem = await select.getSelectedItem()
const text = await selectedItem.getText()
expect(text).toEqual("Algeria")

const textViaFluentApi = await browser.asControl(selector).getSelectedItem().getText()
expect(textViaFluentApi).toEqual("Algeria")
})
})
166 changes: 91 additions & 75 deletions examples/ui5-js-app/webapp/view/Main.view.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,87 +13,103 @@
<Text text="{LatestUI5>/latest}" />
</headerContent>
<content>
<VBox alignItems="Center"
justifyContent="Center"
height="100%">
<Title level="H1"
id="Title::NoAction.h1"
titleStyle="H1"
text="{i18n>startPage.title.text}"
width="100%"
textAlign="Center" />
<Button icon="sap-icon://forward"
id="NavFwdButton"
text="{i18n>startPage.navButton.text}"
press="navFwd" />
<Button icon="sap-icon://forward"
id="NavFwdButtonDisabled"
text="can't click :("
press="navFwd"
busy="true" />
<Button icon="sap-icon://user-edit"
id="user-test-button"
text="{i18n>startPage.userButton.text}" />
<Button text="IA Sync"
id="idIaSync"
press="onPress" />
<Text text="{i18n>startPage.text.username}" />
<Input id="mainUserInput"
value="{/Customers('TRAIH')/ContactName}" />
<Panel expandable="true"
headerText="Header Text">
<headerToolbar>
<OverflowToolbar>
<Title text="Custom Toolbar with a header text" />
</OverflowToolbar>
</headerToolbar>
<content>
<Text text="Lorem ipsum dolor st amet" />
</content>
</Panel>
<Label labelFor="idDateTime"
text="labelFor DateTimePicker" />
<DateTimePicker id="idDateTime"
placeholder="Enter Date ..." />
<Button text="{testModel>/buttonText}"
press="onTest"
class="myTestClass" />
<Input value="{testModel>/inputValue}" />
<CheckBox id="idCheckbox"
selected="{testModel>/checkbox}"
text="test checkbox"
select="onSelect" />
<Button text="open Barcodescanner"
press="scanBarcode"
id="barcodescannerplugin" />
<Input id="barcodeValue"
value="{testModel>/barcode}" />
<Input id="invisibleInputField"
value="bla"
visible="false" />
<Button text="open Dialog"
press="openDialog"
id="openDialogButton" />
<Label text="Country Combobox"/>
<ComboBox
id="combobox"
items="{
<Title level="H1"
id="Title::NoAction.h1"
titleStyle="H1"
text="{i18n>startPage.title.text}"
width="100%"
textAlign="Center" />
<HBox>
<VBox alignItems="Center"
justifyContent="Center"
height="100%">

<Button icon="sap-icon://forward"
id="NavFwdButton"
text="{i18n>startPage.navButton.text}"
press="navFwd" />
<Button icon="sap-icon://forward"
id="NavFwdButtonDisabled"
text="can't click :("
press="navFwd"
busy="true" />
<Button icon="sap-icon://user-edit"
id="user-test-button"
text="{i18n>startPage.userButton.text}" />
<Button text="IA Sync"
id="idIaSync"
press="onPress" />
<Text text="{i18n>startPage.text.username}" />
<Input id="mainUserInput"
value="{/Customers('TRAIH')/ContactName}" />
<Panel expandable="true"
headerText="Header Text">
<headerToolbar>
<OverflowToolbar>
<Title text="Custom Toolbar with a header text" />
</OverflowToolbar>
</headerToolbar>
<content>
<Text text="Lorem ipsum dolor st amet" />
</content>
</Panel>
<Label labelFor="idDateTime"
text="labelFor DateTimePicker" />
<DateTimePicker id="idDateTime"
placeholder="Enter Date ..." />
<Button text="{testModel>/buttonText}"
press="onTest"
class="myTestClass" />
<Input value="{testModel>/inputValue}" />
<CheckBox id="idCheckbox"
selected="{testModel>/checkbox}"
text="test checkbox"
select="onSelect" />
<Button text="open Barcodescanner"
press="scanBarcode"
id="barcodescannerplugin" />
<Input id="barcodeValue"
value="{testModel>/barcode}" />
<Input id="invisibleInputField"
value="bla"
visible="false" />
<Button text="open Dialog"
press="openDialog"
id="openDialogButton" />

</VBox>
<VBox>
<Label text="Country Combobox" />
<ComboBox id="combobox"
items="{
path: 'Countries>/CountriesCollection',
sorter: { path: 'text' }
}">
<core:Item key="{Countries>key}"
text="{Countries>text}" />
</ComboBox>
<Label text="Country MultiCombobox" />
<MultiComboBox id="multiComboBox"
items="{
path: 'Countries>/CountriesCollection',
sorter: { path: 'text' }
}">
<core:Item key="{Countries>key}" text="{Countries>text}" />
</ComboBox>
<Label text="Country MultiCombobox"/>
<MultiComboBox id="multiComboBox"
items="{
<core:Item key="{Countries>key}"
text="{Countries>text}" />
</MultiComboBox>
<!-- TODO -->
<!-- <SearchField id="idSearchfield" value="{testModel>/searchValue}"/> -->
<Label text="sap.m.Select" />
<Select id="select"
items="{
path: 'Countries>/CountriesCollection',
sorter: { path: 'text' }
}">
<core:Item key="{Countries>key}" text="{Countries>text}" />
</MultiComboBox>
<!-- TODO -->
<!-- <SearchField id="idSearchfield" value="{testModel>/searchValue}"/> -->
</VBox>
<core:Item key="{Countries>key}"
text="{Countries>text}" />
</Select>
</VBox>
</HBox>
</content>
</Page>

Expand Down
Loading

0 comments on commit 4a578d7

Please sign in to comment.