Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/nightly.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ on:
# Run the native libraries first so that the native, Hybrid and React MobileSync tests
# don't run simultaniously (to prevents flappers).
jobs:
android-nightly-core:
android-nightly:
strategy:
fail-fast: false
matrix:
Expand All @@ -20,7 +20,7 @@ jobs:
secrets: inherit
android-nightly-Hybrid:
if: success() || failure()
needs: [android-nightly-core]
needs: [android-nightly]
strategy:
fail-fast: false
matrix:
Expand Down
9 changes: 7 additions & 2 deletions .github/workflows/reusable-workflow.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,13 @@ jobs:

gsutil ls ${BUCKET_PATH} > /dev/null 2>&1
if [ $? == 0 ] ; then
# Copy merged XML file from top level for test reporting
gsutil cp "${BUCKET_PATH}/*test_results_merged.xml" firebase_results/api_${LEVEL}_test_result.xml
# Copy XML file for test reporting
if gsutil ls "${BUCKET_PATH}/*test_results_merged.xml" > /dev/null 2>&1; then
# Sharded runs produce test_results_merged.xml at top level
gsutil cp "${BUCKET_PATH}/*test_results_merged.xml" firebase_results/api_${LEVEL}_test_result.xml
else
gsutil cp "${BUCKET_PATH}/*/test_result_1.xml" firebase_results/api_${LEVEL}_test_result.xml
fi

# Copy all shard data for code coverage (only needed for one level)
if [ "$LEVEL" == "$PR_API_VERSION" ] ; then
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,10 @@ class LoginViewModelMockTest {
mockCookieManager = mockk<CookieManager>(relaxed = true)
every { CookieManager.getInstance() } returns mockCookieManager

// Mock OAuth2 and AuthenticationUtilities
mockkStatic(OAuth2::class)
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")

// Create view model after mocking
viewModel = LoginViewModel(bootConfig)

Expand All @@ -94,7 +98,6 @@ class LoginViewModelMockTest {
@Test
fun onAuthFlowComplete_CallsAuthenticationUtilities_WithCorrectParameters() = runBlocking {
// Mock the AuthenticationUtilities.onAuthFlowComplete function
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")

// Mock the function to do nothing (just capture parameters)
coEvery {
Expand Down Expand Up @@ -163,7 +166,6 @@ class LoginViewModelMockTest {
@Test
fun onAuthFlowComplete_CallsAuthenticationUtilitiesSuccessfully() = runBlocking {
// Mock the AuthenticationUtilities.onAuthFlowComplete function
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")

coEvery {
onAuthFlowComplete(
Expand Down Expand Up @@ -230,7 +232,6 @@ class LoginViewModelMockTest {
@Test
fun onAuthFlowComplete_ResetsAuthCodeForJwtFlow() = runBlocking {
// Mock the AuthenticationUtilities.onAuthFlowComplete function
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")

coEvery {
onAuthFlowComplete(
Expand Down Expand Up @@ -278,7 +279,6 @@ class LoginViewModelMockTest {
@Test
fun onAuthFlowComplete_UsesEmptyString_WhenSelectedServerIsNull() = runBlocking {
// Mock the AuthenticationUtilities.onAuthFlowComplete function
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")

coEvery {
onAuthFlowComplete(
Expand Down Expand Up @@ -343,17 +343,13 @@ class LoginViewModelMockTest {

@Test
fun doCodeExchange_CallsExchangeCode_WithCorrectParameters() = runBlocking {
// Mock OAuth2.exchangeCode
mockkStatic(OAuth2::class)

val testServer = "https://test.salesforce.com"
val testCode = "test_auth_code_123"
val mockTokenResponse = mockk<TokenEndpointResponse>(relaxed = true)
val mockOnError: (String, String?, Throwable?) -> Unit = mockk(relaxed = true)
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)

// Mock AuthenticationUtilities.onAuthFlowComplete to prevent actual execution
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
coEvery {
onAuthFlowComplete(
tokenResponse = any(),
Expand Down Expand Up @@ -408,9 +404,6 @@ class LoginViewModelMockTest {

@Test
fun doCodeExchange_WithFrontDoorBridge_UsesCorrectServerAndVerifier() = runBlocking {
// Mock OAuth2.exchangeCode
mockkStatic(OAuth2::class)

val frontDoorServer = "https://frontdoor.salesforce.com"
val frontDoorUrl = "$frontDoorServer/frontdoor.jsp?sid=test_session"
val frontDoorVerifier = "frontdoor_verifier_789"
Expand All @@ -420,7 +413,6 @@ class LoginViewModelMockTest {
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)

// Mock AuthenticationUtilities.onAuthFlowComplete
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
coEvery {
onAuthFlowComplete(
tokenResponse = any(),
Expand Down Expand Up @@ -482,16 +474,12 @@ class LoginViewModelMockTest {

@Test
fun doCodeExchange_WithNullCode_PassesNullToExchangeCode() = runBlocking {
// Mock OAuth2.exchangeCode
mockkStatic(OAuth2::class)

val testServer = "https://test.salesforce.com"
val mockTokenResponse = mockk<TokenEndpointResponse>(relaxed = true)
val mockOnError: (String, String?, Throwable?) -> Unit = mockk(relaxed = true)
val mockOnSuccess: (UserAccount) -> Unit = mockk(relaxed = true)

// Mock AuthenticationUtilities.onAuthFlowComplete
mockkStatic("com.salesforce.androidsdk.auth.AuthenticationUtilitiesKt")
coEvery {
onAuthFlowComplete(
tokenResponse = any(),
Expand Down