Skip to content

Commit 2d95ca4

Browse files
stefan-niedermannAndyScherzinger
authored andcommitted
chore(e2e): Enhance documentation
Signed-off-by: Stefan Niedermann <[email protected]> Signed-off-by: Andy Scherzinger <[email protected]>
1 parent 748a0c7 commit 2d95ca4

File tree

1 file changed

+18
-8
lines changed
  • sample/src/androidTest/java/com/nextcloud/android/sso/sample

1 file changed

+18
-8
lines changed

sample/src/androidTest/java/com/nextcloud/android/sso/sample/E2ETest.java

+18-8
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,23 @@
2222
import org.junit.runners.MethodSorters;
2323

2424
/**
25-
* FIXME This does not yet work
25+
* <h1>Setup</h1>
26+
* <h2>CI / CD</h2>
27+
* <p>No manual configuration needs to be done because the setup already happens in the <code>e2e.yml</code> file.</p>
28+
* <h2>Local</h2>
29+
* <ol>
30+
* <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>
31+
* <li>Remove any existing installation of the Nextcloud files app</li>
32+
* <li>Install the <a href="https://download.nextcloud.com/android/dev/latest.apk">Dev-Version of the Nextcloud files app</a></li>
33+
* <li>Grant the <code>android.permission.READ_EXTERNAL_STORAGE</code> permission to the Nextcloud files app</li>
34+
* </ol>
2635
*/
2736
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
2837
public class E2ETest {
38+
private static final String CONFIG_SERVER_URL = "http://172.17.0.1:8080";
39+
private static final String CONFIG_USERNAME = "Test";
40+
private static final String CONFIG_DISPLAY_NAME = "Test";
41+
private static final String CONFIG_PASSWORD = "Test";
2942

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

4252
@Before
4353
public void before() {
@@ -69,7 +79,7 @@ public void test_00_configureNextcloudAccount() throws UiObjectNotFoundException
6979
urlInput.waitForExists(TIMEOUT);
7080
Log.d(TAG, "URL input exists.");
7181
Log.d(TAG, "Entering URL…");
72-
urlInput.setText(SERVER_URL);
82+
urlInput.setText(CONFIG_SERVER_URL);
7383
Log.d(TAG, "URL entered.");
7484

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

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

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

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

0 commit comments

Comments
 (0)