@@ -163,6 +163,44 @@ class ReceiveExternalFilesActivityIT : AbstractIT() {
163163 onView(withText(R .string.uploader_btn_upload_text))
164164 .check(matches(isDisplayed()))
165165 .check(matches(isEnabled()))
166+
167+ // Enter the subfolder and verify that the text stays intact
168+ val expectedSubFolderTitle = (getCurrentActivity() as ToolbarActivity ).getActionBarTitle(subFolder, false )
169+ onView(withText(expectedSubFolderTitle))
170+ .perform(ViewActions .click())
171+ onView(withId(R .id.toolbar))
172+ .check(matches(hasDescendant(withText(expectedSubFolderTitle))))
173+ onView(withId(R .id.user_input))
174+ .check(matches(withText(fourthFileName)))
175+ .perform(ViewActions .click())
176+ .check(matches(withSelectedText(fourthFileName.removeFileExtension())))
177+
178+ // Set a new, shorter file name
179+ val fifthFileName = " short.jpg"
180+ onView(withId(R .id.user_input))
181+ .perform(ViewActions .typeTextIntoFocusedView(fifthFileName.removeFileExtension()))
182+ .check(matches(withText(fifthFileName)))
183+
184+ // Start the upload, so the folder is stored in the preferences.
185+ // Even though the upload is expected to fail because the backend is not mocked (yet?)
186+ onView(withText(R .string.uploader_btn_upload_text))
187+ .check(matches(isDisplayed()))
188+ .check(matches(isEnabled()))
189+ .perform(ViewActions .click())
190+ }
191+
192+ // Start a new file receive flow. Should now start in the sub folder, but with the original filename again
193+ launchActivity<ReceiveExternalFilesActivity >(intent).use {
194+ val expectedMainFolderTitle = (getCurrentActivity() as ToolbarActivity ).getActionBarTitle(subFolder, false )
195+ onView(withId(R .id.toolbar))
196+ .check(matches(hasDescendant(withText(expectedMainFolderTitle))))
197+
198+ onView(withText(R .string.uploader_btn_upload_text))
199+ .check(matches(isDisplayed()))
200+ .check(matches(isEnabled()))
201+
202+ onView(withId(R .id.user_input))
203+ .check(matches(withText(imageFile.name)))
166204 }
167205 }
168206}
0 commit comments