Skip to content

Commit

Permalink
Merge pull request #5414 from grzesiek2010/COLLECT-5296
Browse files Browse the repository at this point in the history
Announce upcoming deprecation of Google Drive support
  • Loading branch information
grzesiek2010 authored Feb 6, 2023
2 parents 5025429 + c15d4ca commit c462ede
Show file tree
Hide file tree
Showing 22 changed files with 295 additions and 80 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public void onAudioQuestion_withoutAudioQuality_canRecordInApp() {
.clickOnString(R.string.capture_audio)
.clickOnContentDescription(R.string.stop_recording)
.assertContentDescriptionNotDisplayed(R.string.stop_recording)
.assertTextNotDisplayed(R.string.capture_audio)
.assertTextDoesNotExist(R.string.capture_audio)
.assertContentDescriptionDisplayed(R.string.play_audio);
}

Expand All @@ -74,7 +74,7 @@ public void onAudioQuestion_withQualitySpecified_canRecordAudioInApp() {
.clickOnString(R.string.capture_audio)
.clickOnContentDescription(R.string.stop_recording)
.assertContentDescriptionNotDisplayed(R.string.stop_recording)
.assertTextNotDisplayed(R.string.capture_audio)
.assertTextDoesNotExist(R.string.capture_audio)
.assertContentDescriptionDisplayed(R.string.play_audio);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class CatchFormDesignExceptionsTest {
.clickFillBlankForm()
.clickOnForm("Relevance and calculate loop")
.answerQuestion(1, "B")
.scrollToAndAssertText("third")
.assertText("third")
.answerQuestion(2, "C")
// Answering C above triggers a recomputation round which resets fullName to name.
// They're then equal which makes the third question non-relevant. Trying to change the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void onAudioQuestion_whenAudioQualityIsExternal_usesExternalRecorder() th
.startBlankForm("External Audio Question")
.clickOnString(R.string.capture_audio)
.assertContentDescriptionNotDisplayed(R.string.stop_recording)
.assertTextNotDisplayed(R.string.capture_audio)
.assertTextDoesNotExist(R.string.capture_audio)
.assertContentDescriptionDisplayed(R.string.play_audio);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -267,22 +267,22 @@ public void selectionChangeAtOneCascadeLevelWithMinimalAppearance_ShouldUpdateNe
.clickGoUpIcon()
.clickOnGroup("Cascading select minimal")
.clickOnQuestion("Level1")
.assertTextDoesNotExist("A1", "B1", "C1", "A1A") // No choices should be shown for levels 2 and 3 when no selection is made for level 1
.assertTextsDoNotExist("A1", "B1", "C1", "A1A") // No choices should be shown for levels 2 and 3 when no selection is made for level 1
.openSelectMinimalDialog(0)
.clickOnText("C") // Selecting C for level 1 should only reveal options for C at level 2
.assertTextDoesNotExist("A1", "B1")
.assertTextsDoNotExist("A1", "B1")
.openSelectMinimalDialog(1)
.clickOnText("C1")
.assertTextDoesNotExist("A1A")
.clickOnText("C")
.clickOnText("A") // Selecting A for level 1 should reveal options for A at level 2
.openSelectMinimalDialog(1)
.assertText("A1")
.assertTextDoesNotExist("A1A", "B1", "C1")
.assertTextsDoNotExist("A1A", "B1", "C1")
.clickOnText("A1") // Selecting A1 for level 2 should reveal options for A1 at level 3
.openSelectMinimalDialog(2)
.assertText("A1A")
.assertTextDoesNotExist("B1A", "B1", "C1");
.assertTextsDoNotExist("B1A", "B1", "C1");
}

@Test
Expand Down Expand Up @@ -380,7 +380,7 @@ public void searchMinimalInFieldList() {
.clickOnGroup("Search in field-list")
.clickOnQuestion("Source15")
.openSelectMinimalDialog()
.assertText("Mango", "Oranges", "Strawberries")
.assertTexts("Mango", "Oranges", "Strawberries")
.clickOnText("Strawberries")
.assertText("Target15")
.assertSelectMinimalDialogAnswer("Strawberries");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,6 @@ public void showRepeatsPickerWhenFirstRepeatIsEmpty() {
.clickGoToArrow()
.clickGoUpIcon()
.clickGoUpIcon()
.assertText("Repeat", "Repeatable Group");
.assertTexts("Repeat", "Repeatable Group");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FormNavigationTest {
.copyForm("two-question.xml")
.startBlankForm("Two Question")
.assertQuestion("What is your name?")
.assertTextNotDisplayed(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_backward)
.clickForwardButton()
.assertQuestion("What is your age?")
.clickBackwardButton()
Expand All @@ -48,7 +48,7 @@ class FormNavigationTest {
.assertQuestion("What is your age?")
.clickForwardButtonToEndScreen()
.assertText(R.string.form_backward)
.assertTextNotDisplayed(R.string.form_forward)
.assertTextDoesNotExist(R.string.form_forward)
}

@Test
Expand All @@ -66,13 +66,13 @@ class FormNavigationTest {
.copyForm("two-question.xml")
.startBlankForm("Two Question")
.assertQuestion("What is your name?")
.assertTextNotDisplayed(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_backward)
.clickForwardButton()
.assertQuestion("What is your age?")
.assertTextNotDisplayed(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_backward)
.clickForwardButtonToEndScreen()
.assertTextNotDisplayed(R.string.form_backward)
.assertTextNotDisplayed(R.string.form_forward)
.assertTextDoesNotExist(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_forward)
}

@Test
Expand All @@ -87,14 +87,14 @@ class FormNavigationTest {
.pressBack(MainMenuPage())
.copyForm("two-question.xml")
.startBlankForm("Two Question")
.assertTextNotDisplayed(R.string.form_backward)
.assertTextNotDisplayed(R.string.form_forward)
.assertTextDoesNotExist(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_forward)
.swipeToNextQuestion("What is your age?")
.assertTextNotDisplayed(R.string.form_backward)
.assertTextNotDisplayed(R.string.form_forward)
.assertTextDoesNotExist(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_forward)
.swipeToEndScreen()
.assertTextNotDisplayed(R.string.form_backward)
.assertTextNotDisplayed(R.string.form_forward)
.assertTextDoesNotExist(R.string.form_backward)
.assertTextDoesNotExist(R.string.form_forward)
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectOneQuestions")
.clickOnQuestion("Select one widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -89,7 +89,7 @@ class FormStylingTest {
.clickOnQuestion("Select one minimal widget")
.assertText("One")
.openSelectMinimalDialog()
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -111,7 +111,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectOneQuestions")
.clickOnQuestion("Select one label widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -122,7 +122,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectOneQuestions")
.clickOnQuestion("Select one list widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -133,7 +133,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectOneQuestions")
.clickOnQuestion("Select one likert widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -144,7 +144,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectMultipleQuestions")
.clickOnQuestion("Select multiple widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -157,7 +157,7 @@ class FormStylingTest {
.clickOnQuestion("Select multiple minimal widget")
.assertText("One")
.openSelectMinimalDialog()
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -179,7 +179,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectMultipleQuestions")
.clickOnQuestion("Select multiple label widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -190,7 +190,7 @@ class FormStylingTest {
.clickGoToArrow()
.clickOnGroup("selectMultipleQuestions")
.clickOnQuestion("Select multiple list widget")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand All @@ -202,7 +202,7 @@ class FormStylingTest {
.clickOnQuestion("Rank widget")
.assertText("1. One\n2. Two\n3. Three")
.clickOnText("Rank items")
.assertText("One", "Two", "Three")
.assertTexts("One", "Two", "Three")
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,6 @@ public class RankingWidgetWithCSVTest {
public void rankingWidget_shouldDisplayItemsFromSearchFunc() {
new FormEntryPage("ranking_widget")
.clickRankingButton()
.assertText("Mango", "Oranges", "Strawberries");
.assertTexts("Mango", "Oranges", "Strawberries");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class MatchExactlyTest {
.copyForm("one-question.xml")
.copyForm("one-question-repeat.xml")
.enableMatchExactly()
.assertTextNotDisplayed(R.string.get_forms)
.assertTextDoesNotExist(R.string.get_forms)
.clickDeleteSavedForm()
.assertTextDoesNotExist(R.string.forms)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class UpdateFormAttachmentsTest {

val mainMenuPage = rule.withProject(testDependencies.server.url)
.clickGetBlankForm()
.assertTextNotDisplayed(R.string.newer_version_of_a_form_info)
.assertTextDoesNotExist(R.string.newer_version_of_a_form_info)
.clickGetSelected()
.assertMessage("All downloads succeeded!")
.clickOKOnDialog(MainMenuPage())
Expand Down Expand Up @@ -78,7 +78,7 @@ class UpdateFormAttachmentsTest {

val mainMenuPage = rule.withProject(testDependencies.server.url)
.clickGetBlankForm()
.assertTextNotDisplayed(R.string.newer_version_of_a_form_info)
.assertTextDoesNotExist(R.string.newer_version_of_a_form_info)
.clickGetSelected()
.assertMessage("All downloads succeeded!")
.clickOKOnDialog(MainMenuPage())
Expand Down
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)
}
}
Loading

0 comments on commit c462ede

Please sign in to comment.