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

Add e2e tests with Playwright #8521

Merged
merged 52 commits into from
May 23, 2024
Merged

Add e2e tests with Playwright #8521

merged 52 commits into from
May 23, 2024

Conversation

eth3lbert
Copy link
Contributor

@eth3lbert eth3lbert commented Apr 22, 2024

This PR starts porting the current test suit that includes visits to Playwright. Additionally, the tests will be implemented in Typescript.

Steps to try locally:

# Install Chromium for Playwright
pnpm exec playwright install chromium

# Run e2e tests with Playwright
pnpm e2e

Items for follow-up PRs:


For those who are familiar with QUnit but haven't used Playwright before, you may want to skim through intro, especially the writing-tests and running-and-debugging sections. Playwright offers some test and debug functionalities similar to QUnit:

  • --debug flag: Similar to development mode.
  • --ui flag: Similar to the QUnit tests route.

There is also an getting-started-vscode if you use it as your editor.

app/sentry.js Outdated Show resolved Hide resolved
Copy link

codecov bot commented Apr 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.48%. Comparing base (c8a0c8a) to head (9f29ace).
Report is 1 commits behind head on main.

Current head 9f29ace differs from pull request most recent head dcdfb87

Please upload reports for the commit dcdfb87 to get more accurate results.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #8521      +/-   ##
==========================================
- Coverage   88.48%   88.48%   -0.01%     
==========================================
  Files         276      276              
  Lines       27433    27433              
==========================================
- Hits        24274    24273       -1     
- Misses       3159     3160       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Turbo87 Turbo87 added A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear labels May 2, 2024
@eth3lbert eth3lbert force-pushed the playwright branch 4 times, most recently from 5003d9e to d66b485 Compare May 6, 2024 09:07
@eth3lbert eth3lbert changed the title [WIP] Add e2e tests with Playwright Add e2e tests with Playwright May 6, 2024
@eth3lbert
Copy link
Contributor Author

A script like the following, which leverages delta, could be helpful for reviewing the changes. This script would compare the new implementation to the old one.

import sys
from subprocess import PIPE, run


def get_changed_files():
    cmd = "git diff --name-only -r HEAD^ main"
    output = run(cmd, stdout=PIPE, stderr=PIPE, shell=True, universal_newlines=True)
    files = output.stdout
    return files


for new in get_changed_files().splitlines():
    if not new.endswith(".spec.ts"):
        continue
    old = new.replace("e2e", "tests").replace(".spec.ts", "-test.js")
    cmd = f"diff -u --ignore-space-change {old} {new} | delta"
    output = run(cmd, stdout=PIPE, stderr=PIPE, shell=True, universal_newlines=True)
    print(output.stdout)
    sys.stdin.read(1)

@eth3lbert eth3lbert marked this pull request as ready for review May 6, 2024 10:12
@Turbo87
Copy link
Member

Turbo87 commented May 6, 2024

due to the size of the diff and my upcoming PTO I probably won't be able to review the PR this week, but I've put it on my todo list for next week :)

@eth3lbert
Copy link
Contributor Author

Thanks! This PR definitely took some time to review, so I appreciate it.

@bors

This comment was marked as outdated.

@Turbo87 Turbo87 force-pushed the playwright branch 2 times, most recently from c036238 to aedaeee Compare May 17, 2024 08:14
Copy link
Member

@Turbo87 Turbo87 left a comment

Choose a reason for hiding this comment

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

LGTM! :shipit:

Given the size of the diff, I won't pretend to have reviewed every single test in this PR, but the approach in general looks good to me.

I rebased the branch on top of main to get rid of the merge conflict, and I fixed a CSS selector typo in the 404 test, which I noticed in the second commit.

One thing to consider: we might want to add an e2e/README.md explaining the purpose of the folder and that this is still WIP. I guess the next step then would be CI integration?

@eth3lbert
Copy link
Contributor Author

Thanks for the review! I'll integrate this change into our CI in a follow-up PR.


After this PR is merged, should we skip the overlapping Ember tests that have already been rewritten in Playwright?

@bors
Copy link
Contributor

bors commented May 20, 2024

☔ The latest upstream changes (presumably 1a6567d) made this pull request unmergeable. Please resolve the merge conflicts.

@Turbo87
Copy link
Member

Turbo87 commented May 23, 2024

After this PR is merged, should we skip the overlapping Ember tests that have already been rewritten in Playwright?

I think it's best to keep them running in parallel for now until we're confident about the new test setup

@Turbo87 Turbo87 enabled auto-merge May 23, 2024 08:09
@Turbo87 Turbo87 merged commit 5ea3faa into rust-lang:main May 23, 2024
7 checks passed
@eth3lbert eth3lbert deleted the playwright branch May 24, 2024 08:15
@eth3lbert eth3lbert mentioned this pull request May 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-frontend 🐹 C-internal 🔧 Category: Nonessential work that would make the codebase more consistent or clear
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants