Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1bf8757
Determine recording size based on active window
markushi Apr 24, 2025
c096ba7
Extend sample app with Dialog
markushi Apr 24, 2025
c4a46ad
Update Changelog
markushi Apr 24, 2025
8b60d98
Merge branch 'main' into markushi/fix/stretched-dialogs-sr
markushi Apr 24, 2025
3af7a00
Use onPreDrawListener instead of onDrawListener for determining windo…
markushi Apr 25, 2025
12b863e
Merge branch 'markushi/fix/stretched-dialogs-sr' of github.com:getsen…
markushi Apr 25, 2025
59d2cce
fix(replay): Fix window tracking (#4419)
romtsn May 19, 2025
76a39ea
Merge branch 'main' into markushi/fix/stretched-dialogs-sr
markushi May 20, 2025
7a1e7d8
Fix Changelog
markushi May 20, 2025
f18f521
Merge branch 'main' into markushi/fix/stretched-dialogs-sr
markushi May 20, 2025
922f29c
fix(replay): Inconsistent segment_id
romtsn May 21, 2025
aa628e5
add maestro flow
romtsn May 21, 2025
4b41736
Fix tests
romtsn May 21, 2025
8ddcf88
Merge branch 'markushi/fix/stretched-dialogs-sr' into rz/fix/session-…
romtsn May 21, 2025
9514239
Fix test
romtsn May 21, 2025
fc49ea3
Spotless
romtsn May 21, 2025
dee476c
enter the commit message for your changes. Lines starting
romtsn May 21, 2025
f3597e2
Merge branch 'main' into rz/fix/session-replay-segmentid
romtsn Jun 5, 2025
0f277a4
Changelog
romtsn Jun 5, 2025
9957427
Merge branch 'rz/fix/session-replay-segmentid' into rz/feat/session-r…
romtsn Jun 5, 2025
b168427
Add maestor readme
romtsn Jun 5, 2025
3037b71
Revert some stuff
romtsn Jun 5, 2025
84bec75
Only change orientation in maestro flows
romtsn Jun 5, 2025
457433a
Remove log
romtsn Jun 5, 2025
f4c6ea7
Formatting
romtsn Jun 5, 2025
9750a60
Merge branch 'main' into rz/feat/session-replay-maestro-flow
romtsn Jun 5, 2025
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
17 changes: 17 additions & 0 deletions sentry-samples/sentry-samples-android/maestro/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
This folder contains the Maestro flows for the Sentry Android SDK.

## Running the Flows

First, make sure you have the Maestro CLI installed. You can find the installation instructions in the [Maestro documentation](https://docs.maestro.dev/getting-started/installing-maestro).

To run the Maestro flows, navigate to this directory in your terminal and execute the following command:

```bash
maestro run <flow_name>.yaml
```

Replace `<flow_name>` with the name of the flow you want to run, such as `orientation_change_flow.yaml`.

## Available Flows

- `orientation_change_flow.yaml`: This flow tests the orientation change/window size change functionality for replays.
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
appId: io.sentry.samples.android

---
- launchApp:
arguments:
isOrientationChange: true
- scrollUntilVisible:
element:
id: "show_dialog"
- tapOn: Show Dialog
- tapOn: Close
- scrollUntilVisible:
element:
id: "open_compose_activity"
- tapOn: Open Compose Activity
- extendedWaitUntil:
visible: randText # Any random text that does not exist in the UI
optional: true # This should be true so that the test won't fail
timeout: 2000
- tapOn: Show Dialog
- tapOn:
point: 25%, 25%
- tapOn: "Navigate to Github"
- extendedWaitUntil:
visible: randText # Any random text that does not exist in the UI
optional: true # This should be true so that the test won't fail
timeout: 2000
- back
- tapOn: Show Dialog
- tapOn:
point: 25%, 25%
- back
- extendedWaitUntil:
visible: randText # Any random text that does not exist in the UI
optional: true # This should be true so that the test won't fail
timeout: 2000
- back
- back
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package io.sentry.samples.android;

import android.content.Intent;
import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.os.Bundle;
import android.os.Handler;
import androidx.appcompat.app.AlertDialog;
Expand Down Expand Up @@ -38,6 +40,8 @@ public class MainActivity extends AppCompatActivity {
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

SharedState.INSTANCE.setOrientationChange(
getIntent().getBooleanExtra("isOrientationChange", false));
final ActivityMainBinding binding = ActivityMainBinding.inflate(getLayoutInflater());

final File imageFile = getApplicationContext().getFileStreamPath("sentry.png");
Expand Down Expand Up @@ -282,7 +286,16 @@ public void run() {
.setPositiveButton(
"Close",
(dialog, which) -> {
dialog.dismiss();
if (SharedState.INSTANCE.isOrientationChange()) {
int currentOrientation = getResources().getConfiguration().orientation;
if (currentOrientation == Configuration.ORIENTATION_PORTRAIT) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
} else if (currentOrientation == Configuration.ORIENTATION_LANDSCAPE) {
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}
} else {
dialog.dismiss();
}
})
.show();
});
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package io.sentry.samples.android

object SharedState {
@Volatile
var isOrientationChange: Boolean = false
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

package io.sentry.samples.android.compose

import android.app.Activity
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.os.Bundle
import androidx.activity.ComponentActivity
import androidx.activity.compose.setContent
Expand Down Expand Up @@ -34,6 +37,7 @@ import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.graphics.ColorFilter
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.painterResource
import androidx.compose.ui.text.input.TextFieldValue
Expand All @@ -49,6 +53,7 @@ import io.sentry.android.replay.sentryReplayUnmask
import io.sentry.compose.SentryTraced
import io.sentry.compose.withSentryObservableEffect
import io.sentry.samples.android.GithubAPI
import io.sentry.samples.android.SharedState
import kotlinx.coroutines.launch
import io.sentry.samples.android.R as IR

Expand All @@ -71,6 +76,8 @@ fun Landing(
navigateGithubWithArgs: () -> Unit
) {
var showDialog by remember { mutableStateOf(false) }
val context = LocalContext.current
val activity = context as? Activity ?: return

SentryTraced(tag = "buttons_page") {
Column(
Expand Down Expand Up @@ -119,7 +126,18 @@ fun Landing(
if (showDialog) {
BasicAlertDialog(
onDismissRequest = {
showDialog = false
if (SharedState.isOrientationChange) {
val orientation = activity.resources.configuration.orientation
if (orientation == Configuration.ORIENTATION_PORTRAIT) {
activity.requestedOrientation =
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE
} else if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
activity.requestedOrientation =
ActivityInfo.SCREEN_ORIENTATION_PORTRAIT
}
} else {
showDialog = false
}
},
content = {
Surface(
Expand Down
Loading