Browse Source

Merge pull request #5350 from nocodb/fix/project-ops

test: fix project operations flaky test
pull/5339/merge
Raju Udava 2 years ago committed by GitHub
parent
commit
36fbf91d5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 3
      tests/playwright/pages/ProjectsPage/index.ts
  2. 21
      tests/playwright/tests/projectOperations.spec.ts

3
tests/playwright/pages/ProjectsPage/index.ts

@ -147,6 +147,9 @@ export class ProjectsPage extends BasePage {
}); });
await projRow.locator('.nc-action-btn').nth(0).click(); await projRow.locator('.nc-action-btn').nth(0).click();
// there is a flicker; add delay to avoid flakiness
await this.rootPage.waitForTimeout(1000);
await project.locator('input.nc-metadb-project-name').fill(newTitle); await project.locator('input.nc-metadb-project-name').fill(newTitle);
// press enter to save // press enter to save
const submitAction = () => project.locator('input.nc-metadb-project-name').press('Enter'); const submitAction = () => project.locator('input.nc-metadb-project-name').press('Enter');

21
tests/playwright/tests/projectOperations.spec.ts

@ -3,11 +3,13 @@ import { DashboardPage } from '../pages/Dashboard';
import setup from '../setup'; import setup from '../setup';
import { ToolbarPage } from '../pages/Dashboard/common/Toolbar'; import { ToolbarPage } from '../pages/Dashboard/common/Toolbar';
import { ProjectsPage } from '../pages/ProjectsPage'; import { ProjectsPage } from '../pages/ProjectsPage';
import { Api } from 'nocodb-sdk';
test.describe('Project operations', () => { test.describe('Project operations', () => {
let dashboard: DashboardPage; let dashboard: DashboardPage;
let toolbar: ToolbarPage; let toolbar: ToolbarPage;
let context: any; let context: any;
let api: Api<any>;
let projectPage: ProjectsPage; let projectPage: ProjectsPage;
test.beforeEach(async ({ page }) => { test.beforeEach(async ({ page }) => {
@ -15,9 +17,28 @@ test.describe('Project operations', () => {
dashboard = new DashboardPage(page, context.project); dashboard = new DashboardPage(page, context.project);
projectPage = new ProjectsPage(page); projectPage = new ProjectsPage(page);
toolbar = dashboard.grid.toolbar; toolbar = dashboard.grid.toolbar;
api = new Api({
baseURL: `http://localhost:8080/`,
headers: {
'xc-auth': context.token,
},
});
}); });
test('rename, delete', async () => { test('rename, delete', async () => {
// if project already exists, delete it
try {
const projectList = await api.project.list();
const project = projectList.list.find((p: any) => p.title === 'project-firstName');
if (project) {
await api.project.delete(project.id);
console.log('deleted project: ', project.id);
}
} catch (e) {
console.log('Error: ', e);
}
await dashboard.clickHome(); await dashboard.clickHome();
await projectPage.createProject({ name: 'project-firstName', withoutPrefix: true }); await projectPage.createProject({ name: 'project-firstName', withoutPrefix: true });
await dashboard.clickHome(); await dashboard.clickHome();

Loading…
Cancel
Save