This directory contains UI automation tests for the SAPUI5 interfaces using WDI5 (WebDriver for UI5).
These tests validate the actual SAPUI5 user interface functionality, including:
- 🎨 UI Rendering: Verifies SAPUI5 controls are displayed correctly
- 🖱️ User Interactions: Tests clicks, input, navigation, and other user actions
- 📊 Data Binding: Validates data loading and display in UI controls
- 📱 Responsive Design: Tests mobile, tablet, and desktop layouts
⚠️ Error Handling: Validates error messages and feedback to users- 🔄 State Management: Tests UI state changes and transitions
| Test Type | Location | What it Tests | Tools |
|---|---|---|---|
| E2E CLI Tests | tests/e2e/ |
Command execution, help text, server startup | Mocha, Node exec |
| UI Tests | tests/ui/ |
Actual SAPUI5 interface interaction | WDI5, WebdriverIO, Chrome |
Install WDI5 and WebdriverIO:
npm install --save-dev @wdio/cli@9 @wdio/local-runner@9 @wdio/mocha-framework@9 @wdio/spec-reporter@9 @wdio/globals@9 wdio-ui5-service@3 wdio-chromedriver-service@8 webdriverio@9 --legacy-peer-depsNote:
- WebdriverIO v9 is required for wdio-ui5-service v3
wdio-chromedriver-service@8is the latest available--legacy-peer-depsflag is required for peer dependency conflicts
Tests run in Chrome (headless by default). Ensure Chrome is installed:
- Windows: Download from https://www.google.com/chrome/
- macOS:
brew install --cask google-chrome - Linux:
sudo apt-get install google-chrome-stable
Before running UI tests, start the HANA CLI server:
# Starts UI server at http://localhost:3010/ui/#tables-ui
node bin/cli.js tablesUINote: this command does not support
--port; the default UI port is3010.
Leave the server running in the background.
npm run test:uinpm run test:ui -- --spec tests/ui/tablesUI.ui.test.jsnpm run test:ui:debugThis opens Chrome with visible browser for debugging.
Edit wdio.conf.js and modify the args section:
'goog:chromeOptions': {
args: [
'--window-size=1920,1080' // Change this
]
}Each UI test file follows this pattern:
describe('ComponentUI - SAPUI5 Interface Tests', function() {
before(async function() {
// Navigate to UI and wait for UI5 to load
})
describe('Page Structure', () => {
// Test page loads, components initialize
})
describe('UI Controls', () => {
// Test buttons, inputs, tables render
})
describe('User Interactions', () => {
// Test clicking, typing, selecting
})
describe('Data Loading', () => {
// Test backend data binding
})
describe('Responsive Design', () => {
// Test mobile/tablet/desktop layouts
})
describe('Error Handling', () => {
// Test error messages
})
})// By control type and view
const button = await browser.asControl({
selector: {
controlType: 'sap.m.Button',
viewName: 'sap.hanacli.tables.view.App'
}
})
// By ID
const table = await browser.asControl({
selector: {
id: 'myTable',
viewName: 'sap.hanacli.tables.view.App'
}
})
// By property
const searchField = await browser.asControl({
selector: {
controlType: 'sap.m.SearchField',
properties: {
placeholder: 'Search...'
}
}
})// Enter text
await input.enterText('Hello World')
// Click button
await button.press()
// Get property
const value = await input.getValue()
const enabled = await button.getEnabled()// Wait for UI5 to initialize
await browser.waitUntil(async () => {
const ready = await browser.executeAsync((done) => {
if (window.sap && window.sap.ui) {
sap.ui.require(['sap/ui/core/Core'], function(Core) {
done(Core.isInitialized())
})
} else {
done(false)
}
})
return ready
}, { timeout: 30000 })| Test File | UI Command | Description |
|---|---|---|
tablesUI.ui.test.js |
tablesUI |
Tests table listing and browsing interface |
systemInfoUI.ui.test.js |
systemInfoUI |
Tests system information display |
importUI.ui.test.js |
importUI |
Tests file upload and import interface |
Configuration is in wdio.conf.js at the project root:
- Browser: Chrome (headless by default)
- Base URL:
http://localhost:3010 - Timeout: 60000ms per test
- Framework: Mocha
- Reporters: Spec (console output)
You may see TypeScript errors related to controlType and SAPUI5 types in test files. These are expected due to incomplete type definitions in WDI5 and do not affect test execution. The tests will run successfully despite these editor warnings.
Common TypeScript errors (safe to ignore):
Object literal may only specify known properties, and 'controlType' does not existProperty 'require' does not exist on type 'typeof ui'Parameter 'X' implicitly has an 'any' type
These errors occur because WDI5 and SAPUI5 type definitions are not complete for all use cases. The code is correct and will execute properly at runtime.
- Ensure the server is running on port 3010 (
node bin/cli.js tablesUI) - Check browser console for JavaScript errors
- Increase
waitforTimeoutinwdio.conf.js
- Verify
viewNamematches your SAPUI5 component - Check
controlTypespelling (case-sensitive) - Use
browser.execute()to inspect DOM
Problem: ChromeDriver version doesn't match your Chrome version
This version of ChromeDriver only supports Chrome version 146
Current browser version is 145.0.7632.160Solutions:
-
Update Chrome (recommended):
- Windows: Check for updates in Chrome menu → About Google Chrome
- macOS/Linux: Update via your package manager
-
OR Update ChromeDriver to match your Chrome version:
npm install --save-dev chromedriver --legacy-peer-deps
This automatically downloads the correct version for your installed Chrome.
Always keep Chrome and ChromeDriver versions in sync for UI tests to work.
- Set
headless: falseinwdio.conf.js - Add
await browser.debug()in test to pause - Use
await browser.pause(5000)to add delays - Take screenshots:
await browser.saveScreenshot('./screenshot.png')
UI tests can be run in CI with headless Chrome:
# GitHub Actions example
- name: Install Chrome
run: |
wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add -
sudo sh -c 'echo "deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main" >> /etc/apt/sources.list.d/google.list'
sudo apt-get update
sudo apt-get install google-chrome-stable
- name: Run UI Tests
run: |
npm run test:ui- Start server before tests: UI tests require a running server
- Use proper waits: Always wait for UI5 to initialize
- Clean test data: Reset state between tests if needed
- Test isolation: Each test should be independent
- Responsive testing: Test multiple screen sizes
- Error scenarios: Test both success and failure paths
When adding new UI tests:
- Follow the existing test structure
- Test both happy path and error scenarios
- Include responsive design tests
- Document any special setup requirements
- Ensure tests pass in headless mode