REMOTE ORIGIN
OTT Testing
Usage
Scenarios
Using standard libraries (Mocha, Jasmine)
Tests code stored in project GIT
Any HTML5 application running inside the browser on a device can be tested.
Jasmine (React App)
it('Test of navigation and focus in menu', () => {
expect($('.menu').isExisting()).toEqual(true)
sendKey('ArrowLeft', 2)
expect(containsClass($$('.list_of_items')[3].getAttribute('className'), 'is-focused')).toEqual(true)
sendKey('Enter')
waitUntilBufferingIsGone(browser, 10000)
browser.waitUntil(() => {
return $('.menu_item').getAttribute('className') === 'menu_item is-active'
}, 10000)
sendKey('Return', 2)
})
Jasmine (LightningJS App)
it('Go back to grid', async () => {
await sendKey('Back')
const isFocused = await browser.execute(() => {
const focusPath = window.app.focusPath
return focusPath.findIndex((e) => e.ref === 'Back') !== -1
})
expect(isFocused).toBe(true)
await sendKey('Ok')
[selectedRow, selectedCol] = await browser.execute(() => {
const focusPath = window.app.focusPath
const col = focusPath.find((e) => e.ref === 'Content')
const row = focusPath.find((e) => e.ref === 'Row')
return [col.selectedIndex, row.selectedIndex]
})
expect([selectedCol, selectedRow]).toBeEqual([0,2])
})
Solution
Components
<script>
Video Demo