Skip to content
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

tests: Don't start DotcomWeb.Endpoint as a server in tests #2180

Merged
merged 2 commits into from
Oct 4, 2024

Conversation

joshlarson
Copy link
Contributor

Summary of changes

Start DotcomWeb.Endpoint without the server: true flag in tests.

Starting DotcomeWeb.Endpoint with server: true causes the tests to fail if anything is already running on the port supplied (in this case 4002). That conflicts with the docker config, which runs dotcom-1 on the same port, so if you try to run mix test while the docker setup is running, they will reliably fail.

Completely removing DotcomWeb.Endpoint runs afoul of one test, which has localhost:4002 hard-coded in its assertion, which is why I didn't completely obliterate it the DotcomWeb.Endpoint invocation. Another option, which I'm open to, would be to remove the hard-coded localhost:4002 from that test.


General checks

  • Are the changes organized into self-contained commits with descriptive and well-formatted commit messages? This is a good practice that can facilitate easier reviews.
  • Testing. Do the changes include relevant passing updates to tests? This includes updating screenshots. Preferably tests are run locally to verify that there are no test failures created by these changes, before opening a PR.
  • Tech debt. Have you checked for tech debt you can address in the area you're working in? This can be a good time to address small issues, or create Asana tickets for larger issues.

New UI, or substantial UI changes

  • Cross-browser compatibility is less of an issue now that we're no longer supporting IE, but changes still need to work as expected in Safari, Chrome, and Firefox.
  • Are interactive elements accessible? This includes at minimum having relevant keyboard interactions and visible focus, but can also include verification with screen reader testing.
  • Other accessibility checks such as sufficient color constrast, or whether the layout holds up at 200% zoom level.

New endpoints, or non-trivial changes to current endpoints

  • Have we load-tested any new pages or internal API endpoints that will receive significant traffic? See load testing docs
  • If this change involves routes, does it work correctly with pertinent "unusual" routes such as the combined Green Line, Silver Line, Foxboro commuter rail, and single-direction bus routes like the 170?

@joshlarson joshlarson requested a review from a team as a code owner October 1, 2024 20:49
@anthonyshull
Copy link
Contributor

Which test checks that value? We can probably remove it too.

@joshlarson
Copy link
Contributor Author

@anthonyshull

assert %File{
description: "",
type: "application/pdf",
url:
"http://localhost:4002/sites/default/files/2021-10/2021-10-13-english-bus-network-redesign-public-meetings.pdf"
} = List.first(files)

Copy link
Collaborator

@thecristen thecristen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, had no idea about the test. I'm in favor of removing the hardcoded localhost:4002 from the relevant test.

@anthonyshull
Copy link
Contributor

There are a few tests that reference localhost:4002. Pretty sure they are just looking at URLs. Not sure they actually expect anything to be running. If it's just checking for a URL we can probably remove the localhost part and just use =~.

@joshlarson joshlarson force-pushed the jdl/dont-start-endpoint-as-server-in-tests branch from 0431f4b to 0b5329a Compare October 3, 2024 21:05
@joshlarson
Copy link
Contributor Author

@anthonyshull @thecristen - I removed a bunch of hard-coded localhost:4002's in this commit

@joshlarson joshlarson merged commit e6dd565 into main Oct 4, 2024
29 checks passed
@joshlarson joshlarson deleted the jdl/dont-start-endpoint-as-server-in-tests branch October 4, 2024 15:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants