Technical Articles
wdi5 ^1 is here!
And it‘s a big fricking deal.
Why?
Because this very first major version represents the cumulative work of all contributors – from the SAP-sponsored development that started in January, over the move into the GitHub UI5 community, up to its‘ feature-packed 1.0 release today.
Let‘s dive in 🤿 and look at the new (and enhanced and existing) features, sprinkled with some history and trivia 😝
Authentication support
Long-awaited, much tried, now here. For BTP, Office 365, Basic Auth, and custom IdP.
No FLP on-prem and SAP Build Work Zone, standard edition (f.k.a BTP Launchpad Service) – yet.
Authentication is config-time only:
// conf-file
capabilities: {
"wdi5:authentication": { provider: "BTP" }
}
// in the environment (e.g. via a .env file)
wdi5_username='ken@thompson.org'
wdi5_password='p/q2-q4'
No changes in test code required!
With credentials only picked from the environment at runtime, this helps preventing data leaks by accidentally putting credentials into conf files and checking them into version control.
This security measure found its’ way thanks to Arnaud Buchholz suggesting it in the latest steering committee meeting! 🙏
API alignment
From the very beginning, wdi5
‘s API on Controls was aligned with UI5’s native API on the same. Also, the locators for retrieving a Control were compatible with OPA5’s matcher from the get-go.
History has it that some UI5 Chief Architect said when first presented with the wdi5
PoC:
if you do APIs, why not align them completely?
So there you go, with wdi5
1.0, the UI5 Managed Object API compatibility was added as a feature to complete that “API alignment triumvirate” 😀
// OPA5-compatible selector
const input = await browser.asControl({
selector: {
id: "mainUserInput",
viewName: "test.Sample.view.Main"
}
})
// control api alignment
const value = await input.getValue() // same as in UI5
// new object api alignment
const binding = await input.getBinding("value") // same as in UI5
const path = await binding.getPath() // -"-
// not yet: const pathFluentApi = await input.getBinding("value").getPath()
expect(path).toEqual("/Customers('TRAIH')/ContactName")
Yet a grain of salt remains in that the Managed API alignment is not available as a part of the fluent async api (yet), but needs to be called “step by step”.
Development Experience enhancements
When used as a development companion tool, wdi5
should serve as a safety net of sorts, yet be out of the way at dev time. A combination of headless browser usage, debug mode, and continuously running wdi5
can achieve that. The latter is done by providing the --watch
flag to the WebdriverIO-cli (that in turn wdi5
reuses for running tests).
In wdi5
1.0, the watch mode has been enhanced to recognize an authenticated browser-session. It will not attempt authentication after the initial run, but continue executing the tests only.
Additionally, the wdi5
-specific configuration option url
was deprecated in favor of the WebdriverIO standard baseUrl
.
- wdi5: {
- url: "index.html"
- },
- baseUrl: "<http://localhost:8080>"
+ baseUrl: "<http://localhost:8080/index.html>"
In fact, this makes the entire wdi5
config optional. So after installing wdi5
, you’re pretty much good to go with the default options!
Tooling integration
While getting wdi5
up and running should supposedly be quick and effortless, coming up with the right locators on the desired page and using the proper assertions might pose an initial challenge.
That’s where the wdi5
ecosystem helps tremendously:
- use the UI5 Journey Recorder to …well… record your path through a UI5 app, then exporting it to copypasta-ready
wdi5
code - subsequently, use the UI5 Test Recorder to finetune the assertions (
expect
s) on a UI5 control or object
Plus, if you struggle to fathom the power of the CLI 😱 , then the wdio/wdi5
-VS Code extension can help with kicking off test runs 😁
What’s next?
Up to now, wdi5
was following the 0.9.x
patch releases to prep for this 1.0
. From now on, we’ll follow a more proper major
–minor
–patch
semantic versioning strategy.
Date-wise, this is a sandwich situation:
wdi5
1.0 was released in the wake of last week’s TechEd, where it was demoed live on stage at the developer advocates keynote (very 😎 btw).
This week, on Dec 1st, the next major version of WebdriverIO (8.0
) will launch.
It will feature a browser-based test runner that holds plenty of potential for improving test runtimes.
Certainly something the #wdi5 community will have a look at asap!