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.
51 lines
1.7 KiB
51 lines
1.7 KiB
2 years ago
|
import { expect } from '@playwright/test';
|
||
2 years ago
|
import BasePage from '../../Base';
|
||
2 years ago
|
import { getTextExcludeIconText } from '../../../tests/utils/general';
|
||
1 year ago
|
import { DataSourcePage } from './DataSourcePage';
|
||
2 years ago
|
|
||
|
export class MetaDataPage extends BasePage {
|
||
1 year ago
|
constructor(dataSource: DataSourcePage) {
|
||
|
super(dataSource.rootPage);
|
||
2 years ago
|
}
|
||
|
|
||
|
get() {
|
||
1 year ago
|
return this.rootPage.locator('div.ant-modal-content');
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async clickReload() {
|
||
2 years ago
|
await this.get().locator(`button:has-text("Reload")`).click();
|
||
2 years ago
|
|
||
|
// todo: Remove this wait
|
||
|
await this.rootPage.waitForTimeout(100);
|
||
|
// await this.get().locator(`.animate-spin`).waitFor({state: 'visible'});
|
||
2 years ago
|
await this.get().locator(`.animate-spin`).waitFor({ state: 'detached' });
|
||
2 years ago
|
}
|
||
|
|
||
1 year ago
|
async close() {
|
||
|
await this.get().click();
|
||
|
await this.rootPage.keyboard.press('Escape');
|
||
|
await this.rootPage.keyboard.press('Escape');
|
||
|
await this.get().waitFor({ state: 'detached' });
|
||
|
}
|
||
|
|
||
2 years ago
|
async sync() {
|
||
2 years ago
|
await this.get().locator(`button:has-text("Sync Now")`).click();
|
||
2 years ago
|
await this.verifyToast({ message: 'Table metadata recreated successfully' });
|
||
|
await this.get().locator(`.animate-spin`).waitFor({ state: 'visible' });
|
||
|
await this.get().locator(`.animate-spin`).waitFor({ state: 'detached' });
|
||
2 years ago
|
}
|
||
|
|
||
2 years ago
|
async verifyRow({ index, model, state }: { index: number; model: string; state: string }) {
|
||
1 year ago
|
const fieldLocator = this.get().locator(`tr.ant-table-row`).nth(index).locator(`td.ant-table-cell`).nth(0);
|
||
2 years ago
|
const fieldText = await getTextExcludeIconText(fieldLocator);
|
||
1 year ago
|
expect(fieldText).toBe(model);
|
||
2 years ago
|
|
||
2 years ago
|
await expect(this.get().locator(`tr.ant-table-row`).nth(index).locator(`td.ant-table-cell`).nth(1)).toHaveText(
|
||
|
state,
|
||
|
{
|
||
|
ignoreCase: true,
|
||
|
}
|
||
|
);
|
||
2 years ago
|
}
|
||
2 years ago
|
}
|