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

395 e2e test #404

Draft
wants to merge 22 commits into
base: main
Choose a base branch
from
Draft
Changes from 1 commit
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
df4e839
#395 Add E2E test
stefan-niedermann Nov 4, 2021
9053036
#395 E2E test
stefan-niedermann Nov 5, 2021
9286b85
#395 Disable caching for AVD
stefan-niedermann Nov 5, 2021
d537150
Limit logs to com.nextcloud.* packages
stefan-niedermann Nov 5, 2021
ec1c8da
Enhance logging
stefan-niedermann Nov 5, 2021
ecf97ea
Merge import and verification tests
stefan-niedermann Nov 5, 2021
597d454
Limit logs to "E2E" tag
stefan-niedermann Nov 5, 2021
20883cd
Configure trusted domain in env variable
stefan-niedermann Nov 6, 2021
c2366ab
#395 Replace waitForWindowUpdate with Thread.sleep()
stefan-niedermann Nov 6, 2021
5a6eaa9
Add quite a lot of Thread.sleep()s...
stefan-niedermann Nov 6, 2021
e23f8f6
Use AVD API 26
stefan-niedermann Nov 8, 2021
d57337b
More logs
stefan-niedermann Nov 8, 2021
e505cc9
Parallel SDK 24 & 26 without failfast
stefan-niedermann Nov 8, 2021
75b0c65
Readd logs from e2e test
stefan-niedermann Nov 8, 2021
f160a52
Unify waits in e2e test
stefan-niedermann Nov 8, 2021
c5fbcae
Use Android 28 for emulated device
stefan-niedermann Nov 17, 2021
4dd6784
chore(e2e): Move setup from CI to gradle task for easier local run
stefan-niedermann Apr 20, 2023
2de4814
chore(e2e): Fail e2e.yml when e2e test fails
stefan-niedermann Apr 20, 2023
12175ed
chore(e2e): Add more log output
stefan-niedermann Apr 20, 2023
3043c62
chore(e2e): Run e2e test only for sample module
stefan-niedermann Apr 20, 2023
339cbaa
chore(e2e): Move emulator setup back to CI
stefan-niedermann Apr 20, 2023
eac73ab
chore(e2e): Enhance documentation
stefan-niedermann Apr 20, 2023
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
Prev Previous commit
chore(e2e): Enhance documentation
Signed-off-by: Stefan Niedermann <[email protected]>
Signed-off-by: Andy Scherzinger <[email protected]>
stefan-niedermann authored and AndyScherzinger committed Mar 4, 2024
commit eac73abd6b7a8979e2771fef3575773c7e66b1fd
Original file line number Diff line number Diff line change
@@ -22,10 +22,23 @@
import org.junit.runners.MethodSorters;

/**
* FIXME This does not yet work
* <h1>Setup</h1>
* <h2>CI / CD</h2>
* <p>No manual configuration needs to be done because the setup already happens in the <code>e2e.yml</code> file.</p>
* <h2>Local</h2>
* <ol>
* <li>Set {@link #CONFIG_SERVER_URL}, {@link #CONFIG_USERNAME}, {@link #CONFIG_PASSWORD} and {@link #CONFIG_DISPLAY_NAME}. The Nextcloud instance must exist and be reachable.</li>
* <li>Remove any existing installation of the Nextcloud files app</li>
* <li>Install the <a href="https://download.nextcloud.com/android/dev/latest.apk">Dev-Version of the Nextcloud files app</a></li>
* <li>Grant the <code>android.permission.READ_EXTERNAL_STORAGE</code> permission to the Nextcloud files app</li>
* </ol>
*/
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
public class E2ETest {
private static final String CONFIG_SERVER_URL = "http://172.17.0.1:8080";
private static final String CONFIG_USERNAME = "Test";
private static final String CONFIG_DISPLAY_NAME = "Test";
private static final String CONFIG_PASSWORD = "Test";

private static final String TAG = "E2E";
private static final int TIMEOUT = 60_000;
@@ -35,9 +48,6 @@ public class E2ETest {
private static final String APP_SAMPLE = BuildConfig.APPLICATION_ID;
// TODO This should be passed as argument
private static final String APP_NEXTCLOUD = "com.nextcloud.android.beta";
private static final String SERVER_URL = "http://172.17.0.1:8080";
private static final String SERVER_USERNAME = "Test";
private static final String SERVER_PASSWORD = "Test";

@Before
public void before() {
@@ -69,7 +79,7 @@ public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException
urlInput.waitForExists(TIMEOUT);
Log.d(TAG, "URL input exists.");
Log.d(TAG, "Entering URL…");
urlInput.setText(SERVER_URL);
urlInput.setText(CONFIG_SERVER_URL);
Log.d(TAG, "URL entered.");

Log.d(TAG, "Pressing enter…");
@@ -103,7 +113,7 @@ public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException
Log.d(TAG, "Waiting for Username Input…");
usernameInput.waitForExists(TIMEOUT);
Log.d(TAG, "Username Input exists. Setting text…");
usernameInput.setText(SERVER_USERNAME);
usernameInput.setText(CONFIG_USERNAME);
Log.d(TAG, "Username has been set.");

final var passwordInput = mDevice.findObject(new UiSelector()
@@ -112,7 +122,7 @@ public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException
Log.d(TAG, "Waiting for Password Input…");
passwordInput.waitForExists(TIMEOUT);
Log.d(TAG, "Password Input exists. Setting text…");
passwordInput.setText(SERVER_PASSWORD);
passwordInput.setText(CONFIG_PASSWORD);

// mDevice.pressEnter();
final var webViewSubmitButton = mDevice.findObject(new UiSelector()
@@ -190,7 +200,7 @@ public void test_01_importAccountIntoSampleApp() throws UiObjectNotFoundExceptio
Log.d(TAG, "Import finished.");

Log.i(TAG, "Verify successful import…");
final var expectedToContain = "Test on Nextcloud";
final var expectedToContain = CONFIG_DISPLAY_NAME + " on Nextcloud";
final var result = mDevice.findObject(new UiSelector().textContains(expectedToContain));
result.waitForExists(TIMEOUT);
Log.i(TAG, "Expected UI to display '" + expectedToContain + "'. Found: '" + result.getText() + "'.");