diff --git a/tests/playwright/pages/Dashboard/index.ts b/tests/playwright/pages/Dashboard/index.ts index d90b88a80e..e8f6265fbd 100644 --- a/tests/playwright/pages/Dashboard/index.ts +++ b/tests/playwright/pages/Dashboard/index.ts @@ -65,6 +65,11 @@ export class DashboardPage extends BasePage { await this.rootPage.locator('div.nc-project-menu-item:has-text(" Team & Settings")').click(); } + async gotoProjectSubMenu({ title }: { title: string }) { + await this.rootPage.getByTestId('nc-project-menu').click(); + await this.rootPage.locator(`div.nc-project-menu-item:has-text("${title}")`).click(); + } + async verifyInTabBar({ title }: { title: string }) { await this.tabBar.textContent().then(text => expect(text).toContain(title)); } diff --git a/tests/playwright/tests/swagger.spec.ts b/tests/playwright/tests/swagger.spec.ts new file mode 100644 index 0000000000..9033784985 --- /dev/null +++ b/tests/playwright/tests/swagger.spec.ts @@ -0,0 +1,42 @@ +import { expect, test } from '@playwright/test'; +import { DashboardPage } from '../pages/Dashboard'; +import { GridPage } from '../pages/Dashboard/Grid'; +import setup from '../setup'; + +test.describe('Table Column Operations', () => { + let grid: GridPage, dashboard: DashboardPage; + let context: any; + + test.beforeEach(async ({ page }) => { + context = await setup({ page }); + dashboard = new DashboardPage(page, context.project); + grid = dashboard.grid; + }); + + test('Create column', async () => { + // access swagger link + const link = `http://localhost:8080/api/v1/db/meta/projects/${context.project.id}/swagger`; + await dashboard.rootPage.goto(link, { waitUntil: 'networkidle' }); + + const swagger = await dashboard.rootPage; + + // authorize with token information + await swagger.locator('.btn.authorize').click(); + await swagger.locator('.modal-ux').locator('input').first().fill(context.token); + await swagger.locator('.btn.modal-btn.auth.authorize.button').first().click(); + await swagger.locator('.close-modal').click(); + + // click on the first get request + await swagger.locator('.opblock.opblock-get').first().click(); + await swagger.locator('.btn.try-out__btn').first().click(); + await swagger.locator('.btn.execute.opblock-control__btn').first().click(); + + // verify response status + const responseStatus = await swagger + .locator('.responses-table >> tbody') + .locator('.response-col_status') + .first() + .innerText(); + expect(responseStatus).toBe('200'); + }); +});