Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -318,10 +318,11 @@ public class BlockEditorScreen: ScreenObject {
}

private func dismissBlockEditorPopovers() {
// TODO: Find a better way to reliably dismiss a UIMenu without interacting with it
waitAndTap(postSettingsButton)
_ = try? EditorPostSettings().closePostSettings()

if dismissPopoverRegion.exists {
dismissPopoverRegion.tap()
} else {
app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).tap()
}
dismissImageViewIfNeeded()
}

Expand Down Expand Up @@ -467,7 +468,7 @@ public class BlockEditorScreen: ScreenObject {
// Safety check
XCTAssertTrue(element.waitForExistence(timeout: 1))

element.doubleTap()
doubleTapElement(element)

let pasteButton = app.menuItems["Paste"]

Expand All @@ -477,7 +478,7 @@ public class BlockEditorScreen: ScreenObject {
element.descendants(matching: .any).enumerated().forEach { e in
guard found == false else { return }

e.element.firstMatch.doubleTap()
doubleTapElement(e.element.firstMatch)

if pasteButton.waitForExistence(timeout: 1) {
found = true
Expand All @@ -489,4 +490,12 @@ public class BlockEditorScreen: ScreenObject {

pasteButton.tap()
}

private func doubleTapElement(_ element: XCUIElement) {
if element.isHittable {
element.doubleTap()
} else {
element.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.5)).doubleTap()
}
}
}
23 changes: 16 additions & 7 deletions Modules/Sources/UITestsFoundation/Screens/MySiteScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,13 +127,22 @@ public class MySiteScreen: ScreenObject {
var duration: TimeInterval = 10.0

public init(app: XCUIApplication = XCUIApplication()) throws {
try super.init(
expectedElementGetters: [
switchSiteButtonGetter,
createButtonGetter
],
app: app
)
if XCTestCase.isPad {
try super.init(
expectedElementGetters: [
createButtonGetter
],
app: app
)
} else {
try super.init(
expectedElementGetters: [
switchSiteButtonGetter,
createButtonGetter
],
app: app
)
}
}

public func showSiteSwitcher() throws -> MySitesScreen {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import XCTest
public class SidebarScreen: ScreenObject {
public init(app: XCUIApplication = XCUIApplication()) throws {
try super.init {
$0.collectionViews["sidebar_list"].firstMatch
$0.buttons["sidebar_me"].firstMatch
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ public class SidebarSiteMenuScreen: ScreenObject {
}

func openSidebar() throws -> SidebarScreen {
navigationBar.buttons.element(boundBy: 0).tap()
let sidebarMeButton = app.buttons["sidebar_me"].firstMatch
if !sidebarMeButton.isHittable {
navigationBar.buttons.element(boundBy: 0).tap()
}
return try SidebarScreen()
}

Expand Down
28 changes: 0 additions & 28 deletions WordPress/UITests/Tests/LoginTests.swift

This file was deleted.

6 changes: 0 additions & 6 deletions WordPress/WordPress.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,6 @@
EA14532A29AD874C001F3143 /* ReaderTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = EAB10E3F27487F5D000DA4C1 /* ReaderTests.swift */; };
EA14532B29AD874C001F3143 /* EditorAztecTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = BED4D82F1FF11DEF00A11345 /* EditorAztecTests.swift */; };
EA14532C29AD874C001F3143 /* EditorGutenbergTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC2BB0CF228ACF710034F9AB /* EditorGutenbergTests.swift */; };
EA14532D29AD874C001F3143 /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF2716911CAAC87B0006E2D4 /* LoginTests.swift */; };
EA14532E29AD874C001F3143 /* BaseScreen.swift in Sources */ = {isa = PBXBuildFile; fileRef = BE2B4E9E1FD664F5007AE3E4 /* BaseScreen.swift */; };
EA14533129AD874C001F3143 /* WPUITestCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC8A5EAA22159FA6001B7874 /* WPUITestCredentials.swift */; };
EA14533229AD874C001F3143 /* SignupTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = CC7CB97222B1510900642EE9 /* SignupTests.swift */; };
Expand Down Expand Up @@ -300,7 +299,6 @@
FAF64B982637DEEC00E8A1DF /* ScreenshotCredentials.swift in Sources */ = {isa = PBXBuildFile; fileRef = F9463A7221C05EE90081F11E /* ScreenshotCredentials.swift */; };
FAF64E4F2637E85800E8A1DF /* JetpackScreenshotGeneration.swift in Sources */ = {isa = PBXBuildFile; fileRef = FAF64E4E2637E85800E8A1DF /* JetpackScreenshotGeneration.swift */; };
FD3D6D2C1349F5D30061136A /* ImageIO.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FD3D6D2B1349F5D30061136A /* ImageIO.framework */; };
FF2716921CAAC87B0006E2D4 /* LoginTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF2716911CAAC87B0006E2D4 /* LoginTests.swift */; };
FF2716A11CABC7D40006E2D4 /* XCTest+Extensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = FF2716A01CABC7D40006E2D4 /* XCTest+Extensions.swift */; };
FF4DEAD8244B56E300ACA032 /* CoreServices.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF4DEAD7244B56E200ACA032 /* CoreServices.framework */; };
FF75933B1BE2423800814D3B /* Photos.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = FF75933A1BE2423800814D3B /* Photos.framework */; };
Expand Down Expand Up @@ -1033,7 +1031,6 @@
FD3D6D2B1349F5D30061136A /* ImageIO.framework */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = wrapper.framework; name = ImageIO.framework; path = System/Library/Frameworks/ImageIO.framework; sourceTree = SDKROOT; };
FDCB9A89134B75B900E5C776 /* it */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = it; path = it.lproj/Localizable.strings; sourceTree = "<group>"; };
FF27168F1CAAC87A0006E2D4 /* WordPressUITests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = WordPressUITests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
FF2716911CAAC87B0006E2D4 /* LoginTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LoginTests.swift; sourceTree = "<group>"; };
FF2716931CAAC87B0006E2D4 /* WordPressUITests-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "WordPressUITests-Info.plist"; sourceTree = "<group>"; };
FF2716A01CABC7D40006E2D4 /* XCTest+Extensions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "XCTest+Extensions.swift"; sourceTree = "<group>"; };
FF37F90822385C9F00AFA3DB /* RELEASE-NOTES.txt */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = "RELEASE-NOTES.txt"; path = "../RELEASE-NOTES.txt"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2038,7 +2035,6 @@
D82E087429EEB0B00098F500 /* DashboardTests.swift */,
BED4D82F1FF11DEF00A11345 /* EditorAztecTests.swift */,
CC2BB0CF228ACF710034F9AB /* EditorGutenbergTests.swift */,
FF2716911CAAC87B0006E2D4 /* LoginTests.swift */,
01281E9B2A051EEA00464F8F /* MySiteTests.swift */,
809A91022A7A4C710063D4FA /* NotificationTests.swift */,
80B42ABE2AB2CB1300377607 /* PagesTests.swift */,
Expand Down Expand Up @@ -3763,7 +3759,6 @@
EA14532B29AD874C001F3143 /* EditorAztecTests.swift in Sources */,
D82E087629EEB0B00098F500 /* DashboardTests.swift in Sources */,
EA14532C29AD874C001F3143 /* EditorGutenbergTests.swift in Sources */,
EA14532D29AD874C001F3143 /* LoginTests.swift in Sources */,
80B42AC02AB2CB1400377607 /* PagesTests.swift in Sources */,
EA14532E29AD874C001F3143 /* BaseScreen.swift in Sources */,
0C3858202CA74DC7004880ED /* AppSettingsTests.swift in Sources */,
Expand Down Expand Up @@ -3809,7 +3804,6 @@
BED4D8301FF11DEF00A11345 /* EditorAztecTests.swift in Sources */,
D82E087529EEB0B00098F500 /* DashboardTests.swift in Sources */,
3F2F856326FAF612000FCDA5 /* EditorGutenbergTests.swift in Sources */,
FF2716921CAAC87B0006E2D4 /* LoginTests.swift in Sources */,
80B42ABF2AB2CB1300377607 /* PagesTests.swift in Sources */,
BE2B4E9F1FD664F5007AE3E4 /* BaseScreen.swift in Sources */,
0C3858212CA74DC7004880ED /* AppSettingsTests.swift in Sources */,
Expand Down