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-1520 [v119] Add simple test for Fakespot #16405

Merged
merged 15 commits into from
Oct 3, 2023
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
6 changes: 6 additions & 0 deletions Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,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 @@ -4695,6 +4697,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 @@ -7070,6 +7073,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
784954492AC4806D002F0D12 /* Shared.framework in Frameworks */,
43C6A47F27A0679300C79856 /* MappaMundi in Frameworks */,
8A05B0052A69A0C40011B622 /* Common in Frameworks */,
);
Expand Down Expand Up @@ -7713,6 +7717,7 @@
3BFE4B081D342FB900DDF53F /* XCUITests */ = {
isa = PBXGroup;
children = (
782B0A352AB41DFC0049EE1A /* FakespotTests.swift */,
787EDD832943EE75002B93AE /* JumpBackInTests.swift */,
4F2A06BD26F8E46E0017DA05 /* TabCounterTests.swift */,
4FB4AF7426E7E789005FDF91 /* HomeButtonTests.swift */,
Expand Down Expand Up @@ -12139,6 +12144,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
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

import Shared is giving me a new warning but the identifier does not work without this import. 🤔

⚠️  /Users/vagrant/git/Tests/XCUITests/FakespotTests.swift:5:8: implicit import of bridging header 'Shared-Bridging-Header.h' via module 'Shared' is deprecated and will be removed in a later version of Swift
import Shared

Copy link
Contributor

@isabelrios isabelrios Sep 27, 2023

Choose a reason for hiding this comment

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

@clarmso we should try to fix this warning before merging, otherwise we will be close to threshold again... I can try to help you with that


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])
Copy link
Contributor

Choose a reason for hiding this comment

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

🎉

app.buttons[AccessibilityIdentifiers.Toolbar.shoppingButton].tap()
mozWaitForElementToExist(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle])
XCTAssertEqual(app.staticTexts[AccessibilityIdentifiers.Shopping.sheetHeaderTitle].label, .Shopping.SheetHeaderTitle)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I followed the same style as in the source code here.

label.text = .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