-
Notifications
You must be signed in to change notification settings - Fork 754
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 #6475 from vector-im/feature/bca/crypto_unable_sel…
…f_verify Handle case when device cannot be verified
- Loading branch information
Showing
11 changed files
with
178 additions
and
26 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When there is no way to verify a device (no 4S nor other device) propose to reset verification keys |
75 changes: 75 additions & 0 deletions
75
vector/src/androidTest/java/im/vector/app/CantVerifyTest.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,75 @@ | ||
/* | ||
* Copyright (c) 2022 New Vector Ltd | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package im.vector.app | ||
|
||
import android.view.View | ||
import androidx.test.espresso.Espresso | ||
import androidx.test.espresso.assertion.ViewAssertions | ||
import androidx.test.espresso.matcher.ViewMatchers | ||
import androidx.test.ext.junit.rules.ActivityScenarioRule | ||
import androidx.test.ext.junit.runners.AndroidJUnit4 | ||
import androidx.test.filters.LargeTest | ||
import im.vector.app.features.MainActivity | ||
import im.vector.app.ui.robot.ElementRobot | ||
import org.junit.Rule | ||
import org.junit.Test | ||
import org.junit.runner.RunWith | ||
import java.util.UUID | ||
|
||
@RunWith(AndroidJUnit4::class) | ||
@LargeTest | ||
class CantVerifyTest : VerificationTestBase() { | ||
|
||
@get:Rule | ||
val activityRule = ActivityScenarioRule(MainActivity::class.java) | ||
|
||
private val elementRobot = ElementRobot() | ||
var userName: String = "loginTest_${UUID.randomUUID()}" | ||
|
||
@Test | ||
fun checkCantVerifyPopup() { | ||
// Let' create an account | ||
// This first session will create cross signing keys then logout | ||
elementRobot.signUp(userName) | ||
Espresso.onView(ViewMatchers.isRoot()).perform(SleepViewAction.sleep(2000)) | ||
|
||
elementRobot.signout(false) | ||
Espresso.onView(ViewMatchers.isRoot()).perform(SleepViewAction.sleep(2000)) | ||
|
||
// Let's login again now | ||
// There are no methods to verify (no other devices, nor 4S) | ||
// So it should ask to reset all | ||
elementRobot.login(userName) | ||
|
||
val activity = EspressoHelper.getCurrentActivity()!! | ||
Espresso.onView(ViewMatchers.isRoot()) | ||
.perform(waitForView(ViewMatchers.withText(R.string.crosssigning_cannot_verify_this_session))) | ||
|
||
// check that the text is correct | ||
val popup = activity.findViewById<View>(com.tapadoo.alerter.R.id.llAlertBackground)!! | ||
activity.runOnUiThread { popup.performClick() } | ||
|
||
// ensure that it's the 4S setup bottomsheet | ||
Espresso.onView(ViewMatchers.withId(R.id.bottomSheetFragmentContainer)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
|
||
Espresso.onView(ViewMatchers.isRoot()).perform(SleepViewAction.sleep(2000)) | ||
|
||
Espresso.onView(ViewMatchers.withText(R.string.bottom_sheet_setup_secure_backup_title)) | ||
.check(ViewAssertions.matches(ViewMatchers.isDisplayed())) | ||
} | ||
} |
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