-
Notifications
You must be signed in to change notification settings - Fork 899
fix(site): only show method warning if some template is using it #14565
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
Changes from 1 commit
a602c72
f58660e
8ac097c
20ccc3f
c4d4afb
f54c435
8cf8478
db9c136
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,7 +18,7 @@ import { | |
import type { NotificationsPage } from "./NotificationsPage"; | ||
|
||
// Extracted from a real API response | ||
export const mockNotificationsDeploymentOptions: SerpentOption[] = [ | ||
export const mockNotificationsDeploymentOptions: SerpentOption[] = [ | ||
{ | ||
name: "Notifications: Dispatch Timeout", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This will go out of sync; is there a way we can lint this? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The only check we have here is the type, as we do for the other mocks as well, but I know it is not sufficient. I've been thinking about how we could improve our mocks and keep them in sync. One option that came to mind was to use a script that communicates with the API and generates the mocks. However, this would require more investigation and is beyond the scope of this pull request. What do you think about this idea? Do you see a simpler way we could achieve better results? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Perfectly fine to do as a follow-up, yup. Your idea sounds good 👍 |
||
description: | ||
|
@@ -213,5 +213,4 @@ export const baseMeta = { | |
withDashboardProvider, | ||
withDeploySettings, | ||
], | ||
} satisfies Meta<typeof NotificationsPage>; | ||
|
||
} satisfies Meta<typeof NotificationsPage>; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if we should include the template ID as a data attribute and select on that? It'll be more stable than the name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this case, it doesn't matter too much since we control the data. I prefer to use the name in UI tests to match the user behavior.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We control it, yes, but we may rename this template, which will cause this test to fail mysteriously.
IDs will likely never be changed, so it's more resilient.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test won't fail if we rename the template because we're using mocked data. It's not an end-to-end test. I understand that using IDs makes the test more resilient, but this is a UI test in a controlled context, so I think we should test it as the user would. However, if you strongly prefer using IDs, we can switch to that approach and start a discussion with the front-end guild to establish it as a convention, since the community uses a different method. The goal is to test the UI as the user would.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, but when you implement what we discussed in https://github.com/coder/coder/pull/14565/files#r1745353934 then it will go out of sync, and this is an entirely preventable problem.
I'm not part of the front-end guild so it's up to you.