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

Add end-to-end emulator test running on CI #553

Merged
merged 5 commits into from
Sep 25, 2023
Merged

Conversation

stevesoltys
Copy link
Member

@stevesoltys stevesoltys commented Sep 12, 2023

No description provided.

@stevesoltys stevesoltys force-pushed the feature/e2e-test branch 16 times, most recently from 5480103 to 259ec52 Compare September 12, 2023 22:17
app/build.gradle Show resolved Hide resolved
app/build.gradle Outdated Show resolved Hide resolved
.idea/runConfigurations/app_emulator.xml Show resolved Hide resolved
.cirrus.yml Outdated Show resolved Hide resolved
@stevesoltys stevesoltys force-pushed the feature/e2e-test branch 9 times, most recently from 0b7b55b to 5048c09 Compare September 14, 2023 06:37
@stevesoltys stevesoltys force-pushed the feature/local-development-improvements branch from eaf4e6d to a922b69 Compare September 14, 2023 17:33
Base automatically changed from feature/local-development-improvements to android13 September 14, 2023 18:06
@stevesoltys stevesoltys force-pushed the feature/e2e-test branch 2 times, most recently from 7353753 to 3fb5506 Compare September 15, 2023 07:45
@stevesoltys stevesoltys force-pushed the feature/e2e-test branch 5 times, most recently from 12a9dd9 to daa7602 Compare September 15, 2023 18:20
load(null)
}.apply {
deleteEntry(KEY_ALIAS_MAIN)
deleteEntry(KEY_ALIAS_BACKUP)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need to do all this manually or is there another way like resetting/clearing all app-data?

Copy link
Member Author

@stevesoltys stevesoltys Sep 22, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did it this way is because clearing the app data (with adb) seems to close the app, failing the test.

Since we need to clear the state before each test and after restoring the baseline backup, I couldn't think of a better solution. Agree that it's not the best... open to any ideas 😄

app/build.gradle Outdated Show resolved Hide resolved
app/development/scripts/clear_app_data.sh Outdated Show resolved Hide resolved
DEVELOPMENT_DIR=$SCRIPT_DIR/..
ROOT_PROJECT_DIR=$SCRIPT_DIR/../../..

EMULATOR_DEVICE_NAME=$($ANDROID_SDK_HOME/platform-tools/adb devices | grep emulator | cut -f1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this limits execution to emulators. is this intentional? why not allow physical test devices?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The reason I did this was to avoid the person running the tests accidentially targeting their personal phone (like me 😆) when running these tests, since it will do some destructive things like uninstalling packages, clearing backups, wiping seedvault, etc.

I can't test on a physical device unfortunately, but if we could think of away around the above could avoid this I'm sure?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have some instrumentation tests like this. Do these tests even work on personal phones? Doesn't it require the platform signing key?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does, but for instance this script in particular could be run against a personal device and clear the Seedvault data. Maybe just need to enforce only one device is connected?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@chirayudesai is there a way to check for a userdebug build device? Maybe that would be more useful than single device?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getprop ro.build.type - user, userdebug, or eng

Also, ro.build.tags. test-keys for dev, release-keys for prod (typically)

Ref: https://dumps.tadiphone.dev/dumps/google/lynx/-/blob/lynx-user-13-TQ3A.230605.012-10204971-release-keys/system/system/build.prop?ref_type=heads

.idea/runConfigurations/app_emulator.xml Show resolved Hide resolved

val createNewFolderButton = findObject { text("CREATE NEW FOLDER") }

val useThisFolderButton = findObject { text("USE THIS FOLDER") }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok these are specific to manage documents permission missing, so it won't work on my test phones which isn't a problem right now, but prevent me from running the tests outside of CI (because I can't run emulators).

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh yeah. Sorry about that. One option is if we can somehow get the generic system images to boot in an emulator, we can test with the permission. I couldn't get this working though 😞. If you know how let me know and we can switch over, it would be better without all the Google apps anyways.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What we could do instead is not request the MANAGE_DOCUMENTS permission for instrumentation test (via a modified manifest). So every device would behave the same.

@grote grote merged commit ba6dc2f into android13 Sep 25, 2023
3 checks passed
@grote grote deleted the feature/e2e-test branch September 25, 2023 10:27
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.

3 participants