-
Notifications
You must be signed in to change notification settings - Fork 16
feat(testing): add wdi5 e2e scope #23
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
Open
vobu
wants to merge
16
commits into
SAP-samples:testing
Choose a base branch
from
vobu:testing-wdi5
base: testing
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
22c61f5
Adapt to "ts-types-esm" -> "types" renaming
akudev c5d4fce
Update dependencies (incl. UI5 1.116.0 / DT Types 1.116.1)
petermuessig 8cbf86f
chore(deps): wdi5 related
vobu 02e2a49
chore(eslint): extend with wdi5 ts flavor
vobu 075d604
feat(wdi5): add mvp artifacts
vobu 8d7a79d
chore(deps): bump
vobu eb31920
Merge remote-tracking branch 'upstream/main' into testing-wdi5
vobu 6149c8b
chore(deps): bump
vobu b69cfbc
feat: wdi5 test
vobu a4b6851
docs: end-to-end tests
vobu 33925d5
test(e2e): better verbosity
vobu 9ee8ac5
fix: openui5 types
vobu 2f171ac
refactor: semicolons
vobu 579c929
fix(deps): re-added ts
vobu 0f16f92
chore(deps): maintenance bump
vobu d69534d
refactor: better assertion
vobu 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
---|---|---|
|
@@ -81,11 +81,11 @@ Now, let's get the TypeScript compiler and the UI5 type definitions: | |
npm install --save-dev typescript @types/[email protected] | ||
``` | ||
|
||
When you are developing a SAPUI5 application (i.e. also using control libraries which are not available in OpenUI5), use the `@sapui5/ts-types-esm` types instead of the `@types/openui5` ones. | ||
When you are developing a SAPUI5 application (i.e. also using control libraries which are not available in OpenUI5), use the `@sapui5/types` types instead of the `@types/openui5` ones. | ||
|
||
> **Remark:** There are also `@openui5/ts-types-esm` types available - how do they differ from the `@types/openui5` ones?<br> | ||
The one difference is in versioning: while the types in the `@openui5` namespace are exactly in sync with the respective OpenUI5 patch release, the ones in the `@types` namespace follow the DefinitelyTyped versioning and are only released *once* per minor release of OpenUI5 ([more details here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/openui5#versioning)), not for every patch. In practice it shouldn't make any difference what you use, but note that in the `@types` namespace there is usually only the `*.*.0` patch release available.<br> | ||
The other small difference is [described in detail here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/openui5#jquery-and-qunit-references-and-their-versions). In essence, UI5 declares the jQuery and QUnit types as dependencies to make sure the type definitions are also loaded because types from those libraries are in some places exposed in UI5 APIs. The difference is that for `@types/openui5` the *latest* version of those types is referenced and for `@openui5/ts-types-esm` the *best matching* version is referenced. But in practice also this difference should not be something to worry about. To enforce using a specific version of the jQuery/QUnit types with the `@types/openui5` type definitions, you can always do e.g.: | ||
> **Remark:** There are also `@openui5/types` types available - how do they differ from the `@types/openui5` ones?<br> | ||
The content is basically the same, one difference is in versioning: while the types in the `@openui5` namespace are exactly in sync with the respective OpenUI5 patch release, the ones in the `@types` namespace follow the DefinitelyTyped versioning and are only released *once* per minor release of OpenUI5 ([more details here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/openui5#versioning)), not for every patch. In practice it shouldn't make any difference what you use, but note that in the `@types` namespace there is usually only the `*.*.0` patch release available.<br> | ||
The other small difference is [described in detail here](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/openui5#jquery-and-qunit-references-and-their-versions). In essence, UI5 declares the jQuery and QUnit types as dependencies to make sure the type definitions are also loaded because types from those libraries are in some places exposed in UI5 APIs. The difference is that for `@types/openui5` the *latest* version of those types is referenced and for `@openui5/types` the *best matching* version is referenced. But in practice also this difference should not be something to worry about. To enforce using a specific version of the jQuery/QUnit types with the `@types/openui5` type definitions, you can always do e.g.: | ||
> ```sh | ||
> npm install --save-dev @types/[email protected] @types/[email protected] | ||
> ``` | ||
|
@@ -127,18 +127,16 @@ So we need to add a `tsconfig.json` configuration file to configure the right la | |
} | ||
``` | ||
|
||
> **Note:** when you use the `@sapui5/ts-types-esm` (or `@openui5/ts-types-esm`) types instead, you need to add the following section to tsconfig.json: | ||
> **Note:** when you use the `@sapui5/types` (or `@openui5/types`) types instead, you need to add the following section to tsconfig.json: | ||
> | ||
> ```json | ||
> "typeRoots": [ | ||
> "./node_modules/@types" | ||
> ], | ||
> "types": [ | ||
> "@sapui5/ts-types-esm" | ||
> "./node_modules/@types", | ||
> "./node_modules/@sapui5/types" | ||
> ], | ||
>``` | ||
> | ||
> Why? TypeScript automatically finds all type definition files in a dependency starting with `@types/...` (i.e. all `.d.ts` files in `node_modules/@types/...`). The jQuery d.ts files are there and found, but the SAPUI5 types are only available in a package starting with `@sapui5/...`, hence TypeScript must be explicitly pointed to these types. As this disables the automatic loading of other types from `node_modules/@types/...`, this path must be given as a type root. | ||
> Why? TypeScript automatically finds all type definition files in a dependency starting with `@types/...` (i.e. all `.d.ts` files in `node_modules/@types/...`). The jQuery d.ts files are there and found, but the SAPUI5 types are only available in a package starting with `@sapui5/...`, hence TypeScript must be explicitly pointed to these types. As this disables the automatic loading of other types from `node_modules/@types/...`, this path must also be given as a type root. | ||
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. Hm, after removing the "types" section, this sentence does no longer apply. However, I think the current recommendation is using |
||
|
||
There are additional settings in this file, e.g. telling the compiler which files to compile (all matching `./webapp/**/*`) and how the modules should be resolved (`"moduleResolution": "node"`). And a couple of compiler options which are not so important right now. They determine how exactly the compiler behaves. The "paths" section informs TypeScript about the mapping of namespaces used in the app. | ||
|
||
|
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,17 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
import AppPage from "./pages/AppPage"; | ||
|
||
describe("Hello!", () => { | ||
it("Should open the Hello dialog", async () => { | ||
await AppPage.iPressTheSayHelloWithDialogButton(); | ||
const dialogVisible = await AppPage.iShouldSeeTheHelloDialog(); | ||
expect(dialogVisible).toBeTruthy(); | ||
}); | ||
|
||
it("Should close the Hello dialog", async () => { | ||
await AppPage.iPressTheOkButtonInTheDialog(); | ||
const dialogNotVisible = await AppPage.iShouldNotSeeTheHelloDialog(); | ||
expect(dialogNotVisible).toBeTruthy(); | ||
}); | ||
}); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* eslint-disable @typescript-eslint/no-unsafe-return */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-call */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-member-access */ | ||
/* eslint-disable @typescript-eslint/no-unsafe-assignment */ | ||
import Button from "sap/m/Button"; | ||
import MessageBox from "sap/m/MessageBox"; | ||
|
||
import { buttonLocator, dialogLocator, OKButtonLocator } from "./locators"; | ||
|
||
class AppPage { | ||
async iPressTheSayHelloWithDialogButton() { | ||
const button = await browser.asControl<Button>(buttonLocator); | ||
await button.press(); | ||
} | ||
|
||
async iShouldSeeTheHelloDialog(): Promise<boolean> { | ||
const dialog = await browser.asControl<MessageBox>(dialogLocator); | ||
return await dialog.getVisible<boolean>(); | ||
} | ||
|
||
async iPressTheOkButtonInTheDialog() { | ||
await browser.asControl(OKButtonLocator).press(); | ||
} | ||
|
||
async iShouldNotSeeTheHelloDialog(): Promise<boolean> { | ||
const dialog = await browser.asControl<MessageBox>(dialogLocator); | ||
// this returns "null" as the message box is not | ||
// part of the DOM after being close, so | ||
// no methods can be executed on the control | ||
const visible = await dialog.isInitialized(); | ||
return visible; | ||
} | ||
} | ||
|
||
export default new AppPage(); |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export const buttonLocator = { | ||
selector: { | ||
id: "container-ui5.typescript.helloworld---app--helloButton" | ||
} | ||
}; | ||
|
||
export const dialogLocator = { | ||
selector: { | ||
controlType: "sap.m.Dialog", | ||
properties: { | ||
type: "Message" | ||
}, | ||
searchOpenDialogs: true | ||
} | ||
}; | ||
|
||
export const OKButtonLocator = { | ||
selector: { | ||
controlType: "sap.m.Button", | ||
properties: { | ||
text: "OK" | ||
}, | ||
searchOpenDialogs: true | ||
} | ||
}; |
This file contains hidden or 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 |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"compilerOptions": { | ||
"moduleResolution": "node", | ||
"types": ["node", "@types/openui5", "@wdio/globals/types", "@wdio/mocha-framework", "wdio-ui5-service/esm"], | ||
"target": "es2019" | ||
} | ||
} |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.