parent
877638bbda
commit
2f9f80f7b6
2 changed files with 27 additions and 26 deletions
|
|
@ -596,17 +596,17 @@ test(
|
|||
);
|
||||
|
||||
test(
|
||||
"should show PNG file as disabled in file component",
|
||||
"should show PSD file as disabled in file component",
|
||||
{
|
||||
tag: ["@release", "@workspace"],
|
||||
},
|
||||
async ({ page }) => {
|
||||
// Generate unique filenames for this test run
|
||||
const pngFileName = generateRandomFilename();
|
||||
const psdFileName = generateRandomFilename();
|
||||
const txtFileName = generateRandomFilename();
|
||||
|
||||
// Create PNG content (a simple 1x1 transparent PNG)
|
||||
const pngFileContent = Buffer.from(
|
||||
// Create PSD content (just a mock)
|
||||
const psdFileContent = Buffer.from(
|
||||
"iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mNk+M9QDwADhgGAWjR9awAAAABJRU5ErkJggg==",
|
||||
"base64",
|
||||
);
|
||||
|
|
@ -626,24 +626,24 @@ test(
|
|||
const title = await page.getByTestId("mainpage_title");
|
||||
expect(await title.textContent()).toContain("Files");
|
||||
|
||||
// Upload the PNG file
|
||||
const fileChooserPromisePng = page.waitForEvent("filechooser");
|
||||
// Upload the PSD file
|
||||
const fileChooserPromisePsd = page.waitForEvent("filechooser");
|
||||
await page.getByTestId("upload-file-btn").click();
|
||||
|
||||
const fileChooserPng = await fileChooserPromisePng;
|
||||
await fileChooserPng.setFiles([
|
||||
const fileChooserPsd = await fileChooserPromisePsd;
|
||||
await fileChooserPsd.setFiles([
|
||||
{
|
||||
name: `${pngFileName}.png`,
|
||||
mimeType: "image/png",
|
||||
buffer: pngFileContent,
|
||||
name: `${psdFileName}.psd`,
|
||||
mimeType: "image/vnd.adobe.photoshop",
|
||||
buffer: psdFileContent,
|
||||
},
|
||||
]);
|
||||
|
||||
// Wait for upload success message
|
||||
await expect(page.getByText("File uploaded successfully")).toBeVisible();
|
||||
|
||||
// Verify PNG file appears in the list
|
||||
await expect(page.getByText(`${pngFileName}.png`)).toBeVisible();
|
||||
// Verify PSD file appears in the list
|
||||
await expect(page.getByText(`${psdFileName}.psd`)).toBeVisible();
|
||||
|
||||
// Upload the TXT file
|
||||
const fileChooserPromiseTxt = page.waitForEvent("filechooser");
|
||||
|
|
@ -664,7 +664,7 @@ test(
|
|||
// Verify TXT file appears in the list
|
||||
await expect(page.getByText(`${txtFileName}.txt`)).toBeVisible();
|
||||
|
||||
// Step 2: Create a flow with File component and check if PNG file is disabled
|
||||
// Step 2: Create a flow with File component and check if PSD file is disabled
|
||||
// Navigate to workspace page
|
||||
await page.getByText("Starter Project").first().click();
|
||||
|
||||
|
|
@ -696,10 +696,10 @@ test(
|
|||
|
||||
// Open the file management modal
|
||||
await page.getByTestId("button_open_file_management").click();
|
||||
console.warn(pngFileName);
|
||||
console.warn(psdFileName);
|
||||
|
||||
// Check if the PNG file has the disabled class (greyed out)
|
||||
await expect(page.getByTestId(`file-item-${pngFileName}`)).toHaveClass(
|
||||
// Check if the PSD file has the disabled class (greyed out)
|
||||
await expect(page.getByTestId(`file-item-${psdFileName}`)).toHaveClass(
|
||||
/pointer-events-none cursor-not-allowed opacity-50/,
|
||||
);
|
||||
|
||||
|
|
@ -708,9 +708,9 @@ test(
|
|||
/pointer-events-none cursor-not-allowed opacity-50/,
|
||||
);
|
||||
|
||||
// Verify the tooltip for PNG file states it's not supported
|
||||
// Verify the tooltip for PSD file states it's not supported
|
||||
await page
|
||||
.locator(`[data-testid="file-item-${pngFileName}"]`)
|
||||
.locator(`[data-testid="file-item-${psdFileName}"]`)
|
||||
.locator("..")
|
||||
.hover();
|
||||
|
||||
|
|
@ -718,11 +718,11 @@ test(
|
|||
page.getByText("Type not supported by component"),
|
||||
).toBeVisible();
|
||||
|
||||
// Try to select the PNG file (should not change its state)
|
||||
await expect(page.getByTestId(`checkbox-${pngFileName}`)).toBeDisabled();
|
||||
// Try to select the PSD file (should not change its state)
|
||||
await expect(page.getByTestId(`checkbox-${psdFileName}`)).toBeDisabled();
|
||||
|
||||
// Verify the PNG file checkbox remains unchecked
|
||||
await expect(page.getByTestId(`checkbox-${pngFileName}`)).toHaveAttribute(
|
||||
// Verify the PSD file checkbox remains unchecked
|
||||
await expect(page.getByTestId(`checkbox-${psdFileName}`)).toHaveAttribute(
|
||||
"data-state",
|
||||
"unchecked",
|
||||
);
|
||||
|
|
@ -741,6 +741,6 @@ test(
|
|||
|
||||
// Verify that only the TXT file was selected in the component
|
||||
await expect(page.getByText(`${txtFileName}.txt`)).toBeVisible();
|
||||
await expect(page.getByText(`${pngFileName}.png`)).not.toBeVisible();
|
||||
await expect(page.getByText(`${psdFileName}.psd`)).not.toBeVisible();
|
||||
},
|
||||
);
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ test(
|
|||
const elementTestIds = [
|
||||
"input_outputChat Output",
|
||||
"dataAPI Request",
|
||||
"vectorstoresAstra DB",
|
||||
"vectorstoresAstra DB Graph",
|
||||
"langchain_utilitiesTool Calling Agent",
|
||||
"langchain_utilitiesConversationChain",
|
||||
"mem0Mem0 Chat Memory",
|
||||
|
|
@ -90,10 +90,11 @@ test(
|
|||
);
|
||||
|
||||
await Promise.all(
|
||||
elementTestIds.map((id) => {
|
||||
elementTestIds.map(async (id) => {
|
||||
if (!expect(page.getByTestId(id).first()).toBeVisible()) {
|
||||
console.error(`${id} is not visible`);
|
||||
}
|
||||
return expect(page.getByTestId(id).first()).toBeVisible();
|
||||
}),
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue