Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[XCUITests] Add iOS XCUITests to CI #1480

Merged
merged 34 commits into from
Jan 12, 2023
Merged
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
adf002b
test adding ios tests to ci
joannaquu Jan 4, 2023
1b09a69
remove -ios
joannaquu Jan 4, 2023
ce530f4
try changing to Demo.Development
joannaquu Jan 4, 2023
4808449
add new scheme
joannaquu Jan 5, 2023
a92d047
add executable to run
joannaquu Jan 5, 2023
74218f1
check run
joannaquu Jan 5, 2023
95d849a
uncheck run
joannaquu Jan 5, 2023
3fcffb7
change back to Demo.Development
joannaquu Jan 5, 2023
229d582
remove scheme
joannaquu Jan 5, 2023
c6f4708
change to just test
joannaquu Jan 5, 2023
5e8c941
add back scheme
joannaquu Jan 5, 2023
050a852
remove other build commands
joannaquu Jan 5, 2023
c3d9632
add back debug build
joannaquu Jan 5, 2023
dd6eb07
add test retries
joannaquu Jan 6, 2023
23c75c4
comment out non tokenized tests
joannaquu Jan 6, 2023
d4807dc
remove retries + turn off parallelism
joannaquu Jan 9, 2023
4f43a2a
add back other tests
joannaquu Jan 9, 2023
65721d5
test if all are going to command bar
joannaquu Jan 9, 2023
e140769
Merge branch 'main' into joannaqu/add-to-ci
joannaquu Jan 9, 2023
b191810
change tests back to controlName
joannaquu Jan 9, 2023
d9e39c5
add tear down that deletes app
joannaquu Jan 9, 2023
d0a2349
remove setup logic
joannaquu Jan 9, 2023
06d40b1
add timeouts
joannaquu Jan 9, 2023
9169add
change timeout to 1
joannaquu Jan 9, 2023
86b78e1
add back other build commands
joannaquu Jan 9, 2023
2b7f30f
remove scheme
joannaquu Jan 9, 2023
8cf2a92
whitespace change
joannaquu Jan 9, 2023
52baa40
Merge branch 'main' into joannaqu/add-to-ci
joannaquu Jan 10, 2023
d0e2089
update tearDown to use isFirstLaunch
joannaquu Jan 11, 2023
dffd8d2
Merge branch 'joannaqu/add-to-ci' of github.com:joannaquu/fluentui-ap…
joannaquu Jan 11, 2023
31ec938
fix linting issue
joannaquu Jan 11, 2023
5bfdb57
remove isFirstLaunch from UserDefaults and add #if DEBUG
joannaquu Jan 12, 2023
b7955d6
try moving navigation back to setUpWithError
joannaquu Jan 12, 2023
587bff4
whitespace change
joannaquu Jan 12, 2023
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
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ jobs:
'ios_device_build FluentUI-iOS Release build',
'ios_simulator_build Demo.Development Debug build',
'ios_simulator_build Demo.Development Release build',
'ios_simulator_build Demo.Development Debug build test -destination "platform=iOS Simulator,name=iPhone 14 Pro"',
'ios_device_build Demo.Development Debug build',
'ios_device_build Demo.Development Release build',
]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO"
parallelizable = "YES">
joannaquu marked this conversation as resolved.
Show resolved Hide resolved
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3A83F7BE295110FF00EF6629"
Expand Down
33 changes: 21 additions & 12 deletions ios/FluentUI.Demo/FluentUIDemoTests/BaseTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,36 @@ import XCTest

class BaseTest: XCTestCase {
let app = XCUIApplication()
let fluentUIDev: String = "FluentUI DEV"
// must be overridden
var controlName: String { "Base" }

override func setUpWithError() throws {
try super.setUpWithError()
continueAfterFailure = false
app.launch()
app.staticTexts[controlName].tap()
}

let onHomePage: Bool = app.staticTexts[fluentUIDev].exists
let controlPage: XCUIElement = app.staticTexts[controlName]
let onDifferentControlPage: Bool = !onHomePage && !controlPage.exists
let backButton: XCUIElement = app.buttons[fluentUIDev].exists ? app.buttons[fluentUIDev] : app.buttons["Dismiss"]
override func tearDownWithError() throws {
try super.tearDownWithError()
app.terminate()
let springboard = XCUIApplication(bundleIdentifier: "com.apple.springboard")
let icon = springboard.icons["FluentUI DEV"]
if icon.exists {
icon.press(forDuration: 1)

if onHomePage {
XCTAssertTrue(!onDifferentControlPage)
controlPage.tap()
} else if onDifferentControlPage {
XCTAssertTrue(!onHomePage && !controlPage.exists)
backButton.tap()
controlPage.tap()
let buttonRemoveApp = springboard.buttons["Remove App"]
if buttonRemoveApp.waitForExistence(timeout: 1) {
buttonRemoveApp.tap()
}
let buttonDeleteApp = springboard.alerts.buttons["Delete App"]
if buttonDeleteApp.waitForExistence(timeout: 1) {
buttonDeleteApp.tap()
}
let buttonDelete = springboard.alerts.buttons["Delete"]
if buttonDelete.waitForExistence(timeout: 1) {
buttonDelete.tap()
}
}
}
}