-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5414 from grzesiek2010/COLLECT-5296
Announce upcoming deprecation of Google Drive support
- Loading branch information
Showing
22 changed files
with
295 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
...oidTest/java/org/odk/collect/android/feature/projects/GoogleDriveDeprecationBannerTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
package org.odk.collect.android.feature.projects | ||
|
||
import androidx.test.espresso.intent.Intents.intended | ||
import androidx.test.espresso.intent.matcher.IntentMatchers.hasComponent | ||
import androidx.test.espresso.intent.matcher.IntentMatchers.hasExtra | ||
import org.hamcrest.CoreMatchers.allOf | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.rules.RuleChain | ||
import org.odk.collect.android.R | ||
import org.odk.collect.android.activities.WebViewActivity | ||
import org.odk.collect.android.support.TestDependencies | ||
import org.odk.collect.android.support.pages.MainMenuPage | ||
import org.odk.collect.android.support.rules.CollectTestRule | ||
import org.odk.collect.android.support.rules.TestRuleChain | ||
import org.odk.collect.androidtest.RecordedIntentsRule | ||
|
||
class GoogleDriveDeprecationBannerTest { | ||
val rule = CollectTestRule() | ||
private val testDependencies = TestDependencies() | ||
|
||
@get:Rule | ||
val chain: RuleChain = TestRuleChain.chain(testDependencies) | ||
.around(RecordedIntentsRule()) | ||
.around(rule) | ||
|
||
@Test | ||
fun bannerIsNotVisibleInNonGoogleDriveProjects() { | ||
rule | ||
.startAtMainMenu() | ||
.assertTextDoesNotExist(R.string.google_drive_deprecation_message) | ||
} | ||
|
||
@Test | ||
fun bannerIsVisibleInGoogleDriveProjects() { | ||
val googleAccount = "[email protected]" | ||
testDependencies.googleAccountPicker.setDeviceAccount(googleAccount) | ||
|
||
rule.startAtMainMenu() | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount) | ||
.assertText(R.string.google_drive_deprecation_message) | ||
} | ||
|
||
@Test | ||
fun forumThreadIsOpenedAfterClickingLearnMore() { | ||
val googleAccount = "[email protected]" | ||
testDependencies.googleAccountPicker.setDeviceAccount(googleAccount) | ||
|
||
rule.startAtMainMenu() | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount) | ||
.clickOnString(R.string.learn_more_button_text) | ||
|
||
intended( | ||
allOf( | ||
hasComponent(WebViewActivity::class.java.name), | ||
hasExtra("url", "https://forum.getodk.org/t/40097") | ||
) | ||
) | ||
} | ||
|
||
@Test | ||
fun dismissButtonIsVisibleOnlyAfterClickingLearnMore() { | ||
val googleAccount = "[email protected]" | ||
testDependencies.googleAccountPicker.setDeviceAccount(googleAccount) | ||
|
||
rule.startAtMainMenu() | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount) | ||
.assertTextDoesNotExist(R.string.dismiss_button_text) | ||
.clickOnString(R.string.learn_more_button_text) | ||
.pressBack(MainMenuPage()) | ||
.assertText(R.string.dismiss_button_text) | ||
} | ||
|
||
@Test | ||
fun afterClickingDismissTheBannerDisappears() { | ||
val googleAccount = "[email protected]" | ||
testDependencies.googleAccountPicker.setDeviceAccount(googleAccount) | ||
|
||
rule.startAtMainMenu() | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount) | ||
.clickOnString(R.string.learn_more_button_text) | ||
.pressBack(MainMenuPage()) | ||
.clickOnString(R.string.dismiss_button_text) | ||
.assertTextDoesNotExist(R.string.google_drive_deprecation_message) | ||
.rotateToLandscape(MainMenuPage()) | ||
.assertTextDoesNotExist(R.string.google_drive_deprecation_message) | ||
} | ||
|
||
@Test | ||
fun dismissingTheBannerInOneProjectDoesNotAffectOtherProjects() { | ||
val googleAccount = "[email protected]" | ||
testDependencies.googleAccountPicker.setDeviceAccount(googleAccount) | ||
|
||
rule.startAtMainMenu() | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount) | ||
.clickOnString(R.string.learn_more_button_text) | ||
.pressBack(MainMenuPage()) | ||
.clickOnString(R.string.dismiss_button_text) | ||
.assertTextDoesNotExist(R.string.google_drive_deprecation_message) | ||
.openProjectSettingsDialog() | ||
.clickAddProject() | ||
.switchToManualMode() | ||
.openGooglePickerAndSelect(googleAccount, true) | ||
.assertText(R.string.google_drive_deprecation_message) | ||
} | ||
} |
Oops, something went wrong.