c8512c3116
We have an end-to-end test harness that includes a trivially correct DSL for "This is what a user would do, do this": ``` const deleteProvider = (theSlug) => ([ ["button", '>>>ak-sidebar-item a[href="#/core/providers"]'], ["deletebox", `>>>a[href="#/core/applications/${theSlug}"]`], ["button", '>>>ak-forms-delete-bulk button[slot="trigger"]'], ["button", '>>>ak-forms-delete-bulk div[role="dialog"] ak-spinner-button'], ]); ``` It's now possible to target individual sequences of events this way. With a little creativity, we could have standalone functions that take parameters for our calls and just do them, without too much struggle.
52 lines
1.1 KiB
JavaScript
52 lines
1.1 KiB
JavaScript
"use strict";
|
|
|
|
const CLICK_TIME_DELAY = 250;
|
|
|
|
async function text(selector, value) {
|
|
const input = await $(selector);
|
|
return await input.setValue(value);
|
|
}
|
|
|
|
async function button(selector) {
|
|
const button = await $(selector);
|
|
return await button.click();
|
|
}
|
|
|
|
async function search(searchSelector, buttonSelector) {
|
|
const inputBind = await $(searchSelector);
|
|
await inputBind.click();
|
|
const searchBlock = await $('>>>div[data-managed-by="ak-search-select"]');
|
|
const target = searchBlock.$(buttonSelector);
|
|
return await target.click();
|
|
}
|
|
|
|
async function pause(selector) {
|
|
if (selector) {
|
|
return await $(selector).waitForDisplayed();
|
|
}
|
|
return await browser.pause(CLICK_TIME_DELAY);
|
|
}
|
|
|
|
async function waitfor(selector) {
|
|
return await $(selector).waitForDisplayed();
|
|
}
|
|
|
|
async function deletebox(selector) {
|
|
return await $(selector)
|
|
.parentElement()
|
|
.parentElement()
|
|
.$(".pf-c-table__check")
|
|
.$('input[type="checkbox"]')
|
|
.click();
|
|
}
|
|
|
|
|
|
exports.$AkSel = {
|
|
button,
|
|
pause,
|
|
search,
|
|
text,
|
|
waitfor,
|
|
deletebox,
|
|
};
|