diff --git a/app/src/uiTest/kotlin/ch/protonmail/android/uitest/e2e/mailbox/detail/attachments/AttachmentMessageModeTests.kt b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/e2e/mailbox/detail/attachments/AttachmentMessageModeTests.kt new file mode 100644 index 0000000000..ed767d384c --- /dev/null +++ b/app/src/uiTest/kotlin/ch/protonmail/android/uitest/e2e/mailbox/detail/attachments/AttachmentMessageModeTests.kt @@ -0,0 +1,93 @@ +/* + * Copyright (c) 2022 Proton Technologies AG + * This file is part of Proton Technologies AG and Proton Mail. + * + * Proton Mail is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Proton Mail is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with Proton Mail. If not, see . + */ + +package ch.protonmail.android.uitest.e2e.mailbox.detail.attachments + +import ch.protonmail.android.di.ServerProofModule +import ch.protonmail.android.networkmocks.mockwebserver.combineWith +import ch.protonmail.android.networkmocks.mockwebserver.requests.MimeType +import ch.protonmail.android.networkmocks.mockwebserver.requests.get +import ch.protonmail.android.networkmocks.mockwebserver.requests.ignoreQueryParams +import ch.protonmail.android.networkmocks.mockwebserver.requests.matchWildcards +import ch.protonmail.android.networkmocks.mockwebserver.requests.respondWith +import ch.protonmail.android.networkmocks.mockwebserver.requests.serveOnce +import ch.protonmail.android.networkmocks.mockwebserver.requests.withMimeType +import ch.protonmail.android.networkmocks.mockwebserver.requests.withStatusCode +import ch.protonmail.android.test.annotations.suite.RegressionTest +import ch.protonmail.android.test.annotations.suite.SmokeTest +import ch.protonmail.android.uitest.MockedNetworkTest +import ch.protonmail.android.uitest.helpers.core.TestId +import ch.protonmail.android.uitest.helpers.core.navigation.Destination +import ch.protonmail.android.uitest.helpers.core.navigation.navigator +import ch.protonmail.android.uitest.helpers.login.LoginTestUserTypes +import ch.protonmail.android.uitest.helpers.network.mockNetworkDispatcher +import ch.protonmail.android.uitest.robot.detail.messageDetailRobot +import ch.protonmail.android.uitest.robot.detail.section.attachmentsSection +import ch.protonmail.android.uitest.robot.detail.section.messageBodySection +import ch.protonmail.android.uitest.robot.helpers.deviceRobot +import ch.protonmail.android.uitest.robot.helpers.section.intents +import ch.protonmail.android.uitest.robot.helpers.section.verify +import dagger.hilt.android.testing.BindValue +import dagger.hilt.android.testing.HiltAndroidTest +import dagger.hilt.android.testing.UninstallModules +import io.mockk.mockk +import me.proton.core.auth.domain.usecase.ValidateServerProof +import kotlin.test.Test + +@RegressionTest +@UninstallModules(ServerProofModule::class) +@HiltAndroidTest +internal class AttachmentMessageModeTests : MockedNetworkTest(loginType = LoginTestUserTypes.Paid.FancyCapybara) { + + @JvmField + @BindValue + val serverProofValidation: ValidateServerProof = mockk(relaxUnitFun = true) + + @Test + @SmokeTest + @TestId("417285") + fun testAttachmentOpeningWithHeaderMaps() { + mockWebServer.dispatcher combineWith mockNetworkDispatcher(useDefaultMailSettings = false) { + addMockRequests( + get("/mail/v4/settings") + respondWith "/mail/v4/settings/mail-v4-settings_placeholder_messages.json" + withStatusCode 200, + get("/mail/v4/messages") + respondWith "/mail/v4/messages/messages_417285.json" + withStatusCode 200 ignoreQueryParams true, + get("/mail/v4/messages/*") + respondWith "/mail/v4/messages/message-id/message-id_417285.json" + withStatusCode 200 matchWildcards true serveOnce true, + get("/mail/v4/attachments/*") + respondWith "/mail/v4/attachments/attachment_417285" + withStatusCode 200 matchWildcards true serveOnce true + withMimeType MimeType.OctetStream + ) + } + + navigator { navigateTo(Destination.MailDetail()) } + + messageDetailRobot { + messageBodySection { waitUntilMessageIsShown() } + attachmentsSection { tapItem() } + deviceRobot { + intents { verify { actionViewIntentWasLaunched(times = 1) } } + } + } + } +} diff --git a/scripts/uitests/AssetsFile.lock b/scripts/uitests/AssetsFile.lock index ba06828a34..e67a4fb4d1 100644 --- a/scripts/uitests/AssetsFile.lock +++ b/scripts/uitests/AssetsFile.lock @@ -1 +1 @@ -NETWORK_ASSETS_TARGET_REF=d5d3c86793ccbf6676d5e1859fd8a153e8d264ad +NETWORK_ASSETS_TARGET_REF=c846fe72687dfe0fa057e42ce11af516638a787c