mirror of https://github.com/nocodb/nocodb
Muhammed Mustafa
2 years ago
18 changed files with 156 additions and 11 deletions
@ -0,0 +1,5 @@
|
||||
{ |
||||
"country": "Afghanistan", |
||||
"city": ["Kabul"] |
||||
} |
||||
|
@ -0,0 +1,4 @@
|
||||
{ |
||||
"country": "Algeria", |
||||
"city": ["Batna", "Bchar", "Skikda"] |
||||
} |
@ -0,0 +1,4 @@
|
||||
{ |
||||
"country": "Americal Samoa", |
||||
"city": ["Tafuna"] |
||||
} |
@ -0,0 +1,4 @@
|
||||
{ |
||||
"country": "Angola", |
||||
"city": ["Benguela", "Namibe"] |
||||
} |
@ -0,0 +1,4 @@
|
||||
{ |
||||
"country": "Anguilla", |
||||
"city": ["South Hill"] |
||||
} |
@ -0,0 +1,4 @@
|
||||
{ |
||||
"country": "Argentina", |
||||
"city": ["Almirante Brown", "Avellaneda", "Beha Blanca", "Crdoba"] |
||||
} |
@ -0,0 +1,29 @@
|
||||
import { expect } from "@playwright/test"; |
||||
import { CellPageObject } from "."; |
||||
import BasePage from "../../../Base"; |
||||
|
||||
export class AttachmentCellPageObject extends BasePage { |
||||
readonly cell: CellPageObject; |
||||
|
||||
constructor(cell: CellPageObject) { |
||||
super(cell.rootPage); |
||||
this.cell = cell; |
||||
} |
||||
|
||||
get({index, columnHeader}: {index?: number, columnHeader: string}) { |
||||
return this.cell.get({index, columnHeader}); |
||||
} |
||||
|
||||
clickFilePicker({ index, columnHeader }: { index?: number, columnHeader: string }) { |
||||
return this.get({index, columnHeader}).locator('[pw-data="attachment-cell-file-picker-button"]').click(); |
||||
} |
||||
|
||||
async addFile({ index, columnHeader, filePath }: { index?: number, columnHeader: string, filePath: string; }) { |
||||
const attachFileAction = this.get({index, columnHeader}).locator('[pw-data="attachment-cell-file-picker-button"]').click(); |
||||
return this.attachFile({ filePickUIAction: attachFileAction, filePath }); |
||||
} |
||||
|
||||
async verifyFile({ index, columnHeader }: { index: number, columnHeader: string }) { |
||||
expect(await this.get({index, columnHeader}).locator('.nc-attachment')).toBeVisible(); |
||||
} |
||||
} |
@ -1,29 +1,39 @@
|
||||
import { expect, Locator } from "@playwright/test"; |
||||
import { GridPage } from ".."; |
||||
import { GridPage } from "../../Grid"; |
||||
import BasePage from "../../../Base"; |
||||
import { AttachmentCellPageObject } from "./AttachmentCell"; |
||||
import { SelectOptionCellPageObject } from "./SelectOptionCell"; |
||||
import { SharedFormPage } from "../../../SharedForm"; |
||||
|
||||
export class CellPageObject extends BasePage { |
||||
readonly grid: GridPage; |
||||
readonly parent: GridPage | SharedFormPage; |
||||
readonly selectOption: SelectOptionCellPageObject; |
||||
readonly attachment: AttachmentCellPageObject; |
||||
|
||||
constructor(grid: GridPage) { |
||||
super(grid.rootPage); |
||||
this.grid = grid; |
||||
constructor(parent: GridPage | SharedFormPage) { |
||||
super(parent.rootPage); |
||||
this.parent = parent; |
||||
this.selectOption = new SelectOptionCellPageObject(this); |
||||
this.attachment = new AttachmentCellPageObject(this); |
||||
} |
||||
|
||||
get({ |
||||
index, |
||||
columnHeader, |
||||
}: { |
||||
index: number; |
||||
index?: number; |
||||
columnHeader: string; |
||||
}): Locator { |
||||
return this.grid |
||||
if(this.parent instanceof SharedFormPage) { |
||||
return this.parent |
||||
.get() |
||||
.locator(`[pw-data="nc-form-input-cell-${columnHeader}"]`); |
||||
} else { |
||||
return this.parent |
||||
.get() |
||||
.locator(`td[data-pw="cell-${columnHeader}-${index}"]`); |
||||
} |
||||
} |
||||
|
||||
async click({ |
||||
index, |
@ -0,0 +1,21 @@
|
||||
// playwright-dev-page.ts
|
||||
import { Locator, Page, expect } from "@playwright/test"; |
||||
import BasePage from "../Base"; |
||||
import { CellPageObject } from "../Dashboard/common/Cell"; |
||||
|
||||
export class SharedFormPage extends BasePage { |
||||
readonly cell: CellPageObject; |
||||
|
||||
constructor(rootPage: Page) { |
||||
super(rootPage); |
||||
this.cell = new CellPageObject(this); |
||||
} |
||||
|
||||
get() { |
||||
return this.rootPage.locator("html"); |
||||
} |
||||
|
||||
async submit() { |
||||
await this.get().locator('[pw-data="shared-form-submit-button"]').click(); |
||||
} |
||||
} |
@ -0,0 +1,39 @@
|
||||
import { test } from "@playwright/test"; |
||||
import { DashboardPage } from "../pages/Dashboard"; |
||||
import { SharedFormPage } from "../pages/SharedForm"; |
||||
import setup from "../setup"; |
||||
|
||||
test.describe("Attachment column", () => { |
||||
let dashboard: DashboardPage; |
||||
let context: any; |
||||
|
||||
test.beforeEach(async ({ page }) => { |
||||
context = await setup({ page }); |
||||
dashboard = new DashboardPage(page, context.project); |
||||
}); |
||||
|
||||
test("Create duration column", async ({page, context}) => { |
||||
await dashboard.treeView.openTable({title: "Country"}); |
||||
await dashboard.grid.column.create({ |
||||
title: "testAttach", |
||||
type: "Attachment", |
||||
}) |
||||
for (let i = 4; i <= 6; i++) { |
||||
const filepath = `${process.cwd()}/fixtures/sampleFiles/${i}.json`; |
||||
await dashboard.grid.cell.attachment.addFile({index: i, columnHeader: "testAttach", filePath: filepath}); |
||||
await dashboard.grid.cell.attachment.verifyFile({index: i, columnHeader: "testAttach"}); |
||||
} |
||||
|
||||
await dashboard.viewSidebar.createFormView({ |
||||
title: "Form 1", |
||||
}); |
||||
await dashboard.form.toolbar.clickShareView(); |
||||
const sharedFormUrl = await dashboard.form.toolbar.shareView.getShareLink(); |
||||
const newPage = await context.newPage() |
||||
await newPage.goto(sharedFormUrl); |
||||
|
||||
const sharedForm = new SharedFormPage(newPage); |
||||
await sharedForm.cell.attachment.addFile({columnHeader: 'testAttach', filePath: `${process.cwd()}/fixtures/sampleFiles/1.json`}); |
||||
await sharedForm.submit(); |
||||
}); |
||||
}); |
Loading…
Reference in new issue