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.
18 lines
452 B
JavaScript
18 lines
452 B
JavaScript
function randomPrefix() {
|
|
let dt = new Date().getTime();
|
|
return "xxxxxxxx".replace(/x/g, (c) => {
|
|
const r = (dt + Math.random() * 16) % 16 | 0;
|
|
dt = Math.floor(dt / 16);
|
|
return (c == "x" ? r : (r & 0x3) | 0x8).toString(16);
|
|
});
|
|
}
|
|
|
|
function convertToSlug(text) {
|
|
return text
|
|
.toLowerCase()
|
|
.replace(/ /g, "-")
|
|
.replace(/[^\w-]+/g, "");
|
|
}
|
|
|
|
module.exports = { randomPrefix, convertToSlug };
|