File tree Expand file tree Collapse file tree 3 files changed +51
-8
lines changed
UITestsFoundation/Screens/MyStore Expand file tree Collapse file tree 3 files changed +51
-8
lines changed Original file line number Diff line number Diff line change @@ -27,4 +27,46 @@ public final class MyStoreScreen: ScreenObject {
2727 topBannerCloseButton. tap ( )
2828 return self
2929 }
30+
31+ func tapTimeframeTab( timeframe: String ) -> MyStoreScreen {
32+ app. cells. staticTexts [ timeframe] . tap ( )
33+
34+ return self
35+ }
36+
37+ public func goToThisWeekTab( ) -> MyStoreScreen {
38+ return tapTimeframeTab ( timeframe: " This Week " )
39+ }
40+
41+ public func goToThisMonthTab( ) -> MyStoreScreen {
42+ return tapTimeframeTab ( timeframe: " This Month " )
43+ }
44+
45+ public func goToThisYearTab( ) -> MyStoreScreen {
46+ return tapTimeframeTab ( timeframe: " This Year " )
47+ }
48+
49+ func verifyStatsForTimeframeLoaded( timeframe: String ) -> MyStoreScreen {
50+ let textPredicate = NSPredicate ( format: " label MATCHES %@ " , " Store revenue chart \( timeframe) " )
51+ XCTAssertTrue ( app. images. containing ( textPredicate) . element. exists, " \( timeframe) chart not displayed " )
52+
53+ return self
54+ }
55+
56+ public func verifyTodayStatsLoaded( ) -> MyStoreScreen {
57+ return verifyStatsForTimeframeLoaded ( timeframe: " Today " )
58+ }
59+
60+ public func verifyThisWeekStatsLoaded( ) -> MyStoreScreen {
61+ return verifyStatsForTimeframeLoaded ( timeframe: " This Week " )
62+ }
63+
64+ public func verifyThisMonthStatsLoaded( ) -> MyStoreScreen {
65+ return verifyStatsForTimeframeLoaded ( timeframe: " This Month " )
66+ }
67+
68+ @discardableResult
69+ public func verifyThisYearStatsLoaded( ) -> MyStoreScreen {
70+ return verifyStatsForTimeframeLoaded ( timeframe: " This Year " )
71+ }
3072}
Original file line number Diff line number Diff line change @@ -14,7 +14,7 @@ The following flows are covered/planned to be covered by UI tests. Tests that ar
1414 - [ ] Log in with Apple
1515 - [ ] Log in with Google
16162 . My Store
17- - [ ] Stats Today, This Week, This Month, This Year load
17+ - [x ] Stats Today, This Week, This Month, This Year load
1818 - [ ] Tap chart on stats
19193 . Orders
2020 - [x] Orders list loads
Original file line number Diff line number Diff line change @@ -4,7 +4,6 @@ import XCTest
44final class StatsTests : XCTestCase {
55
66 override func setUpWithError( ) throws {
7- try skipTillImplemented ( )
87 continueAfterFailure = false
98
109 // UI tests must launch the application that they test.
@@ -15,12 +14,14 @@ final class StatsTests: XCTestCase {
1514 try LoginFlow . logInWithWPcom ( )
1615 }
1716
18- func skipped_test_load_stats_screen ( ) throws {
17+ func test_load_stats_screen ( ) throws {
1918 try TabNavComponent ( ) . goToMyStoreScreen ( )
20- }
21-
22- func skipTillImplemented( file: StaticString = #file, line: UInt = #line) throws {
23- try XCTSkipIf ( true ,
24- " Skipping until test is properly implemented " , file: file, line: line)
19+ . verifyTodayStatsLoaded ( )
20+ . goToThisWeekTab ( )
21+ . verifyThisWeekStatsLoaded ( )
22+ . goToThisMonthTab ( )
23+ . verifyThisMonthStatsLoaded ( )
24+ . goToThisYearTab ( )
25+ . verifyThisYearStatsLoaded ( )
2526 }
2627}
You can’t perform that action at this time.
0 commit comments