Skip to content

Commit 9c9c987

Browse files
committed
Fix tests now that Dataverse API key field is type=password
Password fields do not have a role and so have to be selected with *ByLabelText instead of *ByRole. See testing-library/dom-testing-library#567 for more info.
1 parent deafad2 commit 9c9c987

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

src/main/webapp/ui/src/eln/apps/integrations/__tests__/Dataverse.test.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,8 @@ describe("Dataverse", () => {
116116
target: { value: "new url" },
117117
});
118118

119-
fireEvent.input(screen.getByRole("textbox", { name: /api key/i }), {
119+
// see https://github.com/testing-library/dom-testing-library/issues/567
120+
fireEvent.input(screen.getByLabelText("API key"), {
120121
target: { value: "new api key" },
121122
});
122123

@@ -205,7 +206,8 @@ describe("Dataverse", () => {
205206
target: { value: "new url" },
206207
});
207208

208-
fireEvent.input(screen.getByRole("textbox", { name: /API key/i }), {
209+
// see https://github.com/testing-library/dom-testing-library/issues/567
210+
fireEvent.input(screen.getByLabelText("API key"), {
209211
target: { value: "new api key" },
210212
});
211213

@@ -429,7 +431,8 @@ describe("Dataverse", () => {
429431
}
430432
);
431433

432-
fireEvent.input(screen.getAllByRole("textbox", { name: /API key/i })[1], {
434+
// see https://github.com/testing-library/dom-testing-library/issues/567
435+
fireEvent.input(screen.getAllByLabelText("API key")[1], {
433436
target: { value: "new api key" },
434437
});
435438

0 commit comments

Comments
 (0)