Skip to content

Commit d349f2d

Browse files
Philip Stoehraudie1
Philip Stoehr
authored and
audie1
committed
ci(tests): a few Home position scroll tests
ci(tests): scroll position is maintained after navigating away from Home, and returning ci(tests): added test for Home position after returning from Reader ci(tests): added a test for returning from collection ci(tests): added a new Slate for additional testing ci(tests): additional commit ci(tests): correcting json data mistype ci(tests): mismatch correction 2 ci(tests): removing some json changes ci(tests): fixing swift lint errors
1 parent 2b66825 commit d349f2d

File tree

4 files changed

+56
-2
lines changed

4 files changed

+56
-2
lines changed

Tests iOS/HomeTests.swift

+40
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,46 @@ class HomeTests: XCTestCase {
332332
rec2Cell.savedButton.wait()
333333
rec1Cell.savedButton.wait()
334334
}
335+
336+
func test_returningFromSaves_maintainsHomePosition() {
337+
let home = app.launch().homeView
338+
home.overscroll()
339+
validateBottomMessage()
340+
app.tabBar.savesButton.tap()
341+
app.tabBar.homeButton.tap()
342+
validateBottomMessage()
343+
}
344+
345+
func test_returningFromSettings_maintainsHomePosition() {
346+
let home = app.launch().homeView
347+
home.overscroll()
348+
validateBottomMessage()
349+
app.tabBar.settingsButton.tap()
350+
app.tabBar.homeButton.tap()
351+
validateBottomMessage()
352+
}
353+
354+
func test_returningFromReader_maintainsHomePosition() {
355+
let home = app.launch().homeView
356+
home.overscroll()
357+
validateBottomMessage()
358+
home.recommendationCell("Syndicated Article Rec, 1").tap()
359+
app.readerView.readerHomeButton.wait().tap()
360+
validateBottomMessage()
361+
}
362+
363+
func test_returningFromSeeAll_maintainsHomePosition() {
364+
let home = app.launch().homeView
365+
home.overscroll()
366+
validateBottomMessage()
367+
home.seeAllCollectionButton.tap()
368+
app.readerView.readerHomeButton.wait().tap()
369+
validateBottomMessage()
370+
}
371+
372+
func validateBottomMessage() {
373+
XCTAssertTrue(app.homeView.overscrollText.exists)
374+
}
335375
}
336376

337377
extension HomeTests {

Tests iOS/ReportARecommendationTests.swift

-2
Original file line numberDiff line numberDiff line change
@@ -161,10 +161,8 @@ class ReportARecommendationTests: XCTestCase {
161161
// Swipe down to a syndicated item
162162
app.homeView.element.swipeUp()
163163
app.homeView.recommendationCell("Syndicated Article Rec, 1").wait().tap()
164-
165164
app.readerView.readerToolbar.moreButton.tap()
166165
app.reportButton.wait().tap()
167-
168166
app.reportView.wait()
169167
}
170168
}

Tests iOS/Support/Elements/HomeViewElement.swift

+12
Original file line numberDiff line numberDiff line change
@@ -77,4 +77,16 @@ struct HomeViewElement: PocketUIElement {
7777
.coordinate(withNormalizedOffset: origin)
7878
.press(forDuration: 0.1, thenDragTo: element.coordinate(withNormalizedOffset: destination), withVelocity: .fast, thenHoldForDuration: 1)
7979
}
80+
81+
var overscrollText: XCUIElement {
82+
element.otherElements["slate-detail-overscroll"]
83+
}
84+
85+
var seeAllCollectionButton: XCUIElement {
86+
element.staticTexts["See All"]
87+
}
88+
89+
var returnToHomeButton: XCUIElement {
90+
element.buttons["Home"]
91+
}
8092
}

Tests iOS/Support/Elements/ReaderElement.swift

+4
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,10 @@ struct ReaderElement: PocketUIElement {
7878
var safariDoneButton: XCUIElement {
7979
element.buttons["Done"]
8080
}
81+
82+
var readerHomeButton: XCUIElement {
83+
element.buttons["Home"]
84+
}
8185

8286
var unsupportedElementOpenButton: XCUIElement {
8387
element.buttons["Open in Web View"]

0 commit comments

Comments
 (0)