-
Notifications
You must be signed in to change notification settings - Fork 433
Add Android sample test and emulator screenshot workflow #3959
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
Closed
shai-almog
wants to merge
14
commits into
master
from
codex/add-tests-and-screenshot-artifacts-for-apk-642ezh
Closed
Changes from 1 commit
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6211c76
Ensure emulator runner installs platform tools
shai-almog d5d99a1
Allow installing test APKs in CI
shai-almog 9b687b7
Ensure adb available before emulator workflow
shai-almog db83898
Install JDK 17 before android device tests
shai-almog 7c528f6
Avoid interactive license prompts in android emulator job
shai-almog 1e119ef
Fix sdkmanager license acceptance in emulator job
shai-almog 7c0309e
Use native adb on ARM runners and auto-detect instrumentation
shai-almog 2824606
Run Android device tests on macOS HVF emulator
shai-almog 8ab9866
Fix macOS arm emulator toolchain
shai-almog 60f9df2
Simplify macOS Android SDK setup
shai-almog b99a0c2
Simplify macOS SDK setup
shai-almog 4b8206f
Adjust macOS Android SDK installation
shai-almog 886158c
Adjust macOS emulator provisioning
shai-almog 2b16eb9
Simplify macOS device test SDK setup
shai-almog File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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
50 changes: 50 additions & 0 deletions
50
Samples/SampleProjectTemplate/test/com/codename1/samples/SampleHelloTest.java
This file contains hidden or 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,50 @@ | ||
| package com.codename1.samples; | ||
|
|
||
| import com.codename1.testing.AbstractTest; | ||
| import com.codename1.ui.Component; | ||
| import com.codename1.ui.Display; | ||
| import com.codename1.ui.Form; | ||
| import com.codename1.ui.Label; | ||
|
|
||
| /** | ||
| * A simple Codename One unit test that verifies the "Hi World" label is displayed | ||
| * when {@link SampleMain} starts. | ||
| */ | ||
| public class SampleHelloTest extends AbstractTest { | ||
| @Override | ||
| public boolean runTest() throws Exception { | ||
| SampleMain app = new SampleMain(); | ||
| app.init(null); | ||
| app.start(); | ||
|
|
||
| Form current = Display.getInstance().getCurrent(); | ||
| assertNotNull(current, "The main form should be visible"); | ||
|
|
||
| Label found = findLabelWithText(current, "Hi World"); | ||
| assertNotNull(found, "Expected to find the \"Hi World\" label on the form"); | ||
| return true; | ||
| } | ||
|
|
||
| private Label findLabelWithText(Form form, String expected) { | ||
| for (int i = 0; i < form.getContentPane().getComponentCount(); i++) { | ||
| Component child = form.getContentPane().getComponentAt(i); | ||
| if (child instanceof Label) { | ||
| Label label = (Label) child; | ||
| if (expected.equals(label.getText())) { | ||
| return label; | ||
| } | ||
| } | ||
| } | ||
| return null; | ||
| } | ||
|
|
||
| @Override | ||
| public boolean shouldExecuteOnEDT() { | ||
| return true; | ||
| } | ||
|
|
||
| @Override | ||
| public String toString() { | ||
| return "SampleHelloTest"; | ||
| } | ||
| } |
This file contains hidden or 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.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.