Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add undo/redo check #3893

Merged
merged 5 commits into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 31 additions & 1 deletion src/frontend/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,37 @@ export default defineConfig({
},
},
},

// {
// name: "firefox",
// use: {
// ...devices["Desktop Firefox"],
// launchOptions: {
// // headless: false,
// firefoxUserPrefs: {
// "dom.events.asyncClipboard.readText": true,
// "dom.events.testing.asyncClipboard": true,
// },
// },
// },
// },
// {
// name: "safari",
// use: {
// ...devices["Desktop Safari"],
// launchOptions: {
// // headless: false,
// },
// },
// },
// {
// name: "arc",
// use: {
// ...devices["Desktop Arc"],
// launchOptions: {
// // headless: false,
// },
// },
// },
// {
// name: "firefox",
// use: {
Expand Down
15 changes: 15 additions & 0 deletions src/frontend/tests/extended/features/langflowShortcuts.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,19 @@ test("LangflowShortcuts", async ({ page }) => {
if (numberOfNodes != 1) {
expect(false).toBeTruthy();
}

// Test undo (Command+Z or Control+Z)
await page.getByTestId("title-Ollama").click();
await page.keyboard.press("Backspace");
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
expect(numberOfNodes).toBe(0);

await page.keyboard.press(`${control}+z`);
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
expect(numberOfNodes).toBe(1);

// Test redo (Command+Y or Control+Y)
await page.keyboard.press(`${control}+y`);
numberOfNodes = await page.getByTestId("title-Ollama")?.count();
expect(numberOfNodes).toBe(0);
});
21 changes: 15 additions & 6 deletions src/frontend/tests/globalTeardown.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,22 @@ export default async () => {
// temp is in src/frontend/temp
const tempDbPath = path.join(__dirname, "..", "temp");
console.log("tempDbPath", tempDbPath);
// Remove the temp database
fs.rmSync(tempDbPath);
// Check if the file is removed
if (!fs.existsSync(tempDbPath)) {
console.log("Successfully removed the temp database");

// Check if the directory exists before attempting to remove it
if (fs.existsSync(tempDbPath)) {
// Remove the temp database
fs.rmSync(tempDbPath, { recursive: true, force: true });

// Check if the file is removed
if (!fs.existsSync(tempDbPath)) {
console.log("Successfully removed the temp database");
} else {
console.error(
"Error: temp database still exists after removal attempt",
);
}
} else {
console.error("Error while removing the temp database");
console.log("Temp database directory does not exist, skipping removal");
}
} catch (error) {
console.error("Error while removing the temp database:", error);
Expand Down
Loading