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

Setup Testing #1207

Open
wants to merge 154 commits into
base: main
Choose a base branch
from
Open

Setup Testing #1207

wants to merge 154 commits into from

Conversation

jigar-f
Copy link
Contributor

@jigar-f jigar-f commented Oct 7, 2024

Overview of This PR:

Initial Test Environment Setup-:Establishes the foundation for testing across the app.
Reusable Widget Testing Structure-: Creates a framework that can be reused for widget tests in future test cases.

Upcoming Work:

  • Widget Tests
  • Unit Tests (Models)
  • UI Tests (Cross-Platform)
  • Integration Tests
  • Payment Flow Tests (Introduce payment flow tests at a later stage)

Test Updates

List of app workflow test

  • App start up sequecne
  • Home flow with mock
  • VPN flow
  • Account flow
  • Setting flow
  • Report issue flow
  • Others are still redevelopment

Run Tests

Note: To run this integration on mobile make sure you have the device connected

To run Single test cases use this will work with widget and integration test
make runTest testfileName

To run all integration/app workflow tests use
make appWorkflowTest

To run all desktop test
make desktopWorkflowTest

To run a single test on a desktop
make runDesktopTest testfileName

@jigar-f jigar-f self-assigned this Oct 7, 2024
@atavism
Copy link
Contributor

atavism commented Oct 25, 2024

The changes here look amazing, @jigar-f!!! Sorry I haven't had a chance to take a closer look at this one yet, but I will do that first thing in the morning

@jigar-f
Copy link
Contributor Author

jigar-f commented Oct 25, 2024

@atavism I updated PR description to help to run the test across all devices, do take a look

@atavism
Copy link
Contributor

atavism commented Dec 2, 2024

I'm not sure if you've run into the same issue, but I've been unable to run the tests on Android:

* Where:
Build file '/Users/paul/go/src/github.com/getlantern/lantern-client/android/build.gradle' line: 88

* What went wrong:
A problem occurred evaluating root project 'android'.
> A problem occurred configuring project ':app'.
   > Failed to calculate the value of task ':app:compileProdDebugJavaWithJavac' property 'javaCompiler'.
      > Cannot find a Java installation on your machine matching this tasks requirements: {languageVersion=17, vendor=any vendor, implementation=vendor-specific} for MAC_OS on aarch64.
         > No locally installed toolchains match and toolchain download repositories have not been configured.

This happens running a single test with "make runTest integration_test/features/account/account_flow_test.dart"

I pushed some changes that fix the issue for me (upgrading Kotlin and the gradle wrapper): atavism/setup-test-suite

Are the workflow tests working when we build for Android in CI? I noticed the latest is failing because of this:

verifying github.com/getlantern/flashlight/[email protected]: checksum mismatch
	downloaded: h1:bL20KaA+UkPzYI9uXMDJHf+gSpHJbVBV9f/8+/EwFHI=
	go.sum:     h1:sF5wftnezW3kg3vn2dLpNDTHc25BhrwnHJox2zZChHo=

Finally, I tried uncommenting and running the app startup test work on macOS with patrol. Here's the results of that:

patrol test --target integration_test/features/account/account_flow_test.dart -d macOS
• Building app with entrypoint test_bundle.dart for macos (debug)...
	--- xcodebuild: WARNING: Using the first of multiple matching destinations:
	{ platform:macOS, arch:arm64, id:00008112-000809843A08201E, name:My Mac }
	{ platform:macOS, arch:x86_64, id:00008112-000809843A08201E, name:My Mac }
	{ platform:macOS, name:Any Mac }
	2024-12-01 20:50:08.027 xcodebuild[56002:5622647] Writing error result bundle to /var/folders/j5/yrnkkcxx6wlcr7h2f574qfjc0000gn/T/ResultBundle_2024-01-12_20-50-0008.xcresult
	xcodebuild: error: Failed to build workspace Runner with scheme Runner.: Could not find test host for RunnerTests: TEST_HOST evaluates to "/Users/paul/go/src/github.com/getlantern/lantern-client/build/macos_integ/Build/Products/Debug/Lantern.app/Contents/MacOS/androidlantern"
✗ Failed to build app with entrypoint test_bundle.dart for macos (xcodebuild exited with code 70) (5.1s)
Error: xcodebuild exited with code 70
See the logs above to learn what happened. Also consider running with --verbose. If the logs still aren't useful, then it's a bug - please report it.
Error: xcodebuild exited with code 70

@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 2, 2024

@atavism I fixed the issue with that. Now, you should be able to run it make runTest integration_test/features/account/account_flow_test.dart.

Also, do not use Patrol directly for desktops (I had to do a lot of workarounds); use make runDesktopTest, and for running all, use make maOSWorkflowTest or make linuxDesktopTest or make windowsDesktopTest.

All CI are now passing. there was few issue with go tests.

@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 2, 2024

Take a look at readme, I have added a lot more info on that.

@atavism
Copy link
Contributor

atavism commented Dec 2, 2024

Ohhh, it's working perfectly now @jigar-f! Thanks. I was just able to run the app startup test

@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 3, 2024

@atavism This is ready for review/

@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 3, 2024

Also now we are running tets on windows as well.

@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 5, 2024

@atavism Did you get chance to take look at this one?

@jigar-f jigar-f requested a review from atavism December 10, 2024 09:25
@jigar-f
Copy link
Contributor Author

jigar-f commented Dec 17, 2024

@atavism Can you review this? I like this to get merged.

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