-
-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #206 from osociety/dev
Merge dev into main
- Loading branch information
Showing
18 changed files
with
339 additions
and
173 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
workflow_call: | ||
|
||
concurrency: | ||
group: ${{ github.head_ref }} | ||
group: ${{ github.head_ref || github.run_id}} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
|
@@ -51,10 +51,14 @@ jobs: | |
name: 'Flutter Analyze + Test' | ||
needs: changes | ||
if: ${{ needs.changes.outputs.lib == 'true' || needs.changes.outputs.test == 'true' || needs.changes.outputs.yaml == 'true' || needs.changes.outputs.android == 'true' || needs.changes.outputs.linux == 'true' || needs.changes.outputs.macos == 'true' || needs.changes.outputs.windows == 'true' }} | ||
runs-on: ubuntu-latest | ||
runs-on: macos-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/[email protected] | ||
- name: Extract branch name | ||
shell: bash | ||
run: echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> $GITHUB_OUTPUT | ||
id: extract_branch | ||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -85,14 +89,23 @@ jobs: | |
build-runner- | ||
- name: Download pub dependencies | ||
run: flutter pub get | ||
- name: Upgrade pub dependencies | ||
run: flutter pub upgrade | ||
- name: Run build_runner | ||
run: flutter pub run build_runner build | ||
- name: Run analyzer | ||
run: flutter analyze | ||
- name: Install coverage tools | ||
run: flutter pub global activate coverage | ||
- name: Run tests | ||
run: flutter test | ||
- name: Run integration tests | ||
if: ${{ steps.extract_branch.outputs.branch == 'dev' }} | ||
run: flutter test integration_test --coverage -d macos | ||
- name: Upload Coverage to CodeCov | ||
if: ${{ steps.extract_branch.outputs.branch == 'dev' }} | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
token: ${{secrets.CODECOV_TOKEN}} | ||
file: coverage/lcov.info | ||
|
||
android-linux-build: | ||
name: 'Build Android + Linux' | ||
|
@@ -130,8 +143,6 @@ jobs: | |
build-runner- | ||
- name: Download pub dependencies | ||
run: flutter pub get | ||
- name: Upgrade pub dependencies | ||
run: flutter pub upgrade | ||
- name: Run build_runner | ||
run: flutter pub run build_runner build | ||
- name: Build Android | ||
|
@@ -186,8 +197,6 @@ jobs: | |
${{ runner.os }}-pods- | ||
- name: Download pub dependencies | ||
run: flutter pub get | ||
- name: Upgrade pub dependencies | ||
run: flutter pub upgrade | ||
- name: Run build_runner | ||
run: flutter pub run build_runner build | ||
- name: Build macos | ||
|
@@ -224,8 +233,6 @@ jobs: | |
build-runner- | ||
- name: Download pub dependencies | ||
run: flutter pub get | ||
- name: Upgrade pub dependencies | ||
run: flutter pub upgrade | ||
- name: Run build_runner | ||
run: flutter pub run build_runner build | ||
- name: Build windows | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
Fixed slowness of devices scan. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
genhtml coverage/lcov.info -o coverage/html | ||
open coverage/html/index.html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
import 'dart:io'; | ||
|
||
import 'package:flutter/material.dart'; | ||
import 'package:flutter_test/flutter_test.dart'; | ||
import 'package:integration_test/integration_test.dart'; | ||
import 'package:network_tools_flutter/network_tools_flutter.dart'; | ||
import 'package:path_provider/path_provider.dart'; | ||
import 'package:vernet/injection.dart'; | ||
import 'package:vernet/main.dart'; | ||
import 'package:vernet/ui/adaptive/adaptive_list.dart'; | ||
import 'package:vernet/values/keys.dart'; | ||
|
||
void main() { | ||
late ServerSocket server; | ||
int port = 0; | ||
IntegrationTestWidgetsFlutterBinding.ensureInitialized(); | ||
setUpAll(() async { | ||
configureDependencies(Env.test); | ||
final appDocDirectory = await getApplicationDocumentsDirectory(); | ||
await configureNetworkToolsFlutter(appDocDirectory.path); | ||
//open a port in shared way because of portscanner using same, | ||
//if passed false then two hosts come up in search and breaks test. | ||
server = | ||
await ServerSocket.bind(InternetAddress.anyIPv4, port, shared: true); | ||
port = server.port; | ||
debugPrint("Opened port in this machine at $port"); | ||
}); | ||
|
||
group('host scanner end-to-end test', () { | ||
testWidgets('just test if app is able to launch and display homepage', | ||
(tester) async { | ||
// Load app widget. | ||
await tester.pumpWidget(const MyApp(true)); | ||
await tester.pumpAndSettle(); | ||
|
||
// Verify that there are 4 widgets at homepage | ||
expect(find.bySubtype<AdaptiveListTile>(), findsAtLeastNWidgets(4)); | ||
}); | ||
|
||
testWidgets('tap on the scan for devices button, verify device found', | ||
(tester) async { | ||
// Load app widget. | ||
await tester.pumpWidget(const MyApp(true)); | ||
await tester.pumpAndSettle(); | ||
|
||
// Verify that there are 4 widgets at homepage | ||
expect(find.bySubtype<AdaptiveListTile>(), findsAtLeastNWidgets(4)); | ||
|
||
// Finds the scan for devices button to tap on. | ||
final devicesButton = find.byKey(WidgetKey.scanForDevicesButton.key); | ||
|
||
// Emulate a tap on the button. | ||
await tester.tap(devicesButton); | ||
await tester.pump(); | ||
expect(find.byType(AdaptiveListTile), findsAny); | ||
await tester.pumpAndSettle(); | ||
await tester.pump(); | ||
expect(find.byType(AdaptiveListTile), findsAtLeast(2)); | ||
|
||
final routerIconButton = | ||
find.byKey(WidgetKey.thisDeviceTileIconButton.key); | ||
|
||
await tester.tap(routerIconButton); | ||
await tester.pumpAndSettle(); | ||
expect(find.byType(AppBar), findsOne); | ||
|
||
final radioButton = find.byKey(WidgetKey.singlePortScanRadioButton.key); | ||
await tester.tap(radioButton); | ||
await tester.pumpAndSettle(); | ||
|
||
await tester.enterText( | ||
find.byKey(WidgetKey.enterPortTextField.key), | ||
port.toString(), | ||
); | ||
await tester.pumpAndSettle(); | ||
|
||
final portScanButton = find.byKey(WidgetKey.portScanButton.key); | ||
await tester.tap(portScanButton); | ||
await tester.pumpAndSettle(); | ||
await tester.pump(); | ||
expect(find.byType(AdaptiveListTile), findsAny); | ||
}); | ||
}); | ||
|
||
tearDownAll(() { | ||
server.close(); | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.