mirror of https://github.com/nocodb/nocodb
Raju Udava
2 years ago
committed by
Muhammed Mustafa
4 changed files with 160 additions and 14 deletions
@ -0,0 +1,29 @@
|
||||
// playwright-dev-page.ts
|
||||
import { expect, Locator } from "@playwright/test"; |
||||
import BasePage from "../../Base"; |
||||
import { DashboardPage } from ".."; |
||||
|
||||
export class ImportAirtablePage extends BasePage { |
||||
readonly dashboard: DashboardPage; |
||||
readonly importButton: Locator; |
||||
|
||||
constructor(dashboard: DashboardPage) { |
||||
super(dashboard.rootPage); |
||||
this.dashboard = dashboard; |
||||
this.importButton = dashboard.get().locator(".nc-btn-airtable-import"); |
||||
} |
||||
|
||||
get() { |
||||
return this.dashboard.get().locator(`.nc-modal-airtable-import`); |
||||
} |
||||
|
||||
async import({ key, baseId }: { key: string; baseId: string }) { |
||||
console.log(key, baseId); |
||||
await this.get().locator(`.nc-input-api-key >> input`).fill(key); |
||||
await this.get().locator(`.nc-input-shared-base`).fill(baseId); |
||||
await this.importButton.click(); |
||||
|
||||
await this.get().locator(`button:has-text("Go to Dashboard")`).waitFor(); |
||||
await this.get().locator(`button:has-text("Go to Dashboard")`).click(); |
||||
} |
||||
} |
@ -0,0 +1,53 @@
|
||||
import { test } from "@playwright/test"; |
||||
import { DashboardPage } from "../pages/Dashboard"; |
||||
import setup from "../setup"; |
||||
|
||||
const apiKey = process.env.E2E_AIRTABLE_API_KEY; |
||||
const apiBase = process.env.E2E_AIRTABLE_BASE_ID; |
||||
|
||||
test.describe("Import", () => { |
||||
let dashboard: DashboardPage; |
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page }); |
||||
dashboard = new DashboardPage(page, context.project); |
||||
}); |
||||
|
||||
test("Airtable", async () => { |
||||
// create empty project
|
||||
await dashboard.clickHome(); |
||||
await dashboard.createProject({ name: "airtable", type: "xcdb" }); |
||||
|
||||
await dashboard.treeView.quickImport({ title: "Airtable" }); |
||||
await dashboard.importAirtable.import({ |
||||
key: apiKey, |
||||
baseId: apiBase, |
||||
}); |
||||
await dashboard.rootPage.waitForTimeout(1000); |
||||
}); |
||||
|
||||
test("Excel", async () => { |
||||
// create empty project
|
||||
await dashboard.clickHome(); |
||||
await dashboard.createProject({ name: "excel", type: "xcdb" }); |
||||
|
||||
await dashboard.treeView.quickImport({ title: "Microsoft Excel" }); |
||||
}); |
||||
|
||||
test("CSV", async () => { |
||||
// create empty project
|
||||
await dashboard.clickHome(); |
||||
await dashboard.createProject({ name: "CSV", type: "xcdb" }); |
||||
|
||||
await dashboard.treeView.quickImport({ title: "CSV file" }); |
||||
}); |
||||
|
||||
test("JSON", async () => { |
||||
// create empty project
|
||||
await dashboard.clickHome(); |
||||
await dashboard.createProject({ name: "JSON", type: "xcdb" }); |
||||
|
||||
await dashboard.treeView.quickImport({ title: "JSON file" }); |
||||
}); |
||||
}); |
Loading…
Reference in new issue