Browse Source

Merge pull request #5139 from nocodb/test/swagger

test: swagger
pull/5144/head
Raju Udava 2 years ago committed by GitHub
parent
commit
593eb7fbb7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 5
      tests/playwright/pages/Dashboard/index.ts
  2. 42
      tests/playwright/tests/swagger.spec.ts

5
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));
}

42
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');
});
});
Loading…
Cancel
Save