-
Notifications
You must be signed in to change notification settings - Fork 0
add create, delete book scenario #1
base: main
Are you sure you want to change the base?
Conversation
lib/index.js
Outdated
@@ -0,0 +1,143 @@ | |||
async function goHome() { | |||
await browser.goTo('#Shell-home'); | |||
await browser.waitForUI5(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where are goTo
and waitForUI5()
injected into the browser object?
a comment here might help the inclined developer :)
plus: if this is primarily targeting wdi5
, the wdi5.goTo()
seems more appropriate.
plus: we should refrain from any manual waitForXX
APIs and rather leave it to the test framework to sync app lifecyle with test lifecycle. E.g. with wdi5
, no waiting for any ops to finish is necessary as the underlying RecordReplay-API takes care of this and is accounted for in wdi5
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
switched to wdi5.goTo()
lib/index.js
Outdated
}).enterText(text) | ||
} | ||
|
||
async function performStandardAction( name ) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whitespacing btw method and parenthesis → please introduce a formatter (e.g. prettier
) and optionally a linter (e.g. eslint
) for avoiding style issues.
I'd suggest to align with wdi5
with that: https://github.com/ui5-community/wdi5/blob/main/.prettierrc
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added prettier as suggested, eslint also
lib/index.js
Outdated
} | ||
|
||
async function _findTableWithTitle(title, controlType, opt={}) { | ||
let { searchOpenDialogs } = opt; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure about your intended usage of let
and const
here and this file in general. Personally, I prefer const
over let
for immutable var assignments, but that's just me. Please just be aware of it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed that: let it be const ;)
lib/index.js
Outdated
|
||
async function selectRowInTable( tableTitle, targetRow ) { | ||
let table = await _findTableWithTitle(tableTitle, "sap.m.Table"); | ||
let items = await table.getItems(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this has proven to be a potential drawback: if the table in question has growing
turned off and at the same time many entries, the test will get flaky here with looong runtimes. Don't have an immediate suggestion for mitigation, just be aware and eventually leave a comment here à la TODO
or REVISIT
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
added a comment
lib/index.js
Outdated
let table = await _findTableWithTitle(tableTitle, "sap.m.Table"); | ||
let items = await table.getItems(); | ||
let checkbox = await items[targetRow].getMultiSelectControl(); | ||
await checkbox.fireSelect({selected:true}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please refrain from using any fire*
methods. When using standalone, they have unintended side effects such as not triggering any other handlers regisitered with the control. Instead, please use press()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changed to press - worked fine
test/CAPBookshop.test.js
Outdated
|
||
it('go home', async () => { | ||
await lib.goHome(); | ||
await _sleep(2 * 1000) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure why this is actually required - I get that FE is slow in general (aka resource-intensive), but waiting 2 secs is just too long IMO.
Best try to get rid of any manual wait operations and leave it to the underlying framework such as wdi5
to sync app- and test-runtime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
removed as it is not needed
No description provided.