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

Begin adding e2e tests #20

Merged
merged 16 commits into from
Jul 18, 2024
Merged

Begin adding e2e tests #20

merged 16 commits into from
Jul 18, 2024

Conversation

trevormunoz
Copy link
Member

@trevormunoz trevormunoz commented Jul 11, 2024

Without sinking too much time into testing, I think we can benefit from having at least a small test suite to check that pages are the way we want as we are remodeling the site.

I've added a super basic set of Playwright tests aimed at the top-level pages to start.

You can use npm run test to launch the tests.

@trevormunoz trevormunoz marked this pull request as draft July 11, 2024 11:22
@trevormunoz
Copy link
Member Author

@trevormunoz
Copy link
Member Author

Once we go this route, we can also add workflow steps to run tests before building the staging site

@trevormunoz trevormunoz requested a review from raffazizzi July 11, 2024 11:31
Copy link
Member

@raffazizzi raffazizzi left a comment

Choose a reason for hiding this comment

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

@trevormunoz I had to increased the timeout time for this to work on my machine. Processing the nodes from Airtable can take a while... I'm looking at a strategy to cache them better, but we'll still need a generous timeout in case the tests are run before a first build.

I also needed to install playwright as a binary with npx playwright install, a step that will be needed in the deployment workflow(s) as well.

Otherwise, it behaves as expected, returning the error for title and h1 on the news page. I think we can merge this and keep working on it on the main branch,

@trevormunoz trevormunoz marked this pull request as ready for review July 18, 2024 20:38
@trevormunoz
Copy link
Member Author

@raffazizzi Were you running into these errors with the Gatsby build on Actions? https://github.com/umd-mith/mith-static/actions/runs/9998232860/job/27636795516#step:6:22

(I think this is a Gatsby timeout and not a Playwright one?)

@raffazizzi
Copy link
Member

That's the same error I was getting when I first tested this branch. config.webServer is definitely from Playwright. I thought I increased the timeout to 100000 and that made it got away...

@trevormunoz
Copy link
Member Author

That's the same error I was getting when I first tested this branch. config.webServer is definitely from Playwright. I thought I increased the timeout to 100000 and that made it got away...

Weird. Your commit increasing the timeout is definitely there on the branch … lemme look some more

@trevormunoz
Copy link
Member Author

So, the timeout needs to be increased in webServer stanza of the Playwright config (not just the top level — which is about test timeouts without reference to the Gatsby server startup): 956da36#diff-f679bf1e58e8dddfc6cff0fa37c8e755c8d2cfc9e6b5dc5520a5800beba59a92R79

See https://playwright.dev/docs/test-webserver#configuring-a-web-server

We need the increased timeout to wait for the Gatsby startup (as you said).

Now the Actions test results match the local ones

@trevormunoz trevormunoz merged commit c36e2c3 into main Jul 18, 2024
1 check passed
@trevormunoz trevormunoz deleted the minimal-e2e-tests branch July 19, 2024 11:00
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.

2 participants