Browse Source

test: meta sync test correction

nc-refactor/ds
Pranav C 2 months ago
parent
commit
ad008cf8e3
  1. 7
      tests/playwright/pages/Dashboard/ProjectView/Metadata.ts
  2. 13
      tests/playwright/pages/Dashboard/Settings/DataSources.ts
  3. 13
      tests/playwright/tests/db/features/metaSync.spec.ts

7
tests/playwright/pages/Dashboard/ProjectView/Metadata.ts

@ -8,7 +8,7 @@ export class MetaDataPage extends BasePage {
super(dataSource.rootPage); super(dataSource.rootPage);
} }
get() { get(options?: any) {
return this.rootPage.locator('div.ant-modal-content'); return this.rootPage.locator('div.ant-modal-content');
} }
@ -25,7 +25,10 @@ export class MetaDataPage extends BasePage {
await this.get().click(); await this.get().click();
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
await this.rootPage.keyboard.press('Escape'); await this.rootPage.keyboard.press('Escape');
await this.get().waitFor({ state: 'detached' }); // await this.get().toHaveLength(0) // .waitFor({ state: 'detached' });
await this.rootPage.waitForSelector('div.ant-modal-content', {
state: 'hidden',
});
} }
async sync() { async sync() {

13
tests/playwright/pages/Dashboard/Settings/DataSources.ts

@ -30,15 +30,16 @@ export class DataSourcesPage extends BasePage {
await row.click(); await row.click();
await this.get().getByTestId('nc-erd-tab').click(); await this.get().getByTestId('nc-erd-tab').click();
} }
async openAcl({ dataSourceName = defaultBaseName }: { dataSourceName?: string } = {}) { async openAcl({ dataSourceName = defaultBaseName }: { dataSourceName?: string } = {}) {
await this.get().locator('.ds-table-row', { hasText: dataSourceName }).locator('button:has-text("UI ACL")').click(); await this.get().locator('.ds-table-row', { hasText: dataSourceName }).locator('button:has-text("UI ACL")').click();
} }
async openMetaSync({ dataSourceName = defaultBaseName }: { dataSourceName?: string } = {}) { async openMetaSync({ rowIndex }: { rowIndex: number }) {
await this.get() // 0th offset for header
.locator('.ds-table-row', { hasText: dataSourceName }) const row = this.get()
.locator('button:has-text("Sync Metadata")') .locator('.ds-table-row')
.click(); .nth(rowIndex + 1);
await row.click();
await this.get().getByTestId('nc-meta-sync-tab').click();
} }
} }

13
tests/playwright/tests/db/features/metaSync.spec.ts

@ -36,8 +36,12 @@ test.describe('Meta sync', () => {
test('Meta sync', async () => { test('Meta sync', async () => {
test.setTimeout(process.env.CI ? 100000 : 70000); test.setTimeout(process.env.CI ? 100000 : 70000);
await dashboard.baseView.tab_dataSources.click(); // await dashboard.baseView.tab_dataSources.click();
await dashboard.baseView.dataSources.openMetaSync({ rowIndex: 0 }); // await dashboard.baseView.dataSources.openMetaSync({ rowIndex: 0 });
await dashboard.treeView.baseSettings({ title: context.base.title });
await dashboard.settings.selectTab({ tab: 'dataSources' });
await dashboard.settings.dataSources.openMetaSync({ rowIndex: 0 });
await dbExec(`CREATE TABLE table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`); await dbExec(`CREATE TABLE table1 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
await dbExec(`CREATE TABLE table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`); await dbExec(`CREATE TABLE table2 (id INT NOT NULL, col1 INT NULL, PRIMARY KEY (id))`);
@ -247,8 +251,9 @@ test.describe('Meta sync', () => {
`INSERT INTO table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);` `INSERT INTO table1 (id, col1, col2, col3, col4) VALUES (1,1,1,1,1), (2,2,2,2,2), (3,3,3,3,3), (4,4,4,4,4), (5,5,5,5,5), (6,6,6,6,6), (7,7,7,7,7), (8,8,8,8,8), (9,9,9,9,9);`
); );
await dashboard.baseView.tab_dataSources.click(); await dashboard.treeView.baseSettings({ title: context.base.title });
await dashboard.baseView.dataSources.openMetaSync({ rowIndex: 0 }); await dashboard.settings.selectTab({ tab: 'dataSources' });
await dashboard.settings.dataSources.openMetaSync({ rowIndex: 0 });
await metaData.clickReload(); await metaData.clickReload();
await metaData.sync(); await metaData.sync();

Loading…
Cancel
Save