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

Run e2e tests locally without spinning smtp servers #4147

Draft
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

cstns
Copy link
Contributor

@cstns cstns commented Jul 9, 2024

Description

add the ability to run e2e tests locally without spinning the docker smtp server processes

Related Issue(s)

Checklist

  • I have read the contribution guidelines
  • Suitable unit/system level tests have been added and they pass
  • Documentation has been updated
    • Upgrade instructions
    • Configuration details
    • Concepts
  • Changes flowforge.yml?
    • Issue/PR raised on FlowFuse/helm to update ConfigMap Template
    • Issue/PR raised on FlowFuse/CloudProject to update values for Staging/Production

Labels

  • Includes a DB migration? -> add the area:migration label

@cstns cstns requested a review from Steve-Mcl July 9, 2024 14:24
@cstns cstns self-assigned this Jul 9, 2024
@cstns
Copy link
Contributor Author

cstns commented Jul 9, 2024

the only downside to this approach is that e2e tests that require the smtp server will always fail locally when running the cy:web-server-light script

Copy link

codecov bot commented Jul 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 78.65%. Comparing base (ed6cb31) to head (577a935).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4147   +/-   ##
=======================================
  Coverage   78.65%   78.65%           
=======================================
  Files         286      286           
  Lines       13087    13087           
  Branches     2922     2922           
=======================================
  Hits        10293    10293           
  Misses       2794     2794           
Flag Coverage Δ
backend 78.65% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

@Steve-Mcl
Copy link
Contributor

the only downside to this approach is that e2e tests that require the smtp server will always fail locally when running the cy:web-server-light script

Could the same env var not be used to .skip the failing tests?

package.json Outdated
@@ -37,6 +37,7 @@
"test:docs": "node test/e2e/docs/valid-links.js ./docs",
"test:system": "mocha 'test/system/**/*_spec.js' --timeout 10000 --node-option=unhandled-rejections=strict",
"cy:web-server": "npm-run-all --parallel cy:web-server:os cy:web-server:ee",
"cy:web-server-light": "cross-env NO_SMTP_SERVER=true npm-run-all --parallel cy:web-server:os cy:web-server:ee",
Copy link
Contributor

@Steve-Mcl Steve-Mcl Jul 10, 2024

Choose a reason for hiding this comment

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

Instead of yet another script, can we not simply do the inverse?

i.e.

  • local tests always runas they always used to (no SMTP docker image)
  • tests on CI self determine the environment and run the SMTP docker image
  • If local wants to run smtp tests then local sets an ENV VAR e.g. SMTP_TESTS=true

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can't think of a solution where we'd get away with not duplicating an existing script, but I'm open to suggestions.

We'd need to be able to run the e2e tests locally with and without the smtp server (this applies to all three scenarios running os, running ee and running them together) while CI needs relies on a smtp service (so no smtp server required via docker)

the only downside to this approach is that e2e tests that require the smtp server will always fail locally when running the cy:web-server-light script

Could the same env var not be used to .skip the failing tests?

This would be a good approach but would come with some caveats.

Running the e2e tests locally without the smtp server and associated tests would result in an incomplete run and would render incomplete result. That's why I think there should be another script or method that would run the entire suite with the smtp server enabled locally.

@cstns cstns marked this pull request as draft July 11, 2024 16:33
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