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

Use playwright for functional tests #1163

Merged
merged 2 commits into from
Mar 4, 2025
Merged

Conversation

sea-kelp
Copy link
Collaborator

@sea-kelp sea-kelp commented Mar 4, 2025

Description of Changes

Cherry-picked from OrcaCollective#537_

Switch to Playwright for functional tests. The Playwright API seems easier to use in many ways than Selenium

Notes for Deployment

None! This only applies to tests

Screenshots (if appropriate)

N/A

Testing instructions

Run just test

Checks

  • I have rebased my changes on main

  • just lint passes

  • just test passes

@sea-kelp sea-kelp force-pushed the playwright-testing branch from e8e7cab to 4fb26fb Compare March 4, 2025 09:23
Comment on lines +20 to +25
# Upload playwright traces if tests fail
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
with:
name: playwright-traces
path: build/test-results/
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@@ -34,6 +34,7 @@ $(document).ready(function() {
$('#current-uii').text(deptUiidLabel);
$('#uii-question').show();
} else {
$('#unique_internal_identifier').text('');
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed a minor bug where unique internal identifier would still be included in the form submission if you fill in the field for a department with UII but then switched to a department without UII

@@ -107,3 +107,4 @@ services:
TIMEZONE: "America/Chicago"
volumes:
- ./OpenOversight/:/usr/src/app/OpenOversight/:z
- ./build/test-results:/test-results
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Mount the folder with Playwright traces to build/test-results

COPY requirements.txt dev-requirements.txt /usr/src/app/
# install rust and cargo so we can use jellyfish
RUN curl https://sh.rustup.rs -sSf | sh -s -- -y && \
. "$HOME/.cargo/env" && \
pip3 install --no-cache-dir -r requirements.txt && \
pip3 install --no-cache-dir -r dev-requirements.txt

RUN playwright install --with-deps chromium
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Switching functional tests from Firefox to Chromium due to current browser market shares

apt-get install -y libsqlite3-0 graphviz-dev graphviz && apt-get clean

# install geckodriver
Copy link
Collaborator

Choose a reason for hiding this comment

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

All of these deletions are wonderful. 🙏🏻

Copy link
Collaborator

@michplunkett michplunkett left a comment

Choose a reason for hiding this comment

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

This is great! My only question is whether we need to make modifications to upload our results to coveralls. Do you know if that needs to be modified?

Copy link
Collaborator

@michplunkett michplunkett left a comment

Choose a reason for hiding this comment

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

Presuming we're good for coveralls, which it looks like we are, then I'm happy wit the changes. Thanks, @sea-kelp!

@@ -0,0 +1,2 @@
[pytest]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I'd like to use a pyproject.toml file at some point, as we have way too many configuration files lingering in the repo, imo.

@michplunkett michplunkett merged commit bec3356 into develop Mar 4, 2025
4 checks passed
@michplunkett michplunkett deleted the playwright-testing branch March 4, 2025 16:24
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