Skip to content
Merged
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 @@ -211,7 +211,7 @@ class Action {
static let OpenPrivateTabLongPressTabsButton = "OpenPrivateTabLongPressTabsButton"
static let OpenNewTabLongPressTabsButton = "OpenNewTabLongPressTabsButton"

static let TogglePocketInNewTab = "TogglePocketInNewTab"
static let ToggleStoriesInNewTab = "ToggleStoriesInNewTab"
static let ToggleHistoryInNewTab = "ToggleHistoryInNewTab"
static let ToggleRecentlySaved = "ToggleRecentlySaved"
static let ToggleJumpBackIn = "ToggleJumpBackIn"
Expand Down
31 changes: 14 additions & 17 deletions firefox-ios/firefox-ios-tests/Tests/XCUITests/StoryTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@ class StoryTests: BaseTestCase {
case up, down, left, right
}

func validatePocketStoriesCount() {
let numPocketStories = app.collectionViews
func validateNewsStoriesCount() {
let numNewsStories = app.collectionViews
.cells.matching(identifier: AccessibilityIdentifiers.FirefoxHomepage.Pocket.itemCell)
.staticTexts.count
XCTAssertTrue(numPocketStories > 1, "Expected at least 2 stories.")
XCTAssertTrue(numNewsStories > 1, "Expected at least 2 stories.")
}

func togglePocket(shouldEnable: Bool) {
navigator.performAction(shouldEnable ? Action.TogglePocketInNewTab : Action.TogglePocketInNewTab)
func toggleStories(shouldEnable: Bool) {
navigator.performAction(shouldEnable ? Action.ToggleStoriesInNewTab : Action.ToggleStoriesInNewTab)
navigator.goto(NewTabScreen)
}

Expand All @@ -41,7 +41,7 @@ class StoryTests: BaseTestCase {
}

// https://mozilla.testrail.io/index.php?/cases/view/2306924
func testPocketEnabledByDefault() {
func testNewsStoriesEnabledByDefault() {
navigator.goto(NewTabScreen)
app.partialSwipeUp(distance: 0.2)
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.FirefoxHomepage.SectionTitles.merino])
Expand All @@ -50,21 +50,18 @@ class StoryTests: BaseTestCase {
"News"
)

// There should be at least 8 stories on iPhone and 7 on iPad.
// You can see more stories on iPhone by swiping left, but not all
// stories are displayed at once.
validatePocketStoriesCount()
validateNewsStoriesCount()

// Disable Pocket
togglePocket(shouldEnable: false)
// Disable Stories
toggleStories(shouldEnable: false)
mozWaitForElementToNotExist(app.staticTexts[AccessibilityIdentifiers.FirefoxHomepage.SectionTitles.merino])

// Enable it again
togglePocket(shouldEnable: true)
toggleStories(shouldEnable: true)
app.partialSwipeUp(distance: 0.2)
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.FirefoxHomepage.SectionTitles.merino])

// Tap on the first Pocket element
// Tap on the first News element
app.collectionViews
.cells.matching(identifier: AccessibilityIdentifiers.FirefoxHomepage.Pocket.itemCell)
.staticTexts.firstMatch.tap()
Expand All @@ -75,13 +72,13 @@ class StoryTests: BaseTestCase {
}

// https://mozilla.testrail.io/index.php?/cases/view/2855360
func testValidatePocketContextMenu() {
func testValidateNewsContextMenu() {
navigator.goto(NewTabScreen)
app.partialSwipeUp(distance: 0.2)
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.FirefoxHomepage.SectionTitles.merino])
// Long tap on one of the stories
let pocketCell = AccessibilityIdentifiers.FirefoxHomepage.Pocket.itemCell
app.collectionViews.cells.matching(identifier: pocketCell).staticTexts.firstMatch.press(forDuration: 1.5)
let newsCell = AccessibilityIdentifiers.FirefoxHomepage.Pocket.itemCell
app.collectionViews.cells.matching(identifier: newsCell).staticTexts.firstMatch.press(forDuration: 1.5)
// Validate Context menu
let contextMenuTable = app.tables["Context Menu"]
waitForElementsToExist(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ func registerHomePanelNavigation(in map: MMScreenGraph<FxUserState>, app: XCUIAp
app.cells["HomeAsCustomURL"].waitAndTap()
}

screenState.gesture(forAction: Action.TogglePocketInNewTab) { userState in
screenState.gesture(forAction: Action.ToggleStoriesInNewTab) { userState in
userState.pocketInNewTab = !userState.pocketInNewTab
app.tables.cells.switches["Stories"].waitAndTap()
}
Expand Down
Loading