Compare commits

...

1 Commits

Author SHA1 Message Date
openhands 6310c070b3 Fix frontend tests for GitHub token documentation changes 2025-03-17 19:22:35 +00:00
2 changed files with 33 additions and 9 deletions
+8 -3
View File
@@ -95,7 +95,10 @@ describe("Settings Screen", () => {
await waitFor(() => { await waitFor(() => {
screen.getByTestId("github-token-input"); screen.getByTestId("github-token-input");
screen.getByTestId("github-token-help-anchor"); // Check for GitHub link instead of the help anchor
screen.getByRole("link", { name: "GitHub" });
// Check for documentation link
screen.getByRole("link", { name: "documentation" });
screen.getByTestId("language-input"); screen.getByTestId("language-input");
screen.getByTestId("enable-analytics-switch"); screen.getByTestId("enable-analytics-switch");
}); });
@@ -237,10 +240,12 @@ describe("Settings Screen", () => {
await waitFor(() => { await waitFor(() => {
const input = screen.queryByTestId("github-token-input"); const input = screen.queryByTestId("github-token-input");
const helpAnchor = screen.queryByTestId("github-token-help-anchor"); const githubLink = screen.queryByText("GitHub");
const documentationLink = screen.queryByText("documentation");
expect(input).not.toBeInTheDocument(); expect(input).not.toBeInTheDocument();
expect(helpAnchor).not.toBeInTheDocument(); expect(githubLink).not.toBeInTheDocument();
expect(documentationLink).not.toBeInTheDocument();
}); });
}); });
+25 -6
View File
@@ -410,12 +410,31 @@ function AccountSettings() {
placeholder={isGitHubTokenSet ? "**********" : ""} placeholder={isGitHubTokenSet ? "**********" : ""}
/> />
<HelpLink <p className="text-xs">
testId="github-token-help-anchor" Generate a token on{" "}
text="Get your token" <b>
linkText="here" <a
href="https://github.com/settings/tokens/new?description=openhands-app&scopes=repo,user,workflow" href="https://github.com/settings/tokens/new?description=openhands-app&scopes=repo,user,workflow"
/> target="_blank"
className="underline underline-offset-2"
rel="noopener noreferrer"
>
GitHub
</a>{" "}
</b>
or see the{" "}
<b>
<a
href="https://docs.github.com/en/authentication/keeping-your-account-and-data-secure/creating-a-personal-access-token"
target="_blank"
className="underline underline-offset-2"
rel="noopener noreferrer"
>
documentation
</a>
</b>
.
</p>
</> </>
)} )}