Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Flaky Tests with user.type (missing characters)

Đang mở
#1,419 3 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Ít trao đổi
Lĩnh vực
frontend, testing-qa

Hướng nghiên cứu

Bắt đầu với bản tái hiện DialogWithInput được cung cấp và lệnh gọi user.type, sử dụng các phiên bản React Testing Library, Vitest và jsdom được liệt kê. Tái hiện lỗi thiếu ký tự, so sánh lỗi này với giải pháp tạm thời { delay: null }, và xác minh rằng giá trị đầy đủ why-won't-you-type-this? được nhập một cách ổn định, đặc biệt trong các điều kiện tương tự CI.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Relevant code or config:
import {
  Dialog,
  DialogBody,
  DialogContent,
  DialogSurface,
  DialogTitle,
} from "@fluentui/react-components";

const DialogWithInput = () => {
  return (
    <Dialog open={true}>
      <DialogSurface>
        <DialogBody>
          <DialogTitle>Flaky RTL Test MWE</DialogTitle>
          <DialogContent>
            <input type="text" />
          </DialogContent>
        </DialogBody>
      </DialogSurface>
    </Dialog>
  );
}

describe("DialogWithInput", () => {
  it("accepts long text", async () => {
    const user = userEvent.setup();
    render(<DialogWithInput />);

    const textbox = await screen.findByRole("textbox");

    await user.type(textbox, "why-won't-you-type-this?");

    await waitFor(async () =>
      expect(textbox).toHaveValue("why-won't-you-type-this?")
    );
  });
});
What you did:

I tested whether a user could correctly modify a textbox using await user.type(<textbox>, <text-value>). The textbox is embedded inside a simple Fluent UI v9 Dialog component.

What happened:

user.type did not type the full text-value leading to a test failure:

Expected the element to have value:
  why-won't-you-type-this?
Received:
  why-wo
Reproduction:

Repo: https://github.com/[mzietlow/flaky-rtl-tests
Stackblitz (although I did not try it on stackblitz): https://stackblitz.com/github/mzietlow/flaky-rtl-tests

Problem description:

Tests are flaky. Especially on CI, where user.type tends to produce even fewer characters.

Suggested solution:

user.type should type all characters.

I was able to pass { delay: null } as a temporary workaround, but that is not really a solution.

Ngôn ngữ chính
JavaScript
Star
19.7k
Fork
1.2k
Chỉ số merge pull request
Không có pull request nào được merge trong 30 ngày

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của testing-library/react-testing-library

Tất cả issue của testing-library/react-testing-library

Issue tương tự

Thêm issue về JavaScript

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.