Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add MTE-2186 [v124] opt in notification fakespot test #18415

Merged
merged 1 commit into from
Jan 29, 2024
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 @@ -61,6 +61,7 @@
"DragAndDropTestIpad\/testTryDragAndDropHistoryToURLBar()",
"DragAndDropTests\/testRearrangeTabsTabTray()",
"ExperimentIntegrationTests",
"FakespotTests\/testAcceptTheRejectedOptInNotification()",
"FakespotTests\/testPriceTagIconAvailableOnlyOnDetailPage()",
"FakespotTests\/testPriceTagNotDisplayedInPrivateMode()",
"FakespotTests\/testReviewQualityCheckBottomSheetUI()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests\/testAcceptTheRejectedOptInNotification()",
"FakespotTests\/testFakespotAvailable()",
"FakespotTests\/testPriceTagNotDisplayedInPrivateMode()",
"FakespotTests\/testReviewQualityCheckBottomSheetUI()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests\/testAcceptTheRejectedOptInNotification()",
"FakespotTests\/testFakespotAvailable()",
"FakespotTests\/testPriceTagIconAvailableOnlyOnDetailPage()",
"FakespotTests\/testReviewQualityCheckBottomSheetUI()",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Copy link
Contributor

@isabelrios isabelrios Jan 29, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test has failed 1 out of 3 in the PR, can we try to make it more stable?
~Tests/XCUITests/BaseTestCase.swift:128 - failed - Timed out waiting for element "Search Amazon" TextField to exist

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yea, i am planning to look into it, locally is hard to catch that corner case, but i will make it more stable

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
Expand Down Expand Up @@ -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()
Expand All @@ -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)
Expand All @@ -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() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down