work in progress with deno
This commit is contained in:
47
test/scripts/admin/moduleSetup.ts
Normal file
47
test/scripts/admin/moduleSetup.ts
Normal file
@@ -0,0 +1,47 @@
|
||||
|
||||
// info-box
|
||||
|
||||
import { Page } from "playwright";
|
||||
import forms from "../forms.ts";
|
||||
import login from "../login.ts";
|
||||
|
||||
// span.info-box-title has-text /moduleName/
|
||||
// span.fa-cog[title="Configuration"]
|
||||
|
||||
async function configureModule(
|
||||
globalCtx: {
|
||||
page: Page;
|
||||
dolibarrAddress: string;
|
||||
adminCredentials: { username: string; password: string };
|
||||
},
|
||||
{
|
||||
moduleName,
|
||||
enabled,
|
||||
onConfiguration,
|
||||
}: {
|
||||
moduleName: string;
|
||||
enabled: boolean;
|
||||
onConfiguration?: CallableFunction;
|
||||
}
|
||||
): Promise<void> {
|
||||
const {page, dolibarrAddress}= globalCtx;
|
||||
await login.doAdminLogin(globalCtx);
|
||||
|
||||
await page.goto(`${dolibarrAddress}/admin/modules.php?mode=commonkanban`);
|
||||
|
||||
const moduleDiv = page.locator('.info-box', {
|
||||
has: page.locator('.info-box-title',{
|
||||
hasText: new RegExp('^'+moduleName+'\n?$','i')
|
||||
})
|
||||
});
|
||||
|
||||
await forms.toggleOnOff(moduleDiv, enabled);
|
||||
if(enabled && onConfiguration!==undefined) {
|
||||
await moduleDiv.locator(`span.fa-cog[title="Configuration"]`).click();
|
||||
await onConfiguration();
|
||||
}
|
||||
}
|
||||
|
||||
export default {
|
||||
configureModule,
|
||||
}
|
||||
Reference in New Issue
Block a user