mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-30 16:26:54 +00:00
feat(testing): Added quicktest(not complete)
This commit is contained in:
44
scripts/playwright/pages/ProjectsPage/index.ts
Normal file
44
scripts/playwright/pages/ProjectsPage/index.ts
Normal file
@@ -0,0 +1,44 @@
|
||||
// playwright-dev-page.ts
|
||||
import { expect, Page } from "@playwright/test";
|
||||
import BasePage from "../Base";
|
||||
|
||||
export class ProjectsPage extends BasePage {
|
||||
constructor(rootPage: Page) {
|
||||
super(rootPage);
|
||||
}
|
||||
|
||||
get() {
|
||||
return this.rootPage.locator("html");
|
||||
}
|
||||
|
||||
async selectAndGetProject(projectName: string) {
|
||||
let project: any;
|
||||
|
||||
await Promise.all([
|
||||
this.rootPage.waitForResponse(async (res) => {
|
||||
let json:any = {}
|
||||
try{
|
||||
json = await res.json()
|
||||
} catch(e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
const isRequiredResponse = res.request().url().includes('/api/v1/db/meta/projects') &&
|
||||
['GET'].includes(res.request().method()) &&
|
||||
json?.title === projectName;
|
||||
|
||||
if(isRequiredResponse){
|
||||
project = json;
|
||||
}
|
||||
|
||||
return isRequiredResponse;
|
||||
}),
|
||||
this.get().locator(`.ant-table-cell`,{
|
||||
hasText: projectName
|
||||
}).click()
|
||||
]);
|
||||
|
||||
return project;
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user