mirror of https://github.com/nocodb/nocodb
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.
59 lines
1.9 KiB
59 lines
1.9 KiB
2 years ago
|
import { expect } from '@playwright/test';
|
||
|
import { SettingsPage } from '.';
|
||
|
import BasePage from '../../Base';
|
||
2 years ago
|
|
||
|
export class AppStoreSettingsPage extends BasePage {
|
||
|
private readonly settings: SettingsPage;
|
||
|
|
||
|
constructor(settings: SettingsPage) {
|
||
|
super(settings.rootPage);
|
||
|
this.settings = settings;
|
||
|
}
|
||
|
|
||
|
get() {
|
||
2 years ago
|
return this.settings.get().locator(`[data-testid="nc-settings-subtab-appStore"]`);
|
||
2 years ago
|
}
|
||
|
|
||
|
async install({ name }: { name: string }) {
|
||
2 years ago
|
const card = await this.settings.get().locator(`.nc-app-store-card-${name}`);
|
||
2 years ago
|
await card.click();
|
||
2 years ago
|
|
||
|
// todo: Hack to solve the issue when if the test installing a plugin fails, the next test will fail because the plugin is already installed
|
||
|
let appAlreadyInstalled = true;
|
||
|
for (let i = 0; i < 5; i++) {
|
||
|
if (await card.locator('.nc-app-store-card-install').isVisible()) {
|
||
|
appAlreadyInstalled = false;
|
||
|
break;
|
||
|
}
|
||
|
await new Promise(resolve => setTimeout(resolve, 1000));
|
||
|
}
|
||
|
|
||
|
if (appAlreadyInstalled) {
|
||
|
await this.uninstall({ name });
|
||
|
}
|
||
|
|
||
2 years ago
|
await card.locator('.nc-app-store-card-install').click();
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async configureSlack() {}
|
||
|
|
||
2 years ago
|
async configureSMTP({ email, host, port }: { email: string; host: string; port: string }) {
|
||
|
const appStoreCard = this.rootPage.locator('.nc-modal-plugin-install');
|
||
2 years ago
|
|
||
|
await appStoreCard.locator('[id="form_item_from"]').fill(email);
|
||
|
await appStoreCard.locator('[id="form_item_host"]').fill(host);
|
||
|
await appStoreCard.locator('[id="form_item_port"]').fill(port);
|
||
|
|
||
|
await appStoreCard.locator('button:has-text("Save")').click();
|
||
|
}
|
||
|
|
||
|
async uninstall(param: { name: string }) {
|
||
2 years ago
|
const card = this.settings.get().locator(`.nc-app-store-card-${param.name}`);
|
||
2 years ago
|
|
||
|
// await card.scrollIntoViewIfNeeded();
|
||
|
await card.click();
|
||
2 years ago
|
await card.locator('.nc-app-store-card-reset').click();
|
||
|
await this.rootPage.locator('button.ant-btn-dangerous').click();
|
||
2 years ago
|
}
|
||
|
}
|