test: fix general test and CI (#2839)

🔧 (typescript_test.yml): Remove unnecessary steps and conditions in GitHub Actions workflow file
🔧 (authContext.tsx): Update cookie key from LANGFLOW_ACCESS_TOKEN to LANGFLOW_API_TOKEN for consistency
🔧 (Basic Prompting.spec.ts): Update test to click on correct dropdown option
🔧 (filterEdge-shard-0.spec.ts): Update test to check for correct element
🔧 (filterSidebar.spec.ts): Update test to check for correct elements
🔧 (generalBugs-shard-5.spec.ts): Update test to interact with correct element
🔧 (inputComponent.spec.ts): Update test to interact with correct elements
🔧 (store-shard-1.spec.ts): Update test to interact with correct elements and remove unnecessary code
This commit is contained in:
Cristhian Zanforlin Lousa 2024-07-19 15:38:14 -03:00 committed by GitHub
commit 9c9d916d80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 34 deletions

View file

@ -110,15 +110,8 @@ jobs:
run: |
cd src/frontend
npx playwright test --trace on --shard ${{ matrix.shardIndex }}/${{ matrix.shardTotal }} --workers 2
continue-on-error: true
timeout-minutes: 12
# If the test fails, set a flag to indicate that the shard failed
- name: Set failure flag
id: check-failure
if: failure()
run: echo "failed=true" >> "$GITHUB_OUTPUT"
- name: Upload blob report to GitHub Actions Artifacts
if: always()
uses: actions/upload-artifact@v4
@ -130,7 +123,6 @@ jobs:
merge-reports:
needs: setup-and-test
runs-on: ubuntu-latest
if: ${{ needs.setup-and-test.outputs.failed == 'true' }}
steps:
- name: Checkout code
uses: actions/checkout@v4
@ -157,11 +149,3 @@ jobs:
name: html-report--attempt-${{ github.run_attempt }}
path: playwright-report
retention-days: 14
delete-reports:
needs: setup-and-test
runs-on: ubuntu-latest
if: ${{ needs.setup-and-test.outputs.failed != 'true' }}
steps:
- uses: geekyeggo/delete-artifact@v5
with:
name: blob-report-*

View file

@ -126,7 +126,7 @@ export function AuthProvider({ children }): React.ReactElement {
}
function storeApiKey(apikey: string) {
cookies.set(LANGFLOW_ACCESS_TOKEN, apikey, { path: "/" });
cookies.set(LANGFLOW_API_TOKEN, apikey, { path: "/" });
setApiKey(apikey);
}

View file

@ -47,7 +47,7 @@ test("Basic Prompting (Hello, World)", async ({ page }) => {
.fill(process.env.OPENAI_API_KEY ?? "");
await page.getByTestId("dropdown-model_name").click();
await page.getByTestId("gpt-4o-0-option").click();
await page.getByTestId("gpt-4o-1-option").click();
await page.waitForTimeout(2000);

View file

@ -170,7 +170,7 @@ test("RetrievalQA - Tooltip", async ({ page }) => {
await visibleElementHandle.hover().then(async () => {
await expect(
page.getByTestId("available-input-memories").first(),
page.getByTestId("available-input-helpers").first(),
).toBeVisible();
});
});

View file

@ -91,7 +91,7 @@ test("LLMChain - Filter", async ({ page }) => {
await expect(page.getByTestId("dataAPI Request")).toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).toBeVisible();
await expect(page.getByTestId("langchain_utilitiesSearchApi")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await expect(page.getByTestId("prototypesSub Flow")).toBeVisible();
await expect(
page.getByTestId("retrieversSelf Query Retriever"),
@ -99,16 +99,14 @@ test("LLMChain - Filter", async ({ page }) => {
await expect(
page.getByTestId("textsplittersCharacterTextSplitter"),
).toBeVisible();
await expect(page.getByTestId("toolsSearchApi")).toBeVisible();
await expect(page.getByTestId("toolsSearch API")).toBeVisible();
await page.getByPlaceholder("Search").click();
await expect(page.getByTestId("dataAPI Request")).not.toBeVisible();
await expect(page.getByTestId("helpersChat Memory")).not.toBeVisible();
await expect(page.getByTestId("vectorstoresAstra DB")).not.toBeVisible();
await expect(
page.getByTestId("langchain_utilitiesSearchApi"),
).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
await expect(page.getByTestId("prototypesSub Flow")).not.toBeVisible();
await expect(
page.getByTestId("retrieversSelf Query Retriever"),
@ -116,5 +114,5 @@ test("LLMChain - Filter", async ({ page }) => {
await expect(
page.getByTestId("textsplittersCharacterTextSplitter"),
).not.toBeVisible();
await expect(page.getByTestId("toolsSearchApi")).not.toBeVisible();
await expect(page.getByTestId("toolsSearch API")).not.toBeVisible();
});

View file

@ -218,10 +218,11 @@ test("should be able to see output preview from grouped components", async ({
await page.getByTestId("button_run_text output").last().click();
await page.waitForSelector("text=Text Output built successfully", {
timeout: 30000,
});
await page.waitForSelector("text=built successfully", { timeout: 30000 });
await page.getByText("built successfully").last().click({
timeout: 15000,
});
await page.waitForTimeout(3000);
expect(

View file

@ -130,11 +130,11 @@ test("InputComponent", async ({ page }) => {
expect(false).toBeTruthy();
}
await page.getByTestId("popover-anchor-input-collection_name-edit").click();
await page
.getByTestId("popover-anchor-input-collection_name-edit")
.fill("NEW_collection_name_test_123123123!@#$&*(&%$@ÇÇÇÀõe");
await page.waitForTimeout(1000);
await page.getByText("Close").last().click();
const plusButtonLocator = page.getByTestId("input-collection_name");
@ -147,11 +147,6 @@ test("InputComponent", async ({ page }) => {
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.locator('//*[@id="showcollection_name"]').click();
expect(
await page.locator('//*[@id="showcollection_name"]').isChecked(),
).toBeTruthy();
await page.getByText("Close").last().click();
let value = await page

View file

@ -15,6 +15,26 @@ test("should like and add components and flows", async ({ page }) => {
await page.goto("/");
await page.waitForTimeout(1000);
let modalCount = 0;
try {
const modalTitleElement = await page?.getByTestId("modal-title");
if (modalTitleElement) {
modalCount = await modalTitleElement.count();
}
} catch (error) {
modalCount = 0;
}
while (modalCount === 0) {
await page.getByText("New Project", { exact: true }).click();
await page.waitForTimeout(5000);
modalCount = await page.getByTestId("modal-title")?.count();
}
await page.getByText("Close", { exact: true }).click();
await page.waitForTimeout(1000);
await page.getByTestId("button-store").click();
await page.waitForTimeout(1000);