多维表格
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

42 lines
1.2 KiB

import BasePage from '../Base';
import { AccountSetupPage } from './Setup';
export class AccountSetupConfigPage extends BasePage {
private setupPage: AccountSetupPage;
constructor(setupPage: AccountSetupPage) {
super(setupPage.rootPage);
this.setupPage = setupPage;
}
async goto(category: 'email' | 'storage', plugin: string) {
await this.rootPage.goto(`/#/account/setup/${category}/${plugin}`);
}
get() {
return this.setupPage.get().getByTestId('nc-setup-config');
}
async fillForm(data: any) {
for (const key in data) {
const fieldWrapper = this.get().getByTestId(`nc-form-input-${key}`);
// if switch then toggle
if (await fieldWrapper.locator('.ant-switch').isVisible()) {
if (data[key]) {
await fieldWrapper.locator('.ant-switch').click();
}
} else {
await fieldWrapper.locator('input').focus();
await fieldWrapper.locator('input').fill(data[key]?.toString?.());
}
}
}
async test() {
await this.get().getByTestId('nc-setup-config-action-test').click();
}
async save() {
await this.get().getByTestId('nc-setup-config-action-save').click();
}
}