forked from agentic-review-benchmarks/firefox-ios
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDisplaySettingsTests.swift
More file actions
66 lines (56 loc) · 2.73 KB
/
Copy pathDisplaySettingsTests.swift
File metadata and controls
66 lines (56 loc) · 2.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import XCTest
class DisplaySettingTests: BaseTestCase {
override func setUp() async throws {
// Fresh install the app
// removeApp() does not work on iOS 15 and 16 intermittently
if name.contains("testCheckDisplaySettingsDefault") {
if #available(iOS 17, *) {
removeApp()
}
}
// The app is correctly installed
try await super.setUp()
}
// https://mozilla.testrail.io/index.php?/cases/view/2337485
func testCheckDisplaySettingsDefault() {
navigator.nowAt(NewTabScreen)
navigator.goto(DisplaySettings)
waitForElementsToExist(
[
app.navigationBars["Appearance"],
app.buttons[AccessibilityIdentifiers.Settings.Appearance.automaticThemeView]
]
)
if #available(iOS 17, *) {
waitForElementsToExist([app.switches[AccessibilityIdentifiers.Settings.Appearance.darkModeToggle]])
} else {
waitForElementsToExist([app.buttons[AccessibilityIdentifiers.Settings.Appearance.darkModeToggle]])
}
let automaticIsSelected = app.buttons[AccessibilityIdentifiers.Settings.Appearance.automaticThemeView].value
XCTAssertEqual(automaticIsSelected as? String, "1")
let lightThemeValue = app.buttons[AccessibilityIdentifiers.Settings.Appearance.lightThemeView].value
XCTAssertEqual(lightThemeValue as? String, "0")
let darkThemeValue = app.buttons[AccessibilityIdentifiers.Settings.Appearance.darkThemeView].value
XCTAssertEqual(darkThemeValue as? String, "0")
}
// https://mozilla.testrail.io/index.php?/cases/view/2337487
func testCheckSystemThemeChanges() {
navigator.nowAt(NewTabScreen)
navigator.goto(DisplaySettings)
// Select Light mode
navigator.performAction(Action.SelectLightTheme)
let lightIsSelected = app.buttons[AccessibilityIdentifiers.Settings.Appearance.lightThemeView].value
XCTAssertEqual(lightIsSelected as? String, "1")
// Select Dark mode
navigator.performAction(Action.SelectDarkTheme)
let darkIsSelected = app.buttons[AccessibilityIdentifiers.Settings.Appearance.darkThemeView].value
XCTAssertEqual(darkIsSelected as? String, "1")
// Select Automatic mode
navigator.performAction(Action.SelectAutomaticTheme)
let automaticIsSelected = app.buttons[AccessibilityIdentifiers.Settings.Appearance.automaticThemeView].value
XCTAssertEqual(automaticIsSelected as? String, "1")
}
}