* change tests to use utils libs * 🔧 (frontend): add data-testid attribute to buttons in baseModal and secretKeyModal components 🔧 (frontend): add data-testid attribute to buttons in various test files for improved testing 🔧 (frontend): refactor awaitBootstrapTest function to remove skipNewFlow option and improve modal handling * ✅ (userSettings.spec.ts): add a 1-second timeout before checking for the "Please save" text to ensure it is rendered on the page before interacting with it * ✅ (userSettings.spec.ts): add comment to clarify waiting for API key creation to complete before proceeding to the next form element * ✨ (freeze-path.spec.ts): refactor adjustScreenView function to accept a parameter for the number of zoom outs to perform, improving flexibility and reusability in test scenarios. 🔧 (freeze-path.spec.ts): replace adjustScreenView function with initialGPTsetup function for setting up initial GPT configuration in the test scenario.
67 lines
2.6 KiB
TypeScript
67 lines
2.6 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
|
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
|
|
|
test(
|
|
"user must be able to save or delete a global variable",
|
|
{ tag: ["@release", "@workspace", "@api"] },
|
|
async ({ page }) => {
|
|
await awaitBootstrapTest(page);
|
|
|
|
await page.waitForSelector('[data-testid="blank-flow"]', {
|
|
timeout: 30000,
|
|
});
|
|
await page.getByTestId("blank-flow").click();
|
|
await page.getByTestId("sidebar-search-input").click();
|
|
await page.getByTestId("sidebar-search-input").fill("openai");
|
|
|
|
await page.waitForSelector('[data-testid="modelsOpenAI"]', {
|
|
timeout: 1000,
|
|
});
|
|
|
|
await page
|
|
.getByTestId("modelsOpenAI")
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await page.mouse.up();
|
|
await page.mouse.down();
|
|
|
|
await adjustScreenView(page);
|
|
|
|
const genericName = Math.random().toString();
|
|
const credentialName = Math.random().toString();
|
|
|
|
await page.getByTestId("icon-Globe").nth(0).click();
|
|
await page.getByText("Add New Variable", { exact: true }).click();
|
|
await page
|
|
.getByPlaceholder("Insert a name for the variable...")
|
|
.fill(genericName);
|
|
await page.getByText("Generic", { exact: true }).first().isVisible();
|
|
await page
|
|
.getByPlaceholder("Insert a value for the variable...")
|
|
.fill("This is a test of generic variable value");
|
|
await page.getByText("Save Variable", { exact: true }).click();
|
|
expect(page.getByText(genericName, { exact: true })).not.toBeNull();
|
|
await page.getByText(genericName, { exact: true }).isVisible();
|
|
|
|
await page.getByText("Add New Variable", { exact: true }).click();
|
|
await page
|
|
.getByPlaceholder("Insert a name for the variable...")
|
|
.fill(credentialName);
|
|
await page.getByTestId("select-type-global-variables").first().click();
|
|
await page.getByText("Credential", { exact: true }).last().click();
|
|
await page
|
|
.getByPlaceholder("Insert a value for the variable...")
|
|
.fill("This is a test of credential variable value");
|
|
await page.getByText("Save Variable", { exact: true }).click();
|
|
expect(page.getByText(credentialName, { exact: true })).not.toBeNull();
|
|
await page.getByText(credentialName, { exact: true }).isVisible();
|
|
|
|
await page
|
|
.getByText(credentialName, { exact: true })
|
|
.hover()
|
|
.then(async () => {
|
|
await page.getByTestId("icon-Trash2").last().click();
|
|
await page.getByText("Delete", { exact: true }).nth(1).click();
|
|
});
|
|
},
|
|
);
|