* 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.
85 lines
2.9 KiB
TypeScript
85 lines
2.9 KiB
TypeScript
import { expect, test } from "@playwright/test";
|
|
import { adjustScreenView } from "../../utils/adjust-screen-view";
|
|
import { awaitBootstrapTest } from "../../utils/await-bootstrap-test";
|
|
|
|
test(
|
|
"NestedComponent",
|
|
{ tag: ["@release", "@workspace"] },
|
|
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("api request");
|
|
|
|
await page.waitForSelector('[data-testid="dataAPI Request"]', {
|
|
timeout: 3000,
|
|
});
|
|
|
|
await page
|
|
.getByTestId("dataAPI Request")
|
|
.first()
|
|
.dragTo(page.locator('//*[@id="react-flow-id"]'));
|
|
await page.click('//*[@id="react-flow-id"]');
|
|
|
|
await adjustScreenView(page);
|
|
|
|
await page.getByTestId("dict_nesteddict_headers").first().click();
|
|
await page
|
|
.getByText("{")
|
|
.last()
|
|
.hover()
|
|
.then(async () => {
|
|
await page.locator(".json-view--edit").first().click();
|
|
await page.locator(".json-view--input").first().fill("keytest");
|
|
await page.locator(".json-view--edit").first().click();
|
|
|
|
await page.locator(".json-view--edit").first().click();
|
|
await page.locator(".json-view--input").first().fill("keytest1");
|
|
await page.locator(".json-view--edit").first().click();
|
|
|
|
await page.locator(".json-view--edit").first().click();
|
|
await page.locator(".json-view--input").first().fill("keytest2");
|
|
await page.locator(".json-view--edit").first().click();
|
|
});
|
|
|
|
await page
|
|
.locator(".json-view--pair")
|
|
.first()
|
|
.hover()
|
|
.then(async () => {
|
|
await page.locator(".json-view--edit").nth(2).click();
|
|
await page.locator(".json-view--null").first().fill("proptest1");
|
|
await page.locator(".json-view--edit").nth(2).click();
|
|
});
|
|
|
|
await page.getByText("Save").last().click();
|
|
|
|
await page.getByTestId("div-generic-node").click();
|
|
|
|
await page.getByTestId("more-options-modal").click();
|
|
await page.getByTestId("advanced-button-modal").click();
|
|
|
|
await page.getByTestId("dict_nesteddict_edit_headers").first().click();
|
|
|
|
expect(await page.getByText("keytest", { exact: true }).count()).toBe(1);
|
|
expect(await page.getByText("keytest1", { exact: true }).count()).toBe(1);
|
|
expect(await page.getByText("keytest2", { exact: true }).count()).toBe(1);
|
|
expect(await page.getByText("proptest1").count()).toBe(1);
|
|
|
|
await page
|
|
.locator(".json-view--pair")
|
|
.first()
|
|
.hover()
|
|
.then(async () => {
|
|
await page.locator(".json-view--edit").nth(3).click();
|
|
await page.locator(".json-view--edit").nth(2).click();
|
|
});
|
|
|
|
expect(await page.getByText("keytest", { exact: true }).count()).toBe(0);
|
|
expect(await page.getByText("proptest1").count()).toBe(0);
|
|
},
|
|
);
|