diff --git a/firefox-ios/firefox-ios-tests/Tests/FullFunctionalTestPlan.xctestplan b/firefox-ios/firefox-ios-tests/Tests/FullFunctionalTestPlan.xctestplan index b7e39ca531ce..36c218e5d6c1 100644 --- a/firefox-ios/firefox-ios-tests/Tests/FullFunctionalTestPlan.xctestplan +++ b/firefox-ios/firefox-ios-tests/Tests/FullFunctionalTestPlan.xctestplan @@ -61,6 +61,7 @@ "DragAndDropTestIpad\/testTryDragAndDropHistoryToURLBar()", "DragAndDropTests\/testRearrangeTabsTabTray()", "ExperimentIntegrationTests", + "FakespotTests\/testAcceptTheRejectedOptInNotification()", "FakespotTests\/testPriceTagIconAvailableOnlyOnDetailPage()", "FakespotTests\/testPriceTagNotDisplayedInPrivateMode()", "FakespotTests\/testReviewQualityCheckBottomSheetUI()", diff --git a/firefox-ios/firefox-ios-tests/Tests/Smoketest2.xctestplan b/firefox-ios/firefox-ios-tests/Tests/Smoketest2.xctestplan index 4e016f00e11a..981e37ff89cb 100644 --- a/firefox-ios/firefox-ios-tests/Tests/Smoketest2.xctestplan +++ b/firefox-ios/firefox-ios-tests/Tests/Smoketest2.xctestplan @@ -37,6 +37,7 @@ "DragAndDropTests", "EngagementNotificationTests", "ExperimentIntegrationTests", + "FakespotTests\/testAcceptTheRejectedOptInNotification()", "FakespotTests\/testFakespotAvailable()", "FakespotTests\/testPriceTagNotDisplayedInPrivateMode()", "FakespotTests\/testReviewQualityCheckBottomSheetUI()", diff --git a/firefox-ios/firefox-ios-tests/Tests/Smoketest4.xctestplan b/firefox-ios/firefox-ios-tests/Tests/Smoketest4.xctestplan index 62058d028ffc..8fc1c8a98a77 100644 --- a/firefox-ios/firefox-ios-tests/Tests/Smoketest4.xctestplan +++ b/firefox-ios/firefox-ios-tests/Tests/Smoketest4.xctestplan @@ -33,6 +33,7 @@ "DragAndDropTests", "EngagementNotificationTests", "ExperimentIntegrationTests", + "FakespotTests\/testAcceptTheRejectedOptInNotification()", "FakespotTests\/testFakespotAvailable()", "FakespotTests\/testPriceTagIconAvailableOnlyOnDetailPage()", "FakespotTests\/testReviewQualityCheckBottomSheetUI()", diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FakespotTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FakespotTests.swift index 6cd132cd7762..436d65ce5275 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/FakespotTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/FakespotTests.swift @@ -66,6 +66,33 @@ class FakespotTests: IphoneOnlyTestCase { mozWaitForElementToNotExist(app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton]) } + // https://testrail.stage.mozaws.net/index.php?/cases/view/2358924 + // Smoketest + func testAcceptTheRejectedOptInNotification() { + if skipPlatform { return } + reachReviewChecker() + mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) + XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, "Review Checker") + + // Reject the Opt-in notification + app.otherElements.buttons[AccessibilityIdentifiers.Shopping.sheetCloseButton].tap() + // The sheet is dismissed and the user remains opted-out + mozWaitForElementToNotExist(app.otherElements[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) + mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton]) + // Tap again the Price tag icon + app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap() + // The contextual onboarding screen is displayed + mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) + XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, "Review Checker") + // Tap the "Yes, Try it" button + mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Shopping.OptInCard.mainButton]) + app.buttons[AccessibilityIdentifiers.Shopping.OptInCard.mainButton].tap() + // The sheet is populated with product feedback data + mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle]) + XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, "Review Checker") + XCTAssertEqual(app.buttons[AccessibilityIdentifiers.Shopping.sheetCloseButton].label, "Close Review Checker") + } + private func validateHighlightsSection() { if app.staticTexts[AccessibilityIdentifiers.Shopping.HighlightsCard.title].exists { let highlights = AccessibilityIdentifiers.Shopping.HighlightsCard.self @@ -100,11 +127,10 @@ class FakespotTests: IphoneOnlyTestCase { loadWebsiteAndPerformSearch() app.webViews["contentView"].firstMatch.images.firstMatch.tap() waitUntilPageLoad() - let shoppingButton = app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton] // Retry loading the page if shopping button is not visible - while !shoppingButton.exists { - loadWebsiteAndPerformSearch() + while app.webViews.staticTexts["Enter the characters you see below"].exists { + reachReviewChecker() } // Tap the shopping cart icon app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap() @@ -113,9 +139,9 @@ class FakespotTests: IphoneOnlyTestCase { private func loadWebsiteAndPerformSearch() { navigator.openURL("https://www.amazon.com") waitUntilPageLoad() + let website = app.webViews["contentView"].firstMatch // Search for and open a shoe listing - let website = app.webViews["contentView"].firstMatch let searchAmazon = website.textFields["Search Amazon"] mozWaitForElementToExist(searchAmazon) XCTAssert(searchAmazon.isEnabled) @@ -126,6 +152,10 @@ class FakespotTests: IphoneOnlyTestCase { searchAmazon.typeText("Shoe") website.buttons["Go"].tap() waitUntilPageLoad() + while website.links.elementContainingText("Sorry! Something went wrong on our end.").exists { + app.buttons["Reload page"].tap() + waitUntilPageLoad() + } } private func loadWebsiteInPrivateMode() { diff --git a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift index 56146a617ea1..13beeefa7039 100644 --- a/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift +++ b/firefox-ios/firefox-ios-tests/Tests/XCUITests/PhotonActionSheetTests.swift @@ -72,7 +72,7 @@ class PhotonActionSheetTests: BaseTestCase { // mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shareButton], timeout: 10) // app.buttons[AccessibilityIdentifiers.Toolbar.shareButton].tap() navigator.goto(BrowserTabMenu) - app.otherElements[ImageIdentifiers.share].tap() + app.otherElements[StandardImageIdentifiers.Large.shareApple].tap() // This is not ideal but only way to get the element on iPhone 8 // for iPhone 11, that would be boundBy: 2