feat(testing): Added quick test, added isEmptyProject option to test setup to have project created with no sakila tables

This commit is contained in:
Muhammed Mustafa
2022-10-25 12:27:16 +05:30
parent dd2858c9bb
commit 6b0d0fcb04
23 changed files with 435 additions and 153 deletions

View File

@@ -1,5 +1,6 @@
import { test } from "@playwright/test";
import { DashboardPage } from "../pages/Dashboard";
import { quickVerify } from "../quickTests/commonTest";
import setup from "../setup";
const apiKey = process.env.E2E_AIRTABLE_API_KEY;
@@ -9,45 +10,33 @@ test.describe("Import", () => {
let dashboard: DashboardPage;
let context: any;
test.setTimeout(150000);
test.beforeEach(async ({ page }) => {
context = await setup({ page });
page.setDefaultTimeout(50000);
context = await setup({ page, isEmptyProject: true });
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,
key: apiKey!,
baseId: apiBase!,
});
await dashboard.rootPage.waitForTimeout(1000);
await quickVerify({dashboard, airtableImport: true, context});
});
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" });
});
});

View File

@@ -39,7 +39,7 @@ test.describe("User roles", () => {
let settings: SettingsPage;
let context: any;
test.beforeAll(async ({ page }) => {
test.beforeEach(async ({ page }) => {
context = await setup({ page });
dashboard = new DashboardPage(page, context.project);
toolbar = dashboard.grid.toolbar;

View File

@@ -70,7 +70,7 @@ test.describe("Views CRUD Operations", () => {
await dashboard.viewSidebar.deleteView({ title: "CityGallery2" });
await dashboard.viewSidebar.verifyViewNotPresent({
title: "CityGallery2",
index: 2,
index: 1,
});
});
});

View File

@@ -32,7 +32,7 @@ test.describe("Webhook", () => {
let dashboard: DashboardPage, toolbar: ToolbarPage, webhook: WebhookFormPage;
let context: any;
test.beforeAll(async () => {
test.beforeEach(async () => {
// start a server locally for webhook tests
await makeServer();
});