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

test(flutter): UI e2e with Maestro (experimental) #2362

Draft
wants to merge 37 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d928773
fix test for beta
buenaflor Oct 15, 2024
c174e55
update
buenaflor Oct 15, 2024
59dd7e7
Merge branch 'main' into test/e2e
buenaflor Oct 15, 2024
25f1ee2
update workflow
buenaflor Oct 15, 2024
00a52f0
update
buenaflor Oct 15, 2024
c8b9628
use macos
buenaflor Oct 15, 2024
c669135
update
buenaflor Oct 15, 2024
f2a8e43
update
buenaflor Oct 15, 2024
0c42919
add sample iphone
buenaflor Oct 15, 2024
7521c82
update startup timeout
buenaflor Oct 15, 2024
8136019
Merge branch 'main' into test/e2e
buenaflor Oct 16, 2024
20c2d7e
update
buenaflor Oct 16, 2024
431cfe6
Merge branch 'main' into test/e2e
buenaflor Oct 17, 2024
1ef2ba9
update
buenaflor Oct 17, 2024
58d54ae
update
buenaflor Oct 17, 2024
ce3469b
update
buenaflor Oct 17, 2024
de8db30
update
buenaflor Oct 17, 2024
60c92a6
update launch arg
buenaflor Oct 17, 2024
d340e43
update
buenaflor Oct 18, 2024
32bda31
update
buenaflor Oct 18, 2024
91327b6
updaet
buenaflor Oct 18, 2024
662cc28
Update e2e_flutter.yml
buenaflor Oct 18, 2024
c625031
try using in launch args
buenaflor Oct 21, 2024
5379d58
test env var
buenaflor Oct 21, 2024
9ae4b1a
update
buenaflor Oct 21, 2024
d2beae1
update
buenaflor Oct 21, 2024
2c73a91
update
buenaflor Oct 21, 2024
e0caf93
Update e2e_flutter.yml
buenaflor Oct 21, 2024
a0c42ad
try out another option
buenaflor Oct 28, 2024
a167b4f
update
buenaflor Oct 28, 2024
a56cbcc
update
buenaflor Oct 28, 2024
7ed30d6
try again
buenaflor Oct 28, 2024
08064aa
update
buenaflor Oct 28, 2024
b7806c7
update
buenaflor Oct 28, 2024
ded047b
update
buenaflor Oct 28, 2024
5bd5920
add longer timeout
buenaflor Oct 28, 2024
09a306a
adjust timeout
buenaflor Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e_dart.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
- "!**/class-diagram.svg"
- ".github/workflows/e2e_dart.yml"
- "dart/**"
- "e2e_test/**"
- "e2e_test/dart/**"

env:
SENTRY_AUTH_TOKEN_E2E: ${{ secrets.SENTRY_AUTH_TOKEN_E2E }}
Expand Down
73 changes: 73 additions & 0 deletions .github/workflows/e2e_flutter.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: e2e-sentry-flutter
on:
push:
branches:
- main
- release/**
pull_request:
paths:
- "!**/*.md"
- "!**/class-diagram.svg"
- ".github/workflows/e2e_flutter.yml"
- "dart/**"
- "flutter/**"
- "e2e_test/flutter/**"

env:
SENTRY_AUTH_TOKEN_E2E: ${{ secrets.SENTRY_AUTH_TOKEN_E2E }}
SENTRY_DIST: 1

jobs:
cancel-previous-workflow:
runs-on: macos-latest-xlarge
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@85880fa0301c86cca9da44039ee3bb12d3bedbfa # [email protected]
with:
access_token: ${{ github.token }}

build:
name: E2E Flutter
runs-on: macos-latest
timeout-minutes: 50
defaults:
run:
working-directory: ./e2e_test/flutter
strategy:
fail-fast: false
matrix:
sdk: [stable, beta]
steps:
- uses: actions/checkout@v4
- name: Install Maestro
run: brew tap mobile-dev-inc/tap && brew install mobile-dev-inc/tap/[email protected]
- uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 # [email protected]
with:
channel: ${{ matrix.sdk }}
- run: flutter upgrade
- name: Pub Get
run: flutter pub get
- uses: futureware-tech/simulator-action@bfa03d93ec9de6dacb0c5553bbf8da8afc6c2ee9 # pin@v3
with:
model: "iPhone 15"
os_version: "17.5"
- name: Build App
if: env.SENTRY_AUTH_TOKEN_E2E != null
run: |
flutter build ios --debug --simulator
xcrun simctl install Booted build/ios/iphonesimulator/Runner.app
- name: Run Maestro
env:
MAESTRO_DRIVER_STARTUP_TIMEOUT: 1500000 # 25 min, CI can be slow at times
run: maestro test .maestro/flow.yaml -e TEST_TOKEN=$SENTRY_AUTH_TOKEN_E2E
- name: Store Maestro Logs
uses: actions/upload-artifact@v4
if: failure()
with:
name: maestro-logs-test
path: MaestroLogs
# analyze:
# uses: ./.github/workflows/analyze.yml
# with:
# package: e2e_test/flutter
# panaThreshold: 0
6 changes: 0 additions & 6 deletions e2e_test/.gitignore

This file was deleted.

File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion e2e_test/pubspec.yaml → e2e_test/dart/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ environment:
dependencies:
sentry:
path:
./../dart
./../../dart
http: ^0.13.0

dev_dependencies:
Expand Down
45 changes: 45 additions & 0 deletions e2e_test/flutter/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.build/
.buildlog/
.history
.svn/
.swiftpm/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release
11 changes: 11 additions & 0 deletions e2e_test/flutter/.maestro/flow.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
appId: io.sentry.samples.flutterE2e
---
- launchApp:
arguments:
sentryAuthToken: ${TEST_TOKEN}
- assertVisible: 'Capture exception'
- tapOn: "Capture exception"
- assertVisible: "Sending exception to Sentry..."
- extendedWaitUntil:
visible : "Event successfully received"
timeout: 150000
45 changes: 45 additions & 0 deletions e2e_test/flutter/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "b05246d305ac94798ca5429754917c0afa92fd9b"
channel: "master"

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: android
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: ios
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: linux
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: macos
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: web
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b
- platform: windows
create_revision: b05246d305ac94798ca5429754917c0afa92fd9b
base_revision: b05246d305ac94798ca5429754917c0afa92fd9b

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
16 changes: 16 additions & 0 deletions e2e_test/flutter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# flutter_e2e

A new Flutter project.

## Getting Started

This project is a starting point for a Flutter application.

A few resources to get you started if this is your first Flutter project:

- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)

For help getting started with Flutter development, view the
[online documentation](https://docs.flutter.dev/), which offers tutorials,
samples, guidance on mobile development, and a full API reference.
28 changes: 28 additions & 0 deletions e2e_test/flutter/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# This file configures the analyzer, which statically analyzes Dart code to
# check for errors, warnings, and lints.
#
# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
# invoked from the command line by running `flutter analyze`.

# The following line activates a set of recommended lints for Flutter apps,
# packages, and plugins designed to encourage good coding practices.
include: package:flutter_lints/flutter.yaml

linter:
# The lint rules applied to this project can be customized in the
# section below to disable rules from the `package:flutter_lints/flutter.yaml`
# included above or to enable additional rules. A list of all available lints
# and their documentation is published at https://dart.dev/lints.
#
# Instead of disabling a lint rule for the entire project in the
# section below, it can also be suppressed for a single line of code
# or a specific dart file by using the `// ignore: name_of_lint` and
# `// ignore_for_file: name_of_lint` syntax on the line or in the file
# producing the lint.
rules:
# avoid_print: false # Uncomment to disable the `avoid_print` rule
# prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
13 changes: 13 additions & 0 deletions e2e_test/flutter/android/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
gradle-wrapper.jar
/.gradle
/captures/
/gradlew
/gradlew.bat
/local.properties
GeneratedPluginRegistrant.java

# Remember to never publicly share your keystore.
# See https://flutter.dev/to/reference-keystore
key.properties
**/*.keystore
**/*.jks
44 changes: 44 additions & 0 deletions e2e_test/flutter/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
plugins {
id "com.android.application"
id "kotlin-android"
// The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
id "dev.flutter.flutter-gradle-plugin"
}

android {
namespace = "io.sentry.samples.flutter_e2e"
compileSdk = flutter.compileSdkVersion
ndkVersion = flutter.ndkVersion

compileOptions {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}

kotlinOptions {
jvmTarget = JavaVersion.VERSION_1_8
}

defaultConfig {
// TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
applicationId = "io.sentry.samples.flutter_e2e"
// You can update the following values to match your application needs.
// For more information, see: https://flutter.dev/to/review-gradle-config.
minSdk = flutter.minSdkVersion
targetSdk = flutter.targetSdkVersion
versionCode = flutter.versionCode
versionName = flutter.versionName
}

buildTypes {
release {
// TODO: Add your own signing config for the release build.
// Signing with the debug keys for now, so `flutter run --release` works.
signingConfig = signingConfigs.debug
}
}
}

flutter {
source = "../.."
}
7 changes: 7 additions & 0 deletions e2e_test/flutter/android/app/src/debug/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<!-- The INTERNET permission is required for development. Specifically,
the Flutter tool needs it to communicate with the running application
to allow setting breakpoints, to provide hot reload, etc.
-->
<uses-permission android:name="android.permission.INTERNET"/>
</manifest>
45 changes: 45 additions & 0 deletions e2e_test/flutter/android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="flutter_e2e"
android:name="${applicationName}"
android:icon="@mipmap/ic_launcher">
<activity
android:name=".MainActivity"
android:exported="true"
android:launchMode="singleTop"
android:taskAffinity=""
android:theme="@style/LaunchTheme"
android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
android:hardwareAccelerated="true"
android:windowSoftInputMode="adjustResize">
<!-- Specifies an Android theme to apply to this Activity as soon as
the Android process has started. This theme is visible to the user
while the Flutter UI initializes. After that, this theme continues
to determine the Window background behind the Flutter UI. -->
<meta-data
android:name="io.flutter.embedding.android.NormalTheme"
android:resource="@style/NormalTheme"
/>
<intent-filter>
<action android:name="android.intent.action.MAIN"/>
<category android:name="android.intent.category.LAUNCHER"/>
</intent-filter>
</activity>
<!-- Don't delete the meta-data below.
This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
<meta-data
android:name="flutterEmbedding"
android:value="2" />
</application>
<!-- Required to query activities that can process text, see:
https://developer.android.com/training/package-visibility and
https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.

In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
<queries>
<intent>
<action android:name="android.intent.action.PROCESS_TEXT"/>
<data android:mimeType="text/plain"/>
</intent>
</queries>
</manifest>
Loading
Loading