Skip to content

Add e2e tests #3137

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

Open
wants to merge 67 commits into
base: master
Choose a base branch
from
Open

Add e2e tests #3137

wants to merge 67 commits into from

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 2 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.

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 (216129d) to head (9b207ce).

✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #3137   +/-   ##
=======================================
  Coverage   81.98%   81.98%           
=======================================
  Files         604      604           
  Lines       34673    34673           
  Branches     5600     5622   +22     
=======================================
  Hits        28428    28428           
+ Misses       5417     5405   -12     
- Partials      828      840   +12     

☔ 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 dae6fa5 to 76152a4 Compare May 29, 2025 17:08
@Nateowami Nateowami deployed to e2e_tests May 29, 2025 17:12 — with GitHub Actions Active
@Nateowami
Copy link
Collaborator Author

@pmachapman I've updated the files names to be more consistent.

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: 33 of 38 files reviewed, 1 unresolved discussion (waiting on @marksvc and @pmachapman)


src/SIL.XForge.Scripture/ClientApp/e2e/e2e-utils.ts line 74 at r3 (raw file):

Previously, pmachapman (Peter Chapman) wrote…

Is this an app bug, a test bug, or a test runner bug?

I don't remember. I do remember having a lot of issues with race conditions on the my projects page, and figuring out how to properly handle them.

That said, if (a) return true; else return false; is hideous so I've fixed it.

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');
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.

@Nateowami Nateowami force-pushed the feature/e2e-tests branch from 127de15 to 9b207ce Compare May 29, 2025 21:22
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