Skip to content

Commit

Permalink
ansible_ai_connect_chatbot: use findBy* to find dynamic content (#1484)
Browse files Browse the repository at this point in the history
  • Loading branch information
goneri authored Jan 8, 2025
1 parent 18994c7 commit cda242a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions ansible_ai_connect_chatbot/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import React from "react";
import { beforeEach, expect, test, vi } from "vitest";
import { render } from "vitest-browser-react";
import { MemoryRouter } from "react-router-dom";
import { screen } from "@testing-library/react";
import { App } from "./App";
import { ColorThemeSwitch } from "./ColorThemeSwitch/ColorThemeSwitch";
import { userEvent, page } from "@vitest/browser/context";
Expand Down Expand Up @@ -184,12 +185,12 @@ test("ThumbsDown icon test", async () => {

await expect.element(page.getByText("Create variables")).toBeVisible();

const thumbsDownIcon = view.getByRole("button", {
const thumbsDownIcon = await screen.findByRole("button", {
name: "Bad response",
});
await thumbsDownIcon.click();

const sureButton = page.getByText("sure!");
const sureButton = await screen.findByText("Sure!");
await expect.element(sureButton).toBeVisible();
await sureButton.click();

Expand Down

0 comments on commit cda242a

Please sign in to comment.