Bump Xcode version to fix locally failing XCUITests (#1819)

* Fix failing XCUITests on tokens branch (#1642)

* attempt to fix tests

* add newlines to dismiss keyboard

* fix toggle taps

* update xcode version

* update to macos 13

* update ci.yml

* update xcconfig files

* remove update to macos 13

* add back removeUnusedResourcesFromAssets.swift
This commit is contained in:
Joanna Qu 2023-07-07 11:21:36 -07:00 коммит произвёл GitHub
Родитель b5843c7976
Коммит 936a0f1ffd
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
8 изменённых файлов: 43 добавлений и 43 удалений

4
.github/workflows/ci.yml поставляемый
Просмотреть файл

@ -16,7 +16,7 @@ on:
jobs:
validation:
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: true
steps:
@ -28,7 +28,7 @@ jobs:
- name: validation
run: scripts/validation.sh
xcodebuild:
runs-on: macos-12
runs-on: macos-13
strategy:
fail-fast: false
matrix:

Просмотреть файл

@ -15,7 +15,7 @@ Fluent UI Apple contains native UIKit and AppKit controls aligned with [Microsof
#### Requirements
- iOS 15+ or macOS 10.15+
- Xcode 14.2+
- Xcode 14.3+
- Swift 5.7.1+
#### Using Swift Package Manager

Просмотреть файл

@ -17,8 +17,8 @@ class ActivityIndicatorTestSwiftUI: ActivityIndicatorTest {
}
override func testStartStopHide() throws {
let animatingSwitch: XCUIElement = app.switches["Animating"]
let hidesWhenStoppedSwitch: XCUIElement = app.switches["Hides when stopped"]
let animatingSwitch: XCUIElement = app.switches["Animating"].switches.firstMatch
let hidesWhenStoppedSwitch: XCUIElement = app.switches["Hides when stopped"].switches.firstMatch
hidesWhenStoppedSwitch.tap()
XCTAssert(activityIndicatorExists(status: inProgress))

Просмотреть файл

@ -27,7 +27,8 @@ class AvatarTestSwiftUI: BaseTest {
}
func testImages() throws {
let setImageSwitch: XCUIElement = app.switches["Set image"]
let textField: XCUIElement = app.textFields.firstMatch
let setImageSwitch: XCUIElement = app.switches["Set image"].switches.firstMatch
let image: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Avatar.*image.*")
let initials: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Avatar.*initials.*")
let icon: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Avatar.*icon.*")
@ -42,8 +43,8 @@ class AvatarTestSwiftUI: BaseTest {
XCTAssert(avatarExists(predicate: initials))
XCTAssert(!avatarExists(predicate: icon))
app.textFields.firstMatch.doubleTap()
app.menuItems["Cut"].tap()
textField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
textField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
XCTAssert(!avatarExists(predicate: image))
XCTAssert(!avatarExists(predicate: initials))
XCTAssert(avatarExists(predicate: icon))
@ -55,9 +56,9 @@ class AvatarTestSwiftUI: BaseTest {
}
func testRings() throws {
let ringVisibleSwitch: XCUIElement = app.switches["Ring visible"]
let setImageRingSwitch: XCUIElement = app.switches["Set image based ring color"]
let ringInnerGapSwitch: XCUIElement = app.switches["Ring inner gap"]
let ringVisibleSwitch: XCUIElement = app.switches["Ring visible"].switches.firstMatch
let setImageRingSwitch: XCUIElement = app.switches["Set image based ring color"].switches.firstMatch
let ringInnerGapSwitch: XCUIElement = app.switches["Ring inner gap"].switches.firstMatch
let noRing: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Avatar.*with no ring.*")
let defaultRing: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Avatar.*with a default ring.*")
@ -111,25 +112,27 @@ class AvatarTestSwiftUI: BaseTest {
app.buttons[".unknown"].tap()
XCTAssert(avatarWithAttributeExists(attribute: "presence 7"))
app.switches["Out of office"].tap()
app.switches["Out of office"].switches.firstMatch.tap()
XCTAssert(avatarWithAttributeExists(attribute: "presence out of office"))
}
// ensures that activity is only visible with images/initials (on default style, size 56)
func testActivitiesImage() throws {
app.switches["Show image"].tap()
let textField: XCUIElement = app.textFields.firstMatch
app.switches["Show image"].switches.firstMatch.tap()
app.buttons.matching(NSPredicate(format: "label CONTAINS '.none'")).element(boundBy: 1).tap()
app.buttons[".circle"].tap()
app.buttons[".size72"].tap()
app.buttons[".size56"].tap()
XCTAssert(avatarWithAttributeExists(attribute: "activity 1"))
app.switches["Set image"].tap()
app.switches["Set image"].switches.firstMatch.tap()
XCTAssert(avatarWithAttributeExists(attribute: "activity 1"))
// removes name and image to set icon
app.textFields.firstMatch.doubleTap()
app.menuItems["Cut"].tap()
app.switches["Set image"].tap()
textField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
textField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
app.switches["Set image"].switches.firstMatch.tap()
XCTAssert(!avatarWithAttributeExists(attribute: "activity"))
app.buttons[".circle"].tap()
@ -137,16 +140,16 @@ class AvatarTestSwiftUI: BaseTest {
XCTAssert(!avatarWithAttributeExists(attribute: "activity"))
// adds name back
app.textFields.firstMatch.tap()
app.menuItems["Paste"].tap()
textField.tap()
textField.typeText("Kat Larsson\n")
XCTAssert(avatarWithAttributeExists(attribute: "activity 2"))
app.switches["Set image"].tap()
app.switches["Set image"].switches.firstMatch.tap()
XCTAssert(avatarWithAttributeExists(attribute: "activity 2"))
}
// ensures that activity is only visible on default style (on intials, size 56)
func testActivitiesStyle() throws {
app.switches["Show image"].tap()
app.switches["Show image"].switches.firstMatch.tap()
app.buttons.matching(NSPredicate(format: "label CONTAINS '.none'")).element(boundBy: 1).tap()
app.buttons[".circle"].tap()
app.buttons[".size72"].tap()
@ -192,7 +195,7 @@ class AvatarTestSwiftUI: BaseTest {
// ensures that activity is only visible on size 56 and 40 (on intials, default style)
func testActivitiesSize() throws {
app.switches["Show image"].tap()
app.switches["Show image"].switches.firstMatch.tap()
app.buttons.matching(NSPredicate(format: "label CONTAINS '.none'")).element(boundBy: 1).tap()
app.buttons[".circle"].tap()

Просмотреть файл

@ -24,7 +24,7 @@ class HUDTestSwiftUI: BaseTest {
}
func testBlocksPresentation() throws {
let blocksInteractionSwitch: XCUIElement = app.switches["Blocks interaction"]
let blocksInteractionSwitch: XCUIElement = app.switches["Blocks interaction"].switches.firstMatch
let presentHUDButton: XCUIElement = app.buttons["Present HUD for 3 seconds"]
// switch value should start as 1
@ -50,11 +50,10 @@ class HUDTestSwiftUI: BaseTest {
}
func testLabels() throws {
let textField: XCUIElement = app.textFields.firstMatch
XCTAssert(app.images.element(matching: NSPredicate(format: "identifier CONTAINS %@", "HUD with no label")).exists)
app.textFields.firstMatch.tap()
UIPasteboard.general.string = "label"
app.textFields.element.doubleTap()
app.menuItems["Paste"].tap()
textField.tap()
textField.typeText("label\n")
XCTAssert(app.images.element(matching: NSPredicate(format: "identifier CONTAINS %@", "HUD with label \"label\"")).exists)
}

Просмотреть файл

@ -17,8 +17,8 @@ class IndeterminateProgressBarTestSwiftUI: IndeterminateProgressBarTest {
}
override func testStartStopHide() throws {
let animatingSwitch: XCUIElement = app.switches["Animating"]
let hidesWhenStoppedSwitch: XCUIElement = app.switches["Hides when stopped"]
let animatingSwitch: XCUIElement = app.switches["Animating"].switches.firstMatch
let hidesWhenStoppedSwitch: XCUIElement = app.switches["Hides when stopped"].switches.firstMatch
hidesWhenStoppedSwitch.tap()
XCTAssert(indeterminateProgressBarExists(status: inProgress))

Просмотреть файл

@ -22,33 +22,31 @@ class NotificationViewTestSwiftUI: BaseTest {
let titleTextField: XCUIElement = app.textFields.element(boundBy: 0)
let messageTextField: XCUIElement = app.textFields.element(boundBy: 1)
let actionButtonTextField: XCUIElement = app.textFields.element(boundBy: 2)
let attributedTextSwitch: XCUIElement = app.switches["Has Attributed Text: Strikethrough"]
let attributedTextSwitch: XCUIElement = app.switches["Has Attributed Text: Strikethrough"].switches.firstMatch
XCTAssert(app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View.*message \"Mail Archived\".*action button titled \"Undo\".*")).element.exists)
titleTextField.tap()
UIPasteboard.general.string = "title"
titleTextField.doubleTap()
app.menuItems["Paste"].tap()
titleTextField.typeText("title\n")
XCTAssert(app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View with title \"title\", message \"Mail Archived\".*action button titled \"Undo\".*")).element.exists)
attributedTextSwitch.tap()
XCTAssert(app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View with attributed title \"title\", attributed message \"Mail Archived\".*action button titled \"Undo\".*")).element.exists)
titleTextField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
app.menuItems["Cut"].tap()
titleTextField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
messageTextField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
app.menuItems["Cut"].tap()
messageTextField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
actionButtonTextField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
app.menuItems["Cut"].tap()
actionButtonTextField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
// if there is no action button title, there should be a dismiss button
XCTAssert(app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View with no title, no message.*dismiss button.*")).element.exists)
}
func testImages() {
let actionButtonTextField: XCUIElement = app.textFields.element(boundBy: 2)
let setImageSwitch: XCUIElement = app.switches["Set image"]
let setTrailingImageSwitch: XCUIElement = app.switches["Set trailing image"]
let setImageSwitch: XCUIElement = app.switches["Set image"].switches.firstMatch
let setTrailingImageSwitch: XCUIElement = app.switches["Set trailing image"].switches.firstMatch
XCTAssert(!app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View.*image.*")).element.exists)
setImageSwitch.tap()
@ -58,7 +56,7 @@ class NotificationViewTestSwiftUI: BaseTest {
// as long as there is a action button title, there should be no trailing image
XCTAssert(!app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View.*trailing image.*")).element.exists)
actionButtonTextField.tap(withNumberOfTaps: 3, numberOfTouches: 1)
app.menuItems["Cut"].tap()
actionButtonTextField.typeText(String(XCUIKeyboardKey.delete.rawValue) + "\n")
XCTAssert(app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View.*trailing image.*")).element.exists)
setTrailingImageSwitch.tap()
// if there is no action button title, there should be a dismiss button
@ -69,8 +67,8 @@ class NotificationViewTestSwiftUI: BaseTest {
let notificationView: XCUIElement = app.otherElements.containing(NSPredicate(format: "identifier MATCHES %@", "Notification View.*")).element(boundBy: 7)
let actionButton: XCUIElement = app.buttons["Undo"].firstMatch
let hasActionButtonActionSwitch: XCUIElement = app.switches["Has Action Button Action"]
let hasMessageActionSwitch: XCUIElement = app.switches["Has Message Action"]
let hasActionButtonActionSwitch: XCUIElement = app.switches["Has Action Button Action"].switches.firstMatch
let hasMessageActionSwitch: XCUIElement = app.switches["Has Message Action"].switches.firstMatch
let alert: XCUIElement = app.alerts["Button tapped"]
let okButton: XCUIElement = app.buttons["OK"]
@ -116,7 +114,7 @@ class NotificationViewTestSwiftUI: BaseTest {
}
func testWidth() throws {
let flexibleWidthSwitch: XCUIElement = app.switches["Flexible Width Toast"]
let flexibleWidthSwitch: XCUIElement = app.switches["Flexible Width Toast"].switches.firstMatch
let notFlexible: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Notification View.*that is not flexible in width.*")
let flexible: NSPredicate = NSPredicate(format: "identifier MATCHES %@", "Notification View.*that is flexible in width.*")

Просмотреть файл

@ -3,7 +3,7 @@
if [ -n "$XCODE_PATH_OVERRIDE" ]; then # If someone calls this with the XCODE_PATH_OVERRIDE variable set to a path to a developer dir, use it instead
XCODE_PATH="$XCODE_PATH_OVERRIDE"
else
XCODE_PATH='/Applications/Xcode_14.1.app/Contents/Developer'
XCODE_PATH='/Applications/Xcode_14.3.app/Contents/Developer'
fi
echo "Running command: sudo xcode-select --switch $XCODE_PATH"