-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update UI tests for iPad * Fix UITestFlag * Revert the xctsetplan changes
- Loading branch information
Showing
65 changed files
with
617 additions
and
604 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
Modules/Sources/UITestsFoundation/Screens/Navigation/MainNavigationComponent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
import ScreenObject | ||
import XCTest | ||
import UIKit | ||
|
||
public protocol MainNavigationComponent { | ||
func goToReaderScreen() throws -> ReaderScreen | ||
func goToNotificationsScreen() throws -> NotificationsScreen | ||
func goToMeScreen() throws -> MeTabScreen | ||
} | ||
|
||
public func makeMainNavigationComponent() throws -> MainNavigationComponent { | ||
if XCTestCase.isPad { | ||
// Assuming the app is used in the fullscreen mode. | ||
return try SidebarNavComponent() | ||
} else { | ||
return try TabNavComponent() | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
Modules/Sources/UITestsFoundation/Screens/Navigation/SidebarNavComponent.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import ScreenObject | ||
import XCTest | ||
|
||
public class SidebarNavComponent: ScreenObject, MainNavigationComponent { | ||
public init(app: XCUIApplication = XCUIApplication()) throws { | ||
try super.init { | ||
$0.otherElements["root_vc"].firstMatch | ||
} | ||
} | ||
|
||
public func goToMeScreen() throws -> MeTabScreen { | ||
try openSidebar().openMeScreen() | ||
} | ||
|
||
public func goToReaderScreen() throws -> ReaderScreen { | ||
try openSidebar().openReaderScreen() | ||
} | ||
|
||
public func goToNotificationsScreen() throws -> NotificationsScreen { | ||
try openSidebar().openNotificationsScreen() | ||
} | ||
|
||
public func openSidebar() throws -> SidebarScreen { | ||
try openSiteMenu().openSidebar() | ||
} | ||
|
||
@discardableResult | ||
public func openSiteMenu() throws -> SidebarSiteMenuScreen { | ||
app.buttons["ToggleSidebar"].firstMatch.tap() | ||
return try SidebarSiteMenuScreen() | ||
} | ||
} |
27 changes: 27 additions & 0 deletions
27
Modules/Sources/UITestsFoundation/Screens/Navigation/SidebarScreen.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
import ScreenObject | ||
import XCTest | ||
|
||
/// Represents the main app-wide sidebar. | ||
public class SidebarScreen: ScreenObject { | ||
public init(app: XCUIApplication = XCUIApplication()) throws { | ||
try super.init { | ||
$0.collectionViews["sidebar_list"].firstMatch | ||
} | ||
} | ||
|
||
public func openMeScreen() throws -> MeTabScreen { | ||
app.buttons["sidebar_me"].firstMatch.tap() | ||
return try MeTabScreen() | ||
} | ||
|
||
public func openReaderScreen() throws -> ReaderScreen { | ||
app.staticTexts["sidebar_reader"].firstMatch.tap() | ||
app.swipeLeft() // Close the sidebar | ||
return try ReaderScreen() | ||
} | ||
|
||
public func openNotificationsScreen() throws -> NotificationsScreen { | ||
app.staticTexts["sidebar_notifications"].firstMatch.tap() | ||
return try NotificationsScreen() | ||
} | ||
} |
30 changes: 30 additions & 0 deletions
30
Modules/Sources/UITestsFoundation/Screens/Navigation/SidebarSiteMenuScreen.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
import ScreenObject | ||
import XCTest | ||
|
||
/// Represents the site menu displayed in the supplementary column on iPad. | ||
public class SidebarSiteMenuScreen: ScreenObject { | ||
var navigationBar: XCUIElement { | ||
app.navigationBars["site_menu_navbar"].firstMatch | ||
} | ||
|
||
var table: XCUIElement { | ||
app.tables["Blog Details Table"].firstMatch | ||
} | ||
|
||
public init(app: XCUIApplication = XCUIApplication()) throws { | ||
try super.init { | ||
$0.navigationBars["site_menu_navbar"].firstMatch | ||
} | ||
} | ||
|
||
func openSidebar() throws -> SidebarScreen { | ||
navigationBar.buttons.element(boundBy: 0).tap() | ||
return try SidebarScreen() | ||
} | ||
|
||
public func removeSelfHostedSite() { | ||
table.swipeUp(velocity: .fast) | ||
table.cells["BlogDetailsRemoveSiteCell"].tap() | ||
app.alerts.buttons.element(boundBy: 1).tap() | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.