Skip to content

Commit

Permalink
Add home page integration test
Browse files Browse the repository at this point in the history
  • Loading branch information
duddu committed Oct 18, 2023
1 parent 467ebde commit d6b6828
Show file tree
Hide file tree
Showing 7 changed files with 138 additions and 10 deletions.
59 changes: 56 additions & 3 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
branches-ignore:
- main
jobs:
test:
unit-test:
runs-on: ubuntu-latest
steps:
- name: Prepare flutter
Expand All @@ -18,5 +18,58 @@ jobs:
uses: actions/checkout@v4
with:
fetch-depth: 1
- name: Flutter tests
run: flutter test --coverage -r github
- name: Flutter test
run: flutter test --coverage -r github
integration-test:
runs-on: macos-latest
steps:
# - name: Install dependencies
# run: sudo apt-get install clang cmake ninja-build pkg-config libgtk-3-dev liblzma-dev libstdc++-12-dev
# - name: Setup java
# uses: actions/setup-java@v3
# with:
# java-version: 17
# distribution: temurin
# - name: Setup android sdk
# uses: android-actions/setup-android@v3
- name: Prepare flutter
uses: subosito/flutter-action@v2
with:
flutter-version: 3.13.7
channel: stable
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1
# - name: Gradle cache
# uses: gradle/gradle-build-action@v2
# - name: AVD cache
# uses: actions/cache@v3
# id: avd-cache
# with:
# path: |
# ~/.android/avd/*
# ~/.android/adb*
# key: avd-34
# - name: Create AVD and generate snapshot for caching
# if: steps.avd-cache.outputs.cache-hit != 'true'
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 34
# force-avd-creation: false
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: false
# script: echo "Generated AVD snapshot for caching."
# - name: Flutter integration test
# uses: reactivecircus/android-emulator-runner@v2
# with:
# target: playstore
# api-level: 34
# arch: x86_64
# profile: Nexus 6
# force-avd-creation: false
# emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
# disable-animations: true
# script: flutter test integration_test/home_page.test.dart
- name: Flutter integration test
run: flutter test -v -d macos integration_test/home_page.test.dart
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.7.8
1.7.9
26 changes: 26 additions & 0 deletions integration_test/home_page.test.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import 'package:flutter/material.dart';
import 'package:flutter_test/flutter_test.dart';
import 'package:integration_test/integration_test.dart';
import 'package:sourdoc/widgets/home_page.dart';

import '../test/widgets/helpers/ignore_overflow_errors.dart';

void main() {
IntegrationTestWidgetsFlutterBinding.ensureInitialized();

group('HomePage', () {
testWidgets('should load default form values', (tester) async {
FlutterError.onError = ignoreOverflowErrors;

await tester.pumpWidget(const MaterialApp(home: HomePage()));
await tester.pumpAndSettle();

expect(
find.byWidgetPredicate((Widget widget) =>
widget is TextField &&
widget.decoration!.prefixText == 'Salt level:' &&
widget.controller!.text == '2'),
findsOneWidget);
});
});
}
55 changes: 51 additions & 4 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -109,15 +109,20 @@ packages:
dependency: transitive
description:
name: file
sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
sha256: "1b92bec4fc2a72f59a8e15af5f52cd441e4a7860b49499d69dfa817af20e925d"
url: "https://pub.dev"
source: hosted
version: "7.0.0"
version: "6.1.4"
flutter:
dependency: "direct main"
description: flutter
source: sdk
version: "0.0.0"
flutter_driver:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
flutter_launcher_icons:
dependency: "direct dev"
description:
Expand All @@ -144,6 +149,11 @@ packages:
description: flutter
source: sdk
version: "0.0.0"
fuchsia_remote_debug_protocol:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
git:
dependency: "direct dev"
description:
Expand All @@ -160,6 +170,11 @@ packages:
url: "https://pub.dev"
source: hosted
version: "4.1.3"
integration_test:
dependency: "direct dev"
description: flutter
source: sdk
version: "0.0.0"
js:
dependency: transitive
description:
Expand Down Expand Up @@ -252,10 +267,10 @@ packages:
dependency: transitive
description:
name: platform
sha256: "0a279f0707af40c890e80b1e9df8bb761694c074ba7e1d4ab1bc4b728e200b59"
sha256: ae68c7bfcd7383af3629daafb32fb4e8681c7154428da4febcff06200585f102
url: "https://pub.dev"
source: hosted
version: "3.1.3"
version: "3.1.2"
plugin_platform_interface:
dependency: transitive
description:
Expand All @@ -272,6 +287,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.7.3"
process:
dependency: transitive
description:
name: process
sha256: "53fd8db9cec1d37b0574e12f07520d582019cb6c44abf5479a01505099a34a09"
url: "https://pub.dev"
source: hosted
version: "4.2.4"
shared_preferences:
dependency: "direct main"
description:
Expand Down Expand Up @@ -365,6 +388,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "1.2.0"
sync_http:
dependency: transitive
description:
name: sync_http
sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"
url: "https://pub.dev"
source: hosted
version: "0.3.1"
term_glyph:
dependency: transitive
description:
Expand Down Expand Up @@ -469,6 +500,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "3.0.2"
vm_service:
dependency: transitive
description:
name: vm_service
sha256: c538be99af830f478718b51630ec1b6bee5e74e52c8a802d328d9e71d35d2583
url: "https://pub.dev"
source: hosted
version: "11.10.0"
web:
dependency: transitive
description:
Expand All @@ -477,6 +516,14 @@ packages:
url: "https://pub.dev"
source: hosted
version: "0.2.1-beta"
webdriver:
dependency: transitive
description:
name: webdriver
sha256: "3c923e918918feeb90c4c9fdf1fe39220fa4c0e8e2c0fffaded174498ef86c49"
url: "https://pub.dev"
source: hosted
version: "3.0.2"
win32:
dependency: transitive
description:
Expand Down
2 changes: 2 additions & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ dev_dependencies:
flutter_test:
sdk: flutter
git: ^2.2.1
integration_test:
sdk: flutter
version: ^3.0.0

# For information on the generic Dart part of this file, see the
Expand Down
2 changes: 1 addition & 1 deletion web/download-release-asset.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<title>Download Sourdoc release asset</title>
<script>
const version = '1.7.8';
const version = '1.7.9';
const build = new URLSearchParams(window.location.search).get('build');
window.location.href = 'https://github.com/duddu/sourdoc/releases/download/v' + version + '/' + build + '-sourdoc-v' + version + '.tgz';
</script>
Expand Down
2 changes: 1 addition & 1 deletion web/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
<script async src="https://www.googletagmanager.com/gtag/js?id=G-ZS2J7KXZ0Q"></script>
<script defer src="gtm-gtag.js"></script>
<script>
const serviceWorkerVersion = '1.7.8';
const serviceWorkerVersion = '1.7.9';
</script>
<script defer src="flutter.js"></script>
</head>
Expand Down

0 comments on commit d6b6828

Please sign in to comment.