fix(SanitizedHTMLWrapper): add data-testid attribute to the div element for testing purposes

fix(genericIconComponent): add data-testid attribute to the TargetIcon component for testing purposes

fix(promptComponent): add data-testid attribute to the span element for testing purposes

fix(textAreaComponent): add data-testid attribute to the IconComponent component for testing purposes

fix(genericModal): add data-testid attribute to the Textarea component and the input element for testing purposes

fix(types/components): add id property to IconComponentProps type

test(flowPage.spec): update click actions to use getByTestId method for testing purposes

test(intComponent.spec): update fill action to set a different value for testing purposes

test(promptModalComponent.spec): update click and fill actions to use getByTestId method for testing purposes
This commit is contained in:
cristhianzl 2023-11-24 16:03:33 -03:00
commit d35ce3d48b
9 changed files with 40 additions and 21 deletions

View file

@ -14,7 +14,7 @@ test.describe("Flow Page tests", () => {
.filter({ hasText: /^Custom Component$/ })
.nth(4)
.dragTo(page.locator(".react-flow__pane"));
await page.locator("div:nth-child(4) > .extra-side-bar-buttons").click();
await page.locator(".success-alert").click();
await page.getByTestId("icon-ExternalLink").click();
await page.locator('//*[@id="checkAndSaveBtn"]').click();
});
});

View file

@ -31,7 +31,7 @@ test("IntComponent", async ({ page }) => {
}
await page.locator('//*[@id="int-input-2"]').click();
await page.locator('//*[@id="int-input-2"]').fill("-3");
await page.locator('//*[@id="int-input-2"]').fill("0");
value = await page.locator('//*[@id="int-input-2"]').inputValue();

View file

@ -18,14 +18,15 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.mouse.up();
await page.mouse.down();
await page.locator('//*[@id="prompt-input-4"]').click();
await page
.locator('//*[@id="modal-prompt-input-4"]')
.fill("{prompt} example {prompt1}");
await page.getByTestId("prompt-input-4-ExternalLink").click();
// await page.getByTestId("edit-prompt-sanitized").click();
let value = await page
.locator('//*[@id="modal-prompt-input-4"]')
.inputValue();
await page
.getByTestId("modal-prompt-input-4")
.fill("{prompt} example {prompt1}");
// await page.getByTestId("edit-prompt-sanitized").click();
let value = await page.getByTestId("modal-prompt-input-4").inputValue();
if (value != "{prompt} example {prompt1}") {
expect(false).toBeTruthy();
@ -43,33 +44,38 @@ test("PromptTemplateComponent", async ({ page }) => {
await page.locator('//*[@id="genericModalBtnSave"]').click();
await page.locator('//*[@id="textarea-7"]').click();
await page.locator('//*[@id="textarea-7"]').fill("prompt_value_!@#!@#");
await page.getByTestId("textarea-4-ExternalLink").click();
await page.getByTestId("text-area-modal").fill("prompt_value_!@#!@#");
value = await page.locator('//*[@id="textarea-7"]').inputValue();
value = await page.getByTestId("text-area-modal").inputValue();
if (value != "prompt_value_!@#!@#") {
expect(false).toBeTruthy();
}
await page.locator('//*[@id="textarea-8"]').click();
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("textarea-5-ExternalLink").click();
await page
.locator('//*[@id="textarea-8"]')
.getByTestId("text-area-modal")
.fill("prompt_name_test_123123!@#!@#");
value = await page.locator('//*[@id="textarea-8"]').inputValue();
value = await page.getByTestId("text-area-modal").inputValue();
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
value = await page.locator('//*[@id="prompt-input-4"]').innerText();
value = await page.getByTestId("text-area-modal").inputValue();
if (value != "{prompt} example {prompt1}") {
if (value != "prompt_name_test_123123!@#!@#") {
expect(false).toBeTruthy();
}
await page.locator('//*[@id="editAdvancedIcon"]').click();
await page.getByTestId("genericModalBtnSave").click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
value = await page.locator('//*[@id="textarea-edit-1"]').inputValue();
@ -146,7 +152,8 @@ test("PromptTemplateComponent", async ({ page }) => {
)
.click();
await page.locator('//*[@id="editAdvancedIcon"]').click();
await page.getByTestId("more-options-modal").click();
await page.getByTestId("edit-button-modal").click();
await page.locator('//*[@id="showprompt1"]').click();
expect(