Skip to content

Add e2e tests#3137

Merged
Nateowami merged 69 commits intomasterfrom
feature/e2e-tests
Jun 2, 2025
Merged

Add e2e tests#3137
Nateowami merged 69 commits intomasterfrom
feature/e2e-tests

Conversation

@Nateowami
Copy link
Collaborator

@Nateowami Nateowami commented Apr 1, 2025

This change is Reviewable

if (projectName == null) throw new Error('Project name not found');
await page.getByRole('textbox', { name: 'Project Name' }).click();
await page.getByRole('textbox', { name: 'Project Name' }).click();
if (projectName == null) throw new Error('Project name not found');

Check notice

Code scanning / CodeQL

Unneeded defensive code Note

This guard always evaluates to false.

Copilot Autofix

AI 11 months ago

To fix the problem, we need to remove the redundant check projectName == null on line 180. Since the projectName variable can only be undefined or a string, we should replace the check with projectName === undefined. This will ensure that the code correctly handles the case where projectName is not found without introducing unnecessary defensive code.

Suggested changeset 1
src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts

Autofix patch

Autofix patch
Run the following command in your local git repository to apply this patch
cat << 'EOF' | git apply
diff --git a/src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts b/src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts
--- a/src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts
+++ b/src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts
@@ -179,3 +179,3 @@
   await page.getByRole('textbox', { name: 'Project Name' }).click();
-  if (projectName == null) throw new Error('Project name not found');
+  if (projectName === undefined) throw new Error('Project name not found');
   await page.getByRole('textbox', { name: 'Project name' }).fill(projectName);
EOF
@@ -179,3 +179,3 @@
await page.getByRole('textbox', { name: 'Project Name' }).click();
if (projectName == null) throw new Error('Project name not found');
if (projectName === undefined) throw new Error('Project name not found');
await page.getByRole('textbox', { name: 'Project name' }).fill(projectName);
Copilot is powered by AI and may make mistakes. Always verify output.
Unable to commit as this autofix suggestion is now outdated
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

No idea why it's saying this.

@codecov
Copy link

codecov bot commented Apr 1, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 81.98%. Comparing base (d6c9967) to head (e1f38b5).
⚠️ Report is 105 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3137   +/-   ##
=======================================
  Coverage   81.98%   81.98%           
=======================================
  Files         605      605           
  Lines       34694    34694           
  Branches     5622     5622           
=======================================
  Hits        28444    28444           
  Misses       5411     5411           
  Partials      839      839           

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

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@Nateowami Nateowami force-pushed the feature/e2e-tests branch from c6ce63d to 511f1c6 Compare April 1, 2025 20:57
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 511f1c6 to 240ee13 Compare April 1, 2025 21:10
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 240ee13 to da62195 Compare April 1, 2025 21:23
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from da62195 to 70c712a Compare April 1, 2025 21:28
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 70c712a to 05107a7 Compare April 1, 2025 22:00
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 05107a7 to ee77482 Compare April 1, 2025 22:01
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from ee77482 to a868388 Compare April 1, 2025 22:03
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from a868388 to 8f539c4 Compare April 1, 2025 22:15
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 8f539c4 to c7d706b Compare April 3, 2025 15:50
@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 94f49c9 to e1f38b5 Compare June 2, 2025 19:53
Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

Reviewed 3 of 3 files at r9, all commit messages.
Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Nateowami)

Copy link
Collaborator Author

@Nateowami Nateowami left a comment

Choose a reason for hiding this comment

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

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Nateowami)


src/SIL.XForge.Scripture/ClientApp/e2e/copy-help-site-screenshots.mts line 85 at r8 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

Do we need to document somewhere what package to install for this?

I added a note, but didn't add it to the package.json because I haven't figured out how to use it as a library, it's only designed for Unix-like systems, and this script is still work-in-progress. It could be replaced with something like pngcrush, but the performance of pngcrush and anything else I've found doesn't match it.

Copy link
Collaborator

@pmachapman pmachapman left a comment

Choose a reason for hiding this comment

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

:lgtm: I'll approve this, and leave for you to merge when you think it is ready (I'm happy with the premise and logic). I still can't get the tests running perfectly at my end, but I think that is a "me" problem.

Reviewable status: :shipit: complete! all files reviewed, all discussions resolved (waiting on @Nateowami)


src/SIL.XForge.Scripture/ClientApp/e2e/copy-help-site-screenshots.mts line 85 at r8 (raw file):

Previously, Nateowami wrote…

I added a note, but didn't add it to the package.json because I haven't figured out how to use it as a library, it's only designed for Unix-like systems, and this script is still work-in-progress. It could be replaced with something like pngcrush, but the performance of pngcrush and anything else I've found doesn't match it.

I agree.

@Nateowami Nateowami merged commit 811f14d into master Jun 2, 2025
18 checks passed
@Nateowami Nateowami deleted the feature/e2e-tests branch June 2, 2025 20:47
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