mirror of
https://github.com/nocodb/nocodb.git
synced 2026-04-25 02:55:29 +00:00
tests: update attachments tests
This commit is contained in:
@@ -205,7 +205,7 @@ const handleFileDelete = (i: number) => {
|
||||
|
||||
<template>
|
||||
<div v-if="isExpandedForm || isForm" class="form-attachment-cell">
|
||||
<NcButton type="secondary" size="small" @click="open">
|
||||
<NcButton data-testid="attachment-cell-file-picker-button" type="secondary" size="small" @click="open">
|
||||
<div class="flex items-center !text-xs gap-1 justify-center">
|
||||
<MaterialSymbolsAttachFile class="text-gray-500 text-tiny" />
|
||||
<span class="text-[10px]">
|
||||
@@ -295,7 +295,6 @@ const handleFileDelete = (i: number) => {
|
||||
v-if="!isReadonly && active && !visibleItems.length"
|
||||
:class="{ 'sm:(mx-auto px-4) xs:(w-full min-w-8)': !visibleItems.length }"
|
||||
class="group cursor-pointer py-1 flex gap-1 items-center rounded border-none"
|
||||
data-testid="attachment-cell-file-picker-button"
|
||||
tabindex="0"
|
||||
@keydown.enter="keydownEnter"
|
||||
@keydown.space="keydownSpace"
|
||||
|
||||
@@ -21,9 +21,22 @@ export class AttachmentCellPageObject extends BasePage {
|
||||
// filePath: to attach multiple files, pass an array of file paths
|
||||
// e.g. ['path/to/file1', 'path/to/file2']
|
||||
//
|
||||
async addFile({ index, columnHeader, filePath }: { index?: number; columnHeader: string; filePath: string[] }) {
|
||||
async addFile({
|
||||
index,
|
||||
columnHeader,
|
||||
filePath,
|
||||
skipElemClick,
|
||||
}: {
|
||||
index?: number;
|
||||
columnHeader: string;
|
||||
filePath: string[];
|
||||
skipElemClick?: boolean;
|
||||
}) {
|
||||
await this.get({ index, columnHeader }).scrollIntoViewIfNeeded();
|
||||
await this.get({ index, columnHeader }).click({ position: { x: 1, y: 1 } });
|
||||
|
||||
if (!skipElemClick) {
|
||||
await this.get({ index, columnHeader }).click({ position: { x: 1, y: 1 } });
|
||||
}
|
||||
|
||||
await this.get({ index, columnHeader }).locator('[data-testid="attachment-cell-file-picker-button"]').click();
|
||||
|
||||
|
||||
@@ -78,6 +78,7 @@ test.describe('Attachment column', () => {
|
||||
await sharedForm.cell.attachment.addFile({
|
||||
columnHeader: 'testAttach',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/1.json`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
|
||||
await sharedForm.rootPage.waitForTimeout(1000);
|
||||
|
||||
@@ -226,6 +226,7 @@ test.describe('Form view', () => {
|
||||
await sharedForm.cell.attachment.addFile({
|
||||
columnHeader: 'Attachment',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
await sharedForm.cell.fillText({
|
||||
columnHeader: 'Title',
|
||||
@@ -1355,6 +1356,7 @@ test.describe('Form view: field validation', () => {
|
||||
await sharedForm.cell.attachment.addFile({
|
||||
columnHeader: 'Attachment',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
|
||||
const attError = await sharedForm.getFormFieldErrors({ title: 'Attachment' });
|
||||
@@ -1369,6 +1371,7 @@ test.describe('Form view: field validation', () => {
|
||||
await sharedForm.cell.attachment.addFile({
|
||||
columnHeader: 'Attachment',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/Image/2.png`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
await attError.verify({ hasError: false });
|
||||
|
||||
@@ -1401,6 +1404,7 @@ test.describe('Form view: field validation', () => {
|
||||
await surveyForm.cell.attachment.addFile({
|
||||
columnHeader: 'Attachment',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/sampleImage.jpeg`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
|
||||
const surveryAttError = await surveyForm.getFormFieldErrors();
|
||||
@@ -1415,6 +1419,7 @@ test.describe('Form view: field validation', () => {
|
||||
await surveyForm.cell.attachment.addFile({
|
||||
columnHeader: 'Attachment',
|
||||
filePath: [`${process.cwd()}/fixtures/sampleFiles/Image/2.png`],
|
||||
skipElemClick: true,
|
||||
});
|
||||
await surveryAttError.verify({ hasError: false });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user