mirror of https://github.com/nocodb/nocodb
Pranav C
3 months ago
10 changed files with 110 additions and 22 deletions
@ -0,0 +1,45 @@ |
|||||||
|
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().locator(`[data-test-id="nc-setup-config"]`); |
||||||
|
} |
||||||
|
|
||||||
|
async fillForm(data: any) { |
||||||
|
for (const key in data) { |
||||||
|
const fieldWrapper = this.get().locator(`[data-test-id="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 if (await fieldWrapper.locator('.ant-select').isVisible()) { |
||||||
|
await fieldWrapper.locator('.ant-select').click(); |
||||||
|
await this.rootPage |
||||||
|
.locator(`[data-test-id="nc-form-input-${key}"] .ant-select-item:has-text("${data[key]}")`) |
||||||
|
.click(); |
||||||
|
} else { |
||||||
|
await fieldWrapper.locator('input').fill(data[key]); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
async test() { |
||||||
|
await this.get().getByTestId('nc-setup-config-action-test').click(); |
||||||
|
} |
||||||
|
|
||||||
|
async Save() { |
||||||
|
await this.get().getByTestId('nc-setup-config-action-save').click(); |
||||||
|
} |
||||||
|
} |
@ -0,0 +1,32 @@ |
|||||||
|
import BasePage from '../Base'; |
||||||
|
import { AccountSetupPage } from './Setup'; |
||||||
|
|
||||||
|
export class AccountSetupListPage extends BasePage { |
||||||
|
private setupPage: AccountSetupPage; |
||||||
|
|
||||||
|
constructor(setupPage: AccountSetupPage) { |
||||||
|
super(setupPage.rootPage); |
||||||
|
this.setupPage = setupPage; |
||||||
|
} |
||||||
|
|
||||||
|
async goto(category: 'email' | 'storage') { |
||||||
|
await this.rootPage.goto(`/#/account/setup/${category}`); |
||||||
|
} |
||||||
|
|
||||||
|
get() { |
||||||
|
return this.setupPage.get().locator(`[data-test-id="nc-setup-list"]`); |
||||||
|
} |
||||||
|
|
||||||
|
getPluginItem(plugin: string) { |
||||||
|
return this.get().locator(`[data-test-id="nc-setup-list-item-${plugin}"]`); |
||||||
|
} |
||||||
|
|
||||||
|
async isConfigured(plugin: string) { |
||||||
|
return await this.getPluginItem(plugin).locator('.nc-configured').isVisible(); |
||||||
|
} |
||||||
|
|
||||||
|
async reset(plugin: string) { |
||||||
|
await this.getPluginItem(plugin).locator('.nc-setup-plugin-menu').click(); |
||||||
|
await this.rootPage.locator('.ant-dropdown').locator('[data-test-id="nc-config-reset"].nc-menu-item').click(); |
||||||
|
} |
||||||
|
} |
Loading…
Reference in new issue