Add UI tests for AppLockFlowCoordinator. (#2055)

* Add UITests for the App Lock flow.

* Add Notification Signal

Fix unwanted imports in UITests.
This commit is contained in:
Doug
2023-11-10 15:38:54 +00:00
committed by GitHub
parent da831f6725
commit 37d88e622c
71 changed files with 348 additions and 147 deletions
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -1,26 +0,0 @@
//
// Copyright 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.
//
import ElementX
import XCTest
@MainActor
class AppLockScreenUITests: XCTestCase {
func testScreen() async throws {
let app = Application.launch(.appLockScreen)
try await app.assertScreenshot(.appLockScreen)
}
}
@@ -16,8 +16,6 @@
import XCTest
@testable import ElementX
@MainActor
class AppLockSetupUITests: XCTestCase {
var app: XCUIApplication!
+87
View File
@@ -0,0 +1,87 @@
//
// Copyright 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.
//
import XCTest
@MainActor
class AppLockUITests: XCTestCase {
var app: XCUIApplication!
enum Step {
static let placeholder = 0
static let lockScreen = 1
static let unlocked = 99
}
func testFlowEnabled() async throws {
// Given an app with screen lock enabled.
let client = try UITestsSignalling.Client(mode: .tests)
app = Application.launch(.appLockFlow)
await client.waitForApp()
// Blank form representing an unlocked app.
try await app.assertScreenshot(.appLockFlow, step: Step.unlocked)
// When backgrounding the app.
try client.send(.notification(name: UIApplication.didEnterBackgroundNotification))
// Then the placeholder screen should obscure the content.
try await app.assertScreenshot(.appLockFlow, step: Step.placeholder)
// When foregrounding the app.
try client.send(.notification(name: UIApplication.willEnterForegroundNotification))
// Then the Lock Screen should be shown to enter a PIN.
try await app.assertScreenshot(.appLockFlow, step: Step.lockScreen)
// When entering a PIN
enterPIN()
// Then the app should be unlocked again.
try await app.assertScreenshot(.appLockFlow, step: Step.unlocked)
}
func testFlowDisabled() async throws {
// Given an app with screen lock enabled.
let client = try UITestsSignalling.Client(mode: .tests)
app = Application.launch(.appLockFlowDisabled)
await client.waitForApp()
// Blank form representing an unlocked app.
try await app.assertScreenshot(.appLockFlow, step: Step.unlocked)
// When backgrounding the app.
try client.send(.notification(name: UIApplication.didEnterBackgroundNotification))
// Then the app should remain unlocked.
try await app.assertScreenshot(.appLockFlow, step: Step.unlocked)
// When foregrounding the app.
try client.send(.notification(name: UIApplication.willEnterForegroundNotification))
// Then the app should still remain unlocked.
try await app.assertScreenshot(.appLockFlow, step: Step.unlocked)
}
// MARK: - Helpers
func enterPIN() {
app.buttons[A11yIdentifiers.appLockScreen.numpad(2)].tap()
app.buttons[A11yIdentifiers.appLockScreen.numpad(0)].tap()
app.buttons[A11yIdentifiers.appLockScreen.numpad(2)].tap()
app.buttons[A11yIdentifiers.appLockScreen.numpad(3)].tap()
}
}
@@ -16,8 +16,6 @@
import XCTest
@testable import ElementX
@MainActor
class AuthenticationCoordinatorUITests: XCTestCase {
func testLoginWithPassword() async throws {
-1
View File
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
-1
View File
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
-1
View File
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
+2 -3
View File
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -181,8 +180,8 @@ class RoomScreenUITests: XCTestCase {
// MARK: - Helper Methods
private func performOperation(_ operation: UITestsSignal, using client: UITestsSignalling.Client) async throws {
try client.send(operation)
private func performOperation(_ operation: UITestsSignal.Timeline, using client: UITestsSignalling.Client) async throws {
try client.send(.timeline(operation))
await _ = client.signals.values.first { $0 == .success }
try await Task.sleep(for: .seconds(2)) // Allow the timeline to update
}
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
-1
View File
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -14,7 +14,6 @@
// limitations under the License.
//
import ElementX
import XCTest
@MainActor
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19be252acb1287d614ee24423930c02e9470aa0c1a39a58a56573098d3de5e4c
size 1296179
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5ea38cf925c1ecb6f681f70f9e69261e04458f315037c826608c62827b4d4a43
size 100758
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7d09d2089cd5d540e12aaa823da60e20806c25202f0f3b60bfd4cebc8978e8a9
size 58054
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:02d0e19e329769fd507b7e02cbb95c55f36db403ba221b1362fea51e8e37a026
size 100756
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5d2509f4aede5aab31616f52227ae55547e62060f59fe57498cefaaa65a7fe00
size 937763
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:218cd540d96ff548dfcd300e3d6819cec8675756b1581d3bff9ad65a5dec8222
size 119101
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:af5d5eeb0ec353137c190a149bdb394da32faa730f17f3667768992cb9db0ee9
size 57774
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:326cb365efab4ca083b39104402e1056ae915e4a230dacd07f494343e427cef7
size 117772
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:19be252acb1287d614ee24423930c02e9470aa0c1a39a58a56573098d3de5e4c
size 1296179
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:ade0d3ff831c271820d475203689b69ca1b935bc32d8c6ad1c3e31a1ba3d339b
size 108963
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4f8dfd9c3e7bf9c5b7fe6ccd94c7a710b331ee9920a658c664287fa4d6403f7
size 58873
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:c5b462d8c9213706f06d4dab74a2b51bd29a5b961748ad3fd8156e48d407d832
size 108960
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fddcd92de45f0d1c41bb3c4a1555a48b91a0f9c23582ef780aa38fdec0f08186
size 936389
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f287ea8b97c94e38ddddb0cf3ef81d25eecc2b0136a4b68d0ac48779e13ab1ed
size 127569
@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b6f97fa428f0cccd0b72f2033c3b7c54c5f15f80a7293fb1b58da88704cf91b7
size 60147
@@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2d439b5c3e450115d6e46ae632ab3486a54763478db5e2111a763b9ab71da0cb
size 127567