Skip to content

Commit

Permalink
Add MTE-1520 [v119] Add simple test for Fakespot (#16405)
Browse files Browse the repository at this point in the history
* Add FakespotTests

* Disable FakespotTests for ExperimentalIntegration and Performance test plans

* Use accessibility identifiers. Add testrail link.

* Skip test for iPad

* Update the test to use the icon

* Import shared for strings

* Update Tests/XCUITests/FakespotTests.swift

* Remove import Shared statement for lint

* remove warning for Shared

---------

Co-authored-by: Winnie Teichmann <[email protected]>
Co-authored-by: isabelrios <[email protected]>
  • Loading branch information
3 people authored Oct 3, 2023
1 parent 685c65d commit e260331
Show file tree
Hide file tree
Showing 10 changed files with 52 additions and 0 deletions.
6 changes: 6 additions & 0 deletions Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -494,6 +494,8 @@
74E36D781B71323500D69DA1 /* SettingsContentViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74E36D771B71323500D69DA1 /* SettingsContentViewController.swift */; };
74F80D342A0A52D700013C3D /* PrivacyPolicyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 74F80D332A0A52D700013C3D /* PrivacyPolicyViewController.swift */; };
781C19CF2A780BEC0000DF46 /* Common in Frameworks */ = {isa = PBXBuildFile; productRef = 781C19CE2A780BEC0000DF46 /* Common */; };
782B0A362AB41DFC0049EE1A /* FakespotTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 782B0A352AB41DFC0049EE1A /* FakespotTests.swift */; };
784954492AC4806D002F0D12 /* Shared.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 288A2D861AB8B3260023ABC3 /* Shared.framework */; };
787EDD852943EE75002B93AE /* JumpBackInTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 787EDD832943EE75002B93AE /* JumpBackInTests.swift */; };
7B10AA9F1E3A15020002DD08 /* DataExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B10AA9E1E3A15020002DD08 /* DataExtensions.swift */; };
7B10AABB1E3A1F650002DD08 /* URLRequestExtensions.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7B10AABA1E3A1F650002DD08 /* URLRequestExtensions.swift */; };
Expand Down Expand Up @@ -4697,6 +4699,7 @@
7817451F8C836E21F734506D /* uk */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = uk; path = uk.lproj/Menu.strings; sourceTree = "<group>"; };
7819488D9C50ED2293FA92B1 /* gl */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = gl; path = gl.lproj/FindInPage.strings; sourceTree = "<group>"; };
781F4692919CC38F17A90EE3 /* anp */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = anp; path = anp.lproj/Intro.strings; sourceTree = "<group>"; };
782B0A352AB41DFC0049EE1A /* FakespotTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FakespotTests.swift; sourceTree = "<group>"; };
786E4F899C9E14715D44C1D2 /* gu-IN */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "gu-IN"; path = "gu-IN.lproj/PrivateBrowsing.strings"; sourceTree = "<group>"; };
78784AF7A74084713651DC6D /* hsb */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = hsb; path = hsb.lproj/ClearPrivateDataConfirm.strings; sourceTree = "<group>"; };
787EDD832943EE75002B93AE /* JumpBackInTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = JumpBackInTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7072,6 +7075,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
784954492AC4806D002F0D12 /* Shared.framework in Frameworks */,
43C6A47F27A0679300C79856 /* MappaMundi in Frameworks */,
8A05B0052A69A0C40011B622 /* Common in Frameworks */,
);
Expand Down Expand Up @@ -7716,6 +7720,7 @@
3BFE4B081D342FB900DDF53F /* XCUITests */ = {
isa = PBXGroup;
children = (
782B0A352AB41DFC0049EE1A /* FakespotTests.swift */,
787EDD832943EE75002B93AE /* JumpBackInTests.swift */,
4F2A06BD26F8E46E0017DA05 /* TabCounterTests.swift */,
4FB4AF7426E7E789005FDF91 /* HomeButtonTests.swift */,
Expand Down Expand Up @@ -12142,6 +12147,7 @@
3D71C89E1F5703A1008D8646 /* CopiedLinksTests.swift in Sources */,
2CF449A51E7BFE2C00FD7595 /* NavigationTest.swift in Sources */,
2C2A91291FA2410D002E36BD /* HistoryTests.swift in Sources */,
782B0A362AB41DFC0049EE1A /* FakespotTests.swift in Sources */,
580B0C4221748CFE00448DF8 /* DataManagementTests.swift in Sources */,
3BF4B8E91D38497A00493393 /* BaseTestCase.swift in Sources */,
3D9CAA1C1EFCD655002434DD /* ClipBoardTests.swift in Sources */,
Expand Down
1 change: 1 addition & 0 deletions Tests/ExperimentIntegrationTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"DragAndDropTestIpad",
"DragAndDropTests",
"EngagementNotificationTests",
"FakespotTests",
"FindInPageTests",
"FxScreenGraphTests",
"HistoryTests",
Expand Down
1 change: 1 addition & 0 deletions Tests/PerformanceTestPlan.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests",
"FindInPageTests",
"FxScreenGraphTests",
"HistoryTests",
Expand Down
1 change: 1 addition & 0 deletions Tests/SmokeXCUITests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
"DragAndDropTestIpad",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests",
"FindInPageTests\/testBarDissapearsWhenOpeningTabsTray()",
"FindInPageTests\/testBarDissapearsWhenReloading()",
"FindInPageTests\/testFindFromSelection()",
Expand Down
1 change: 1 addition & 0 deletions Tests/Smoketest2.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests",
"FindInPageTests",
"FxScreenGraphTests",
"HistoryTests",
Expand Down
1 change: 1 addition & 0 deletions Tests/Smoketest3.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests",
"FindInPageTests",
"FxScreenGraphTests",
"HistoryTests\/testClearHistoryFromSettings()",
Expand Down
1 change: 1 addition & 0 deletions Tests/Smoketest4.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
"DragAndDropTests",
"EngagementNotificationTests",
"ExperimentIntegrationTests",
"FakespotTests",
"FindInPageTests",
"FxScreenGraphTests",
"HistoryTests\/testClearHistoryFromSettings()",
Expand Down
1 change: 1 addition & 0 deletions Tests/SyncIntegrationTestPlan.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
"DragAndDropTestIpad",
"DragAndDropTests",
"EngagementNotificationTests",
"FakespotTests",
"FindInPageTests",
"FirstRunTourTests",
"FxScreenGraphTests",
Expand Down
38 changes: 38 additions & 0 deletions Tests/XCUITests/FakespotTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, You can obtain one at http://mozilla.org/MPL/2.0/
import XCTest
import Shared

class FakespotTests: BaseTestCase {
// https://testrail.stage.mozaws.net/index.php?/cases/view/2288332
func testFakespotAvailable() throws {
if iPad() {
throw XCTSkip("Fakespot is not enabled in iPad")
} else {
navigator.openURL("https://www.amazon.com")
waitUntilPageLoad()

// Search for and open a shoe listing
let website = app.webViews["contentView"].firstMatch
mozWaitForElementToExist(website.textFields["Search Amazon"])
XCTAssert(website.textFields["Search Amazon"].isEnabled)
website.textFields["Search Amazon"].tap()
website.textFields["Search Amazon"].typeText("Shoe")
website.buttons["Go"].tap()
waitUntilPageLoad()
website.images.firstMatch.tap()

// Tap the shopping cart icon
waitUntilPageLoad()
mozWaitForElementToExist(app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton])
app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap()
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle])
XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, .Shopping.SheetHeaderTitle)

// Close the popover
app.otherElements.buttons[AccessibilityIdentifiers.Shopping.sheetCloseButton].tap()
mozWaitForElementToNotExist(app.otherElements[AccessibilityIdentifiers.Shopping.sheetHeaderTitle])
}
}
}
1 change: 1 addition & 0 deletions Tests/XCUITests/XCUITests-Bridging-Header.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@

#import "XCTest/XCUIApplication.h"
#import "XCTest/XCUIElement.h"
#import "Shared-Bridging-Header.h"
@interface XCUIApplication (Private)
- (id)initPrivateWithPath:(NSString *)path bundleID:(NSString *)bundleID;
@end
Expand Down

0 comments on commit e260331

Please sign in to comment.