From e34f39ac75be678e729be4b5795bc73d88cbfdaf Mon Sep 17 00:00:00 2001 From: Cristhian Zanforlin Lousa Date: Tue, 21 Jan 2025 17:45:10 -0300 Subject: [PATCH] test: update data-testid attributes for chat memory and OpenAI model elements (#5823) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 🐛 (generalBugs-shard-9.spec.ts): fix incorrect test selector for elementChatMemoryOutput to match updated element ID 🐛 (generalBugs-shard-3.spec.ts): fix incorrect test selector for elementsOpenAiOutput to match updated element ID * 📝 (refreshButton.tsx): add data-testid attribute to RefreshButton component for testing purposes 🐛 (Vector Store.spec.ts): fix import statement to include 'expect' in Playwright test file 🐛 (Vector Store.spec.ts): remove unnecessary test.skip block for ASTRA_DB_API_ENDPOINT 🐛 (Vector Store.spec.ts): fix selectors and interactions for refresh buttons and dropdown options in Playwright test file * ✨ (freeze-path.spec.ts): refactor test cases to use a new helper function moveSlider for interacting with slider elements in a more efficient and readable way --- .../src/components/ui/refreshButton.tsx | 1 + .../tests/core/features/freeze-path.spec.ts | 40 ++++++++----- .../core/integrations/Vector Store.spec.ts | 57 +++++++++++++++---- 3 files changed, 72 insertions(+), 26 deletions(-) diff --git a/src/frontend/src/components/ui/refreshButton.tsx b/src/frontend/src/components/ui/refreshButton.tsx index f0797f5d3..0439eafc5 100644 --- a/src/frontend/src/components/ui/refreshButton.tsx +++ b/src/frontend/src/components/ui/refreshButton.tsx @@ -48,6 +48,7 @@ function RefreshButton({ id={id} size={"icon"} loading={isLoading} + data-testid={id} > {button_text && {button_text}} enabled transition + await page.getByTestId("refresh-button-api_endpoint").first().click(); + await expect( + page.getByTestId("refresh-button-api_endpoint").first(), + ).toHaveAttribute("disabled", ""); + await expect( + page.getByTestId("refresh-button-api_endpoint").first(), + ).not.toHaveAttribute("disabled", ""); + + // Click second refresh button and wait for disabled->enabled transition + await page.getByTestId("refresh-button-api_endpoint").last().click(); + await expect( + page.getByTestId("refresh-button-api_endpoint").last(), + ).toHaveAttribute("disabled", ""); + await expect( + page.getByTestId("refresh-button-api_endpoint").last(), + ).not.toHaveAttribute("disabled", ""); + + await page.getByTestId("dropdown_str_api_endpoint").first().click(); + + await page.waitForSelector('[data-testid="langflow-1-option"]', { + timeout: 100000, + }); + + await page.getByTestId("langflow-1-option").last().click(); + + await page.getByTestId("dropdown_str_api_endpoint").last().click(); + + await page.waitForSelector('[data-testid="langflow-1-option"]', { + timeout: 100000, + }); + + await page.getByTestId("langflow-1-option").last().click(); const fileChooserPromise = page.waitForEvent("filechooser"); await page.getByTestId("input-file-component").last().click();