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