test: improve test reliability with updated selectors and utility functions (#7943)

✨ (auto-login-off.spec.ts): update text selector to match new welcome message for improved test accuracy
♻️ (user-flow-state-cleanup.spec.ts): refactor test to use the new welcome message selector for consistency and accuracy
📝 (autoLogin.spec.ts): add import statement for awaitBootstrapTest utility function to fix test failures due to missing import
This commit is contained in:
Cristhian Zanforlin Lousa 2025-05-07 17:13:56 -03:00 • committed by GitHub
commit 4995a19609
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 14 additions and 14 deletions

View file

@ -206,12 +206,9 @@ test(
expect( expect(
( (
await page.waitForSelector( await page.waitForSelector("text=Welcome to LangFlow", {
"text=Begin with a template, or start from scratch.", timeout: 30000,
{ })
timeout: 30000,
},
)
).isVisible(), ).isVisible(),
); );

View file

@ -3,7 +3,7 @@ import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test( test(
"flow state should be properly cleaned up between user sessions", "flow state should be properly cleaned up between user sessions",
{ tag: ["@bug-fix", "@api", "@database"] }, { tag: ["@release", "@api", "@database"] },
async ({ page }) => { async ({ page }) => {
// Disable auto login // Disable auto login
await page.route("**/api/v1/auto_login", (route) => { await page.route("**/api/v1/auto_login", (route) => {
@ -89,10 +89,9 @@ test(
// Check that User A starts with an empty flows list // Check that User A starts with an empty flows list
expect( expect(
( (
await page.waitForSelector( await page.waitForSelector("text=Welcome to LangFlow", {
"text=Begin with a template, or start from scratch.", timeout: 30000,
{ timeout: 30000 }, })
)
).isVisible(), ).isVisible(),
); );

View file

@ -1,5 +1,5 @@
import { test } from "@playwright/test"; import { test } from "@playwright/test";
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
test.describe( test.describe(
"Auto_login tests", "Auto_login tests",
{ tag: ["@release", "@api", "@database"] }, { tag: ["@release", "@api", "@database"] },
@ -9,7 +9,9 @@ test.describe(
"auto_login sign in", "auto_login sign in",
{ tag: ["@release", "@api", "@database"] }, { tag: ["@release", "@api", "@database"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page, {
skipModal: true,
});
await page.getByText("New Flow", { exact: true }).click(); await page.getByText("New Flow", { exact: true }).click();
}, },
); );
@ -18,7 +20,9 @@ test.describe(
"auto_login block_admin", "auto_login block_admin",
{ tag: ["@release", "@api", "@database"] }, { tag: ["@release", "@api", "@database"] },
async ({ page }) => { async ({ page }) => {
await page.goto("/"); await awaitBootstrapTest(page, {
skipModal: true,
});
await page.getByText("New Flow", { exact: true }).click(); await page.getByText("New Flow", { exact: true }).click();
await page.waitForSelector('[data-testid="modal-title"]', { await page.waitForSelector('[data-testid="modal-title"]', {
timeout: 5000, timeout: 5000,