mirror of https://github.com/nextcloud/android
Add ui test for list shares
add test user to drone switch back to master use "waitForIdleSync" instead of sleep Signed-off-by: tobiasKaminsky <tobias@kaminsky.me>
This commit is contained in:
parent
87eb8e0d16
commit
c2750aabda
16
.drone.yml
16
.drone.yml
|
@ -101,7 +101,21 @@ steps:
|
|||
|
||||
services:
|
||||
- name: server
|
||||
image: nextcloudci/server:server-3
|
||||
image: nextcloudci/server:server-17 # also change in updateScreenshots.sh
|
||||
commands:
|
||||
- /usr/local/bin/initnc.sh
|
||||
- su www-data -c "OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1"
|
||||
- su www-data -c "OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2"
|
||||
- su www-data -c "OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3"
|
||||
- su www-data -c "php /var/www/html/occ user:setting user2 files quota 1G"
|
||||
- su www-data -c "php /var/www/html/occ group:add users"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user1"
|
||||
- su www-data -c "php /var/www/html/occ group:adduser users user2"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/activity.git /var/www/html/apps/activity/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable activity"
|
||||
- su www-data -c "git clone -b master https://github.com/nextcloud/text.git /var/www/html/apps/text/"
|
||||
- su www-data -c "php /var/www/html/occ app:enable text"
|
||||
- /usr/local/bin/run.sh
|
||||
|
||||
trigger:
|
||||
branch:
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 18 KiB |
|
@ -15,7 +15,7 @@ emulator -avd uiComparison -no-snapshot -gpu swiftshader_indirect -no-window -no
|
|||
PID=$(echo $!)
|
||||
|
||||
## server
|
||||
docker run --name=uiComparison nextcloudci/server 1>/dev/null &
|
||||
docker run --name=uiComparison nextcloudci/server:server-17 1>/dev/null &
|
||||
sleep 5
|
||||
IP=$(docker inspect -f '{{range .NetworkSettings.Networks}}{{.IPAddress}}{{end}}' uiComparison)
|
||||
|
||||
|
@ -28,9 +28,19 @@ fi
|
|||
cp gradle.properties gradle.properties_
|
||||
sed -i s"/server/$IP/" gradle.properties
|
||||
scripts/wait_for_emulator.sh
|
||||
scripts/wait_for_server.sh ${IP}
|
||||
|
||||
## update all screenshots
|
||||
# setup test server
|
||||
docker exec uiComparison /bin/sh -c "/usr/local/bin/initnc.sh"
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user1 php /var/www/html/occ user:add --password-from-env --display-name='User One' user1\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user2 php /var/www/html/occ user:add --password-from-env --display-name='User Two' user2\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"OC_PASS=user3 php /var/www/html/occ user:add --password-from-env --display-name='User Three' user3\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ user:setting user2 files quota 1G\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:add users\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user1\""
|
||||
docker exec uiComparison /bin/sh -c "su www-data -c \"php /var/www/html/occ group:adduser users user2\""
|
||||
docker exec uiComparison /bin/sh -c "/usr/local/bin/run.sh"
|
||||
|
||||
## update/create all screenshots
|
||||
./gradlew executeScreenshotTests -Precord
|
||||
|
||||
## update screenshots in a class
|
||||
|
|
|
@ -8,7 +8,7 @@ until [[ $status = "false" ]]; do
|
|||
|
||||
if [[ "$status" =~ "false" || "$status" = "" ]]; then
|
||||
let "counter += 1"
|
||||
if [[ $counter -gt 2 ]]; then
|
||||
if [[ $counter -gt 10 ]]; then
|
||||
echo "Failed to wait for server"
|
||||
exit 1
|
||||
fi
|
||||
|
|
|
@ -28,8 +28,16 @@ import android.app.Activity;
|
|||
import com.facebook.testing.screenshot.Screenshot;
|
||||
import com.owncloud.android.AbstractIT;
|
||||
import com.owncloud.android.R;
|
||||
import com.owncloud.android.lib.resources.files.CreateFolderRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.files.SearchRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.shares.CreateShareRemoteOperation;
|
||||
import com.owncloud.android.lib.resources.shares.OCShare;
|
||||
import com.owncloud.android.lib.resources.shares.ShareType;
|
||||
import com.owncloud.android.ui.activity.FileDisplayActivity;
|
||||
import com.owncloud.android.ui.events.SearchEvent;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
|
||||
|
@ -40,6 +48,8 @@ import androidx.test.rule.GrantPermissionRule;
|
|||
import static androidx.test.espresso.Espresso.onView;
|
||||
import static androidx.test.espresso.action.ViewActions.click;
|
||||
import static androidx.test.espresso.matcher.ViewMatchers.withId;
|
||||
import static androidx.test.platform.app.InstrumentationRegistry.getInstrumentation;
|
||||
import static junit.framework.TestCase.assertTrue;
|
||||
|
||||
|
||||
public class FileDisplayActivityIT extends AbstractIT {
|
||||
|
@ -69,6 +79,53 @@ public class FileDisplayActivityIT extends AbstractIT {
|
|||
Screenshot.snapActivity(sut).record();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showShares() throws InterruptedException {
|
||||
assertTrue(new CreateFolderRemoteOperation("/shareToAdmin/", true).execute(client).isSuccess());
|
||||
assertTrue(new CreateFolderRemoteOperation("/shareToGroup/", true).execute(client).isSuccess());
|
||||
assertTrue(new CreateFolderRemoteOperation("/shareViaLink/", true).execute(client).isSuccess());
|
||||
assertTrue(new CreateFolderRemoteOperation("/noShare/", true).execute(client).isSuccess());
|
||||
|
||||
// share folder to user "admin"
|
||||
assertTrue(new CreateShareRemoteOperation("/shareToAdmin/",
|
||||
ShareType.USER,
|
||||
"admin",
|
||||
false,
|
||||
"",
|
||||
OCShare.MAXIMUM_PERMISSIONS_FOR_FOLDER)
|
||||
.execute(client).isSuccess());
|
||||
|
||||
// share folder via public link
|
||||
assertTrue(new CreateShareRemoteOperation("/shareViaLink/",
|
||||
ShareType.PUBLIC_LINK,
|
||||
"",
|
||||
true,
|
||||
"",
|
||||
OCShare.READ_PERMISSION_FLAG)
|
||||
.execute(client).isSuccess());
|
||||
|
||||
// share folder to group
|
||||
Assert.assertTrue(new CreateShareRemoteOperation("/shareToGroup/",
|
||||
ShareType.GROUP,
|
||||
"users",
|
||||
false,
|
||||
"",
|
||||
OCShare.DEFAULT_PERMISSION)
|
||||
.execute(client).isSuccess());
|
||||
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
EventBus.getDefault().post(new SearchEvent("",
|
||||
SearchRemoteOperation.SearchType.SHARED_FILTER,
|
||||
SearchEvent.UnsetType.UNSET_BOTTOM_NAV_BAR));
|
||||
|
||||
getInstrumentation().waitForIdleSync();
|
||||
|
||||
Screenshot.snapActivity(sut).record();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void showAccounts() {
|
||||
Activity sut = activityRule.launchActivity(null);
|
||||
|
|
|
@ -388,6 +388,10 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
currentSearchType = SearchType.RECENTLY_MODIFIED_SEARCH;
|
||||
break;
|
||||
|
||||
case SHARED_FILTER:
|
||||
currentSearchType = SearchType.SHARED_FILTER;
|
||||
break;
|
||||
|
||||
default:
|
||||
// do nothing
|
||||
break;
|
||||
|
@ -1700,7 +1704,8 @@ public class OCFileListFragment extends ExtendedListFragment implements
|
|||
return event != null &&
|
||||
event.getSearchType() != null &&
|
||||
(!TextUtils.isEmpty(event.getSearchQuery()) ||
|
||||
event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH);
|
||||
event.searchType == SearchRemoteOperation.SearchType.SHARED_SEARCH ||
|
||||
event.searchType == SearchRemoteOperation.SearchType.SHARED_FILTER);
|
||||
}
|
||||
|
||||
private void syncAndCheckFiles(Collection<OCFile> files) {
|
||||
|
|
Loading…
Reference in New Issue