-
-
Notifications
You must be signed in to change notification settings - Fork 238
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using HTTPS causes the About dialog e2e license link tests to fail #1751
Comments
I noticed that the documentation around e2e tests isn't comprehensive. For instance, I didn't know that our e2e tests require Node 18 or greater (for ./dev-scripts/run-e2e-tests --base-url https://tinypilot.local However, the script doesn't use Our test("checks that all license URLs are valid and reachable", async ({
page,
baseURL,
}) => {
const links = await page.locator("a.license").all();
const paths = await Promise.all(
links.map((link) => link.getAttribute("href"))
);
const http_baseURL = baseURL.replace('https://', 'http://');
const failedUrls = [];
await Promise.all(
paths
.map((path) => `${http_baseURL}${path}`)
.map((url) =>
fetch(url, { signal: AbortSignal.timeout(10000) })
.then((res) => {
if (res.status !== 200) {
failedUrls.push(url);
}
})
.catch(() => failedUrls.push(url))
)
);
expect(
failedUrls.length,
`License link broken for URLs: ${failedUrls.join(", ")}`
).toBe(0);
}); I've tested the workaround, and the tests pass using it. If we use this workaround, we don't have to use navigation functions or skip the tests. Does that seem like a reasonable solution? |
Thanks @db39.
The
I believe
The purpose of e2e tests is to interact with the app precisely as a user would, so manipulating the addresses like this would invalidate the test results. We should be using Playwright to "click" the links.
Based on the above reasoning, we should implement a fix using the Playwright navigation tools. I suspect that will be sufficient to fix the bug and will make the tests more realistic. |
We noticed during the recent release of TinyPilot Pro 2.6.3 that the tests that verify the license links on the About dialog are correct fail when testing against an actual TinyPilot device.
The cause of the issue is that we're connecting to the TinyPilot device over HTTPS but without a valid certificate installed. The Playwright navigation functions ignore this, but the
fetch
function used to test the links fails due to the missing certificate.We should ideally update the tests to use the Playwright navigation tools, or failing that; we should skip the tests when running in this fashion as part of our pre-release tests.
The text was updated successfully, but these errors were encountered: