diff --git a/samples/app/src/androidTest/java/com/sourcepoint/app/v6/MainActivityKotlinTest.kt b/samples/app/src/androidTest/java/com/sourcepoint/app/v6/MainActivityKotlinTest.kt index cbe3e0890..5cf1bf975 100644 --- a/samples/app/src/androidTest/java/com/sourcepoint/app/v6/MainActivityKotlinTest.kt +++ b/samples/app/src/androidTest/java/com/sourcepoint/app/v6/MainActivityKotlinTest.kt @@ -127,7 +127,7 @@ class MainActivityKotlinTest { private val spConfNative = config { accountId = 22 propertyId = 18958 - propertyName = "mobile.multicampaign.native.demo" // gdprPmId = 545258 + propertyName = "mobile.multicampaign.native.demo" messLanguage = MessageLanguage.ENGLISH messageTimeout = 5000 +(CampaignType.GDPR) @@ -136,7 +136,7 @@ class MainActivityKotlinTest { private fun getSharedPrefs(activity: Activity) = PreferenceManager.getDefaultSharedPreferences(activity) @Test - fun given_a_USNAT_campaign_SHOW_message_and_ACCEPT_ALL() = runBlocking { + fun given_a_USNAT_campaign_SHOW_message_and_ACCEPT_ALL() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( mockModule( @@ -245,7 +245,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_gdpr_campaign_CHECK_the_consent_from_a_second_activity() = runBlocking { + fun given_a_gdpr_campaign_CHECK_the_consent_from_a_second_activity() = runBlocking { val spClient = mockk(relaxed = true) @@ -276,7 +276,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_ccpa_campaign_SHOW_message_and_ACCEPT_ALL() = runBlocking { + fun given_a_ccpa_campaign_SHOW_message_and_ACCEPT_ALL() = runBlocking { val spClient = mockk(relaxed = true) @@ -320,7 +320,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_ccpa_campaign_CHECK_the_different_status() = runBlocking { + fun given_a_ccpa_campaign_CHECK_the_different_status() = runBlocking { val spClient = SpClientMock() @@ -357,7 +357,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_dgpr_campaign_SHOW_message_and_REJECT_ALL() = runBlocking { + fun given_a_gdpr_campaign_SHOW_message_and_REJECT_ALL() = runBlocking { val spClient = mockk(relaxed = true) @@ -404,7 +404,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_campaignList_ACCEPT_all_legislation() = runBlocking { + fun given_a_campaignList_ACCEPT_all_legislation() = runBlocking { val spClient = mockk(relaxed = true) @@ -459,8 +459,8 @@ class MainActivityKotlinTest { } @Test - fun WITHOUT_a_stored_consent_given_no_internet_connection_exception_VERIFY_the_called_callbacks() = - runBlocking { + fun without_a_stored_consent_given_no_internet_connection_exception_VERIFY_the_called_callbacks() = + runBlocking { val spClient = mockk(relaxed = true) @@ -522,7 +522,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_campaignList_ACCEPT_all_legislation_and_verify_that_the_popup_apper_1_time() = runBlocking { + fun given_a_campaignList_ACCEPT_all_legislation_and_verify_that_the_popup_appear_1_time() = runBlocking { val spClient = mockk(relaxed = true) @@ -561,7 +561,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_campaign_without_pupup_to_show_VERIFY_that_the_tddata_gets_saved() = runBlocking { + fun given_a_campaign_without_popup_to_show_VERIFY_that_the_tcdata_gets_saved() = runBlocking { val spClient = mockk(relaxed = true) @@ -612,7 +612,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_camapignList_ACCEPT_all_legislation_from_option_button() = runBlocking { + fun given_a_campaignList_ACCEPT_all_legislation_from_option_button() = runBlocking { val spClient = mockk(relaxed = true) @@ -658,51 +658,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_camapignList_ACCEPT_all_legislation() = runBlocking { - - val spClient = mockk(relaxed = true) - - loadKoinModules( - mockModule( - spConfig = spConf, - gdprPmId = "488393", - ccpaPmId = "509688", - spClientObserver = listOf(spClient) - ) - ) - - scenario = launchActivity() - - wr(backup = { clickOnRefreshBtnActivity() }) { tapAcceptAllOnWebView() } - wr { tapAcceptAllOnWebView() } - - verify(exactly = 0) { spClient.onError(any()) } - wr { verify(exactly = 1) { spClient.onSpFinished(any()) } } - wr { verify(exactly = 2) { spClient.onConsentReady(any()) } } - wr { verify(atLeast = 2) { spClient.onUIReady(any()) } } - wr { verify(exactly = 2) { spClient.onAction(any(), any()) } } - verify(exactly = 1) { spClient.onUIFinished(any()) } - - verify { - spClient.run { - onUIReady(any()) - onSpFinished(withArg { - it.ccpa!!.consent.applies.assertTrue() - it.gdpr!!.consent.applies.assertTrue() - it.gdpr!!.consent.consentStatus!!.consentedAll.assertNotNull() - it.ccpa!!.consent.uuid.assertNotNull() - it.gdpr!!.consent.uuid.assertNotNull() - }) - onUIReady(any()) - onAction(any(), any()) - onUIReady(any()) - onConsentReady(any()) - } - } - } - - @Test - fun given_consent_USING_gdpr_pm() = runBlocking { + fun given_consent_USING_gdpr_pm() = runBlocking { val spClient = mockk(relaxed = true) @@ -738,7 +694,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_gdpr_consent_ACCEPT_ALL() = runBlocking { + fun given_a_gdpr_consent_ACCEPT_ALL() = runBlocking { val spClient = mockk(relaxed = true) @@ -771,7 +727,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_deeplink_OPEN_an_activity() = runBlocking { + fun given_a_deeplink_OPEN_an_activity() = runBlocking { loadKoinModules(mockModule(spConfig = spConfGdpr, gdprPmId = "488393")) @@ -784,30 +740,24 @@ class MainActivityKotlinTest { } @Test - fun SAVE_AND_EXIT_action() = runBlocking { + fun save_and_exit_action_persists_consent() = runBlocking { loadKoinModules(mockModule(spConfig = spConfGdpr, gdprPmId = "488393")) scenario = launchActivity() wr(backup = { clickOnRefreshBtnActivity() }) { tapAcceptOnWebView() } -// wr { -// scenario.onActivity { activity -> -// PreferenceManager.getDefaultSharedPreferences(activity).contains("sp.gdpr.consentUUID").assertTrue() -// } -// } wr { clickOnGdprReviewConsent() } wr(backup = { clickOnGdprReviewConsent() }) { tapToDisableSomeConsent() } wr { tapSaveAndExitWebView() } delay(300) wr { clickOnGdprReviewConsent() } wr(backup = { clickOnGdprReviewConsent() }) { checkSomeConsentsOff() } - } @Test - fun Appplies_usng_SAVE_AND_EXIT_action() = runBlocking { + fun applies_usnat_SAVE_AND_EXIT_action() = runBlocking { val spClient = mockk(relaxed = true) @@ -846,7 +796,7 @@ class MainActivityKotlinTest { @Test - fun customConsentAction() = runBlocking { + fun customConsentAction() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( @@ -893,7 +843,7 @@ class MainActivityKotlinTest { } @Test - fun deleteCustomConsentAction() = runBlocking { + fun deleteCustomConsentAction() = runBlocking { val spClient = mockk(relaxed = true) @@ -912,14 +862,14 @@ class MainActivityKotlinTest { wr { clickOnGdprReviewConsent() } wr(backup = { clickOnGdprReviewConsent() }) { checkAllGdprConsentsOn() } wr { tapCancelOnWebView() } - wr { clickOnDeleteCustomConsent() } // delete the previous custom consent + wr { clickOnDeleteCustomConsent() } wr { verify(exactly = 2) { spClient.onConsentReady(any()) } } wr { clickOnGdprReviewConsent() } wr(backup = { clickOnGdprReviewConsent() }) { checkDeletedCustomCategoriesData() } } @Test - fun given_a_camapignList_VERIFY_back_btn() = runBlocking { + fun given_a_campaignList_VERIFY_back_btn() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( @@ -945,7 +895,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_camapignList_PRESS_cancel_VERIFY_onConsentReady_NOT_called() = runBlocking { + fun given_a_campaignList_PRESS_cancel_VERIFY_onConsentReady_NOT_called() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( @@ -967,7 +917,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_groupId_VERIFY_that_the_right_pm_is_displayed() = runBlocking { + fun given_a_groupId_VERIFY_that_the_right_pm_is_displayed() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( @@ -989,7 +939,7 @@ class MainActivityKotlinTest { } @Test - fun TAPPING_on_aVENDORS_link_SHOW_the_PM_VENDORS_tab() = runBlocking { + fun tapping_on_aVENDORS_link_SHOW_the_PM_VENDORS_tab() = runBlocking { val spClient = mockk(relaxed = true) loadKoinModules( @@ -1018,7 +968,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_ccpa_if_applies_FALSE_VERIFY_USPSTRING() = runBlocking { + fun given_a_ccpa_if_applies_FALSE_VERIFY_USPSTRING() = runBlocking { val spClient = mockk(relaxed = true) @@ -1049,7 +999,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_ccpa_if_applies_TRUE_VERIFY_USPSTRING() = runBlocking { + fun given_a_ccpa_if_applies_TRUE_VERIFY_USPSTRING() = runBlocking { val spClient = mockk(relaxed = true) @@ -1086,7 +1036,7 @@ class MainActivityKotlinTest { } @Test - fun given_a_ccpa_if_rejectedAll_from_PM_VERIFY_USPSTRING() = runBlocking { + fun given_a_ccpa_if_rejectedAll_from_PM_VERIFY_USPSTRING() = runBlocking { val spClient = mockk(relaxed = true)