Skip to content

Commit

Permalink
Refactor MTE-1776 [v120] CopiedLinksTests and SettingsTests with Test…
Browse files Browse the repository at this point in the history
…Rail
  • Loading branch information
dragosb01 committed Oct 23, 2023
1 parent 6897520 commit a42186c
Show file tree
Hide file tree
Showing 10 changed files with 78 additions and 51 deletions.
12 changes: 4 additions & 8 deletions Client.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@
2C2A91291FA2410D002E36BD /* HistoryTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C2A91281FA2410D002E36BD /* HistoryTests.swift */; };
2C31A7A91E8BFB2200DAC646 /* ReadingListTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C31A7A81E8BFB2200DAC646 /* ReadingListTests.swift */; };
2C31A8471E8D447F00DAC646 /* HomePageSettingsUITest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C31A8461E8D447F00DAC646 /* HomePageSettingsUITest.swift */; };
2C3406C81E719F00000FD889 /* SettingsTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C3406C71E719F00000FD889 /* SettingsTest.swift */; };
2C3406C81E719F00000FD889 /* SettingsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C3406C71E719F00000FD889 /* SettingsTests.swift */; };
2C473BD0209778900008C853 /* DownloadsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C473BCF209778900008C853 /* DownloadsTests.swift */; };
2C49854E206173C800893DAE /* photon-colors.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C49854D206173C800893DAE /* photon-colors.swift */; };
2C4A07DC20246EAD0083E320 /* DragAndDropTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2C4A07DB20246EAD0083E320 /* DragAndDropTests.swift */; };
Expand Down Expand Up @@ -275,7 +275,6 @@
3BF4B8E91D38497A00493393 /* BaseTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BF4B8E81D38497A00493393 /* BaseTestCase.swift */; };
3BF56D271CDBBE1F00AC4D75 /* SimpleToast.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BF56D261CDBBE1F00AC4D75 /* SimpleToast.swift */; };
3BFE4B501D34673D00DDF53F /* ThirdPartySearchTest.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3BFE4B4F1D34673D00DDF53F /* ThirdPartySearchTest.swift */; };
3D71C89E1F5703A1008D8646 /* CopiedLinksTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D71C89D1F5703A1008D8646 /* CopiedLinksTests.swift */; };
3D9CA9841EF456A8002434DD /* NightModeTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CA9831EF456A8002434DD /* NightModeTests.swift */; };
3D9CA9A81EF84D04002434DD /* NoImageTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CA9A71EF84D04002434DD /* NoImageTests.swift */; };
3D9CAA1C1EFCD655002434DD /* ClipBoardTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3D9CAA1B1EFCD655002434DD /* ClipBoardTests.swift */; };
Expand Down Expand Up @@ -2315,7 +2314,7 @@
2C31A7A81E8BFB2200DAC646 /* ReadingListTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ReadingListTests.swift; sourceTree = "<group>"; };
2C31A8461E8D447F00DAC646 /* HomePageSettingsUITest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = HomePageSettingsUITest.swift; sourceTree = "<group>"; };
2C33410CB7E921A125379D7C /* de */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = de; path = de.lproj/Localizable.strings; sourceTree = "<group>"; };
2C3406C71E719F00000FD889 /* SettingsTest.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsTest.swift; sourceTree = "<group>"; };
2C3406C71E719F00000FD889 /* SettingsTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = SettingsTests.swift; sourceTree = "<group>"; };
2C473BCF209778900008C853 /* DownloadsTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DownloadsTests.swift; sourceTree = "<group>"; };
2C49854D206173C800893DAE /* photon-colors.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "photon-colors.swift"; sourceTree = "<group>"; };
2C4A07DB20246EAD0083E320 /* DragAndDropTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DragAndDropTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2534,7 +2533,6 @@
3D1B427CBBF9661428718235 /* ast */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ast; path = ast.lproj/AuthenticationManager.strings; sourceTree = "<group>"; };
3D254A72992C6FE06123E4F1 /* is */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = is; path = is.lproj/Search.strings; sourceTree = "<group>"; };
3D3A4AE2A54D99CE5F25E57E /* sat-Olck */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "sat-Olck"; path = "sat-Olck.lproj/ClearPrivateData.strings"; sourceTree = "<group>"; };
3D71C89D1F5703A1008D8646 /* CopiedLinksTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CopiedLinksTests.swift; sourceTree = "<group>"; };
3D744D81B8C64FA197FBFC3C /* or */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = or; path = or.lproj/ClearHistoryConfirm.strings; sourceTree = "<group>"; };
3D844CB6B34780D0E010713A /* ia */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = ia; path = "ia.lproj/Default Browser.strings"; sourceTree = "<group>"; };
3D9CA9831EF456A8002434DD /* NightModeTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = NightModeTests.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -7815,7 +7813,6 @@
0B305E1A1E3A98A900BE0767 /* BookmarksTests.swift */,
2CF9D9A920067FA10083DF2A /* BrowsingPDFTests.swift */,
3D9CAA1B1EFCD655002434DD /* ClipBoardTests.swift */,
3D71C89D1F5703A1008D8646 /* CopiedLinksTests.swift */,
EB3A38912032673D004C6E67 /* DatabaseFixtureTest.swift */,
2CC1B3EF1E9B861400814EEC /* DomainAutocompleteTest.swift */,
2C473BCF209778900008C853 /* DownloadsTests.swift */,
Expand All @@ -7842,7 +7839,7 @@
39012F271F8ED262002E3D31 /* ScreenGraphTest.swift */,
2CEA6F781E93E3A600D4100E /* SearchSettingsUITest.swift */,
2CA16FDD1E5F089100332277 /* SearchTest.swift */,
2C3406C71E719F00000FD889 /* SettingsTest.swift */,
2C3406C71E719F00000FD889 /* SettingsTests.swift */,
0BC9C9C31F26F54D000E8AB5 /* SiteLoadTest.swift */,
2CEDADA120207EC400223A89 /* SyncFAUITests.swift */,
3BFE4B4F1D34673D00DDF53F /* ThirdPartySearchTest.swift */,
Expand Down Expand Up @@ -12278,7 +12275,6 @@
2C4A07DC20246EAD0083E320 /* DragAndDropTests.swift in Sources */,
2C2A5EF41E68469500F02659 /* PrivateBrowsingTest.swift in Sources */,
D4C35391283500A600F7DC7D /* PerformanceTests.swift in Sources */,
3D71C89E1F5703A1008D8646 /* CopiedLinksTests.swift in Sources */,
2CF449A51E7BFE2C00FD7595 /* NavigationTest.swift in Sources */,
2C2A91291FA2410D002E36BD /* HistoryTests.swift in Sources */,
782B0A362AB41DFC0049EE1A /* FakespotTests.swift in Sources */,
Expand Down Expand Up @@ -12310,7 +12306,7 @@
2C8C07771E7800EA00DC1237 /* FindInPageTests.swift in Sources */,
2CB56E3F1E926BFB00AF7586 /* ToolbarTest.swift in Sources */,
B10997432A97251D00CC8860 /* UrlBarTests.swift in Sources */,
2C3406C81E719F00000FD889 /* SettingsTest.swift in Sources */,
2C3406C81E719F00000FD889 /* SettingsTests.swift in Sources */,
2CF21D0920A4A163000D08B7 /* PocketTests.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
3 changes: 1 addition & 2 deletions Tests/ExperimentIntegrationTests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
"BookmarksTests",
"BrowsingPDFTests",
"ClipBoardTests",
"CopiedLinksTests",
"DataManagementTests",
"DatabaseFixtureTest",
"DesktopModeTestsIpad",
Expand Down Expand Up @@ -59,7 +58,7 @@
"ScreenGraphTest",
"SearchSettingsUITests",
"SearchTests",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
3 changes: 1 addition & 2 deletions Tests/PerformanceTestPlan.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"BookmarksTests",
"BrowsingPDFTests",
"ClipBoardTests",
"CopiedLinksTests",
"DataManagementTests",
"DatabaseFixtureTest",
"DatabaseFixtureTest\/testPerfBookmarks1000openMenu()",
Expand Down Expand Up @@ -65,7 +64,7 @@
"ScreenGraphTest",
"SearchSettingsUITests",
"SearchTests",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
3 changes: 1 addition & 2 deletions Tests/SmokeXCUITests.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@
"BookmarksTests\/testRecentlyBookmarked()",
"BrowsingPDFTests",
"ClipBoardTests\/testClipboard()",
"CopiedLinksTests",
"CronTabsPerformanceTest",
"DataManagementTests\/testWebSiteDataOptions()",
"DatabaseFixtureTest",
Expand Down Expand Up @@ -161,7 +160,7 @@
"SearchTests\/testPromptPresence()",
"SearchTests\/testSearchIconOnAboutHome()",
"SearchTests\/testSearchWithFirefoxOption()",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"SyncUITests\/testCreateAnAccountLink()",
Expand Down
3 changes: 1 addition & 2 deletions Tests/Smoketest2.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
"BrowsingPDFTests\/testLongPressOnPDFLinkToAddToReadingList()",
"BrowsingPDFTests\/testOpenPDFViewer()",
"ClipBoardTests",
"CopiedLinksTests",
"CronTabsPerformanceTest",
"DataManagementTests",
"DatabaseFixtureTest",
Expand Down Expand Up @@ -78,7 +77,7 @@
"SearchTests\/testPromptPresence()",
"SearchTests\/testSearchIconOnAboutHome()",
"SearchTests\/testSearchWithFirefoxOption()",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
3 changes: 1 addition & 2 deletions Tests/Smoketest3.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"BookmarksTests",
"BrowsingPDFTests",
"ClipBoardTests",
"CopiedLinksTests",
"DataManagementTests",
"DatabaseFixtureTest",
"DesktopModeTestsIpad",
Expand Down Expand Up @@ -100,7 +99,7 @@
"ScreenGraphTest",
"SearchSettingsUITests",
"SearchTests",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
3 changes: 1 addition & 2 deletions Tests/Smoketest4.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
"BookmarksTests",
"BrowsingPDFTests",
"ClipBoardTests",
"CopiedLinksTests",
"DataManagementTests",
"DatabaseFixtureTest",
"DesktopModeTestsIpad",
Expand Down Expand Up @@ -104,7 +103,7 @@
"SearchTests\/testPromptPresence()",
"SearchTests\/testSearchIconOnAboutHome()",
"SearchTests\/testSearchWithFirefoxOption()",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
3 changes: 1 addition & 2 deletions Tests/SyncIntegrationTestPlan.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
"BookmarksTests",
"BrowsingPDFTests",
"ClipBoardTests",
"CopiedLinksTests",
"CronTabsPerformanceTest",
"DataManagementTests",
"DatabaseFixtureTest",
Expand Down Expand Up @@ -85,7 +84,7 @@
"ScreenGraphTest",
"SearchSettingsUITests",
"SearchTests",
"SettingsTest",
"SettingsTests",
"SiteLoadTest",
"SyncUITests",
"TabCounterTests",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,37 +2,12 @@
// 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 Foundation

class SettingsTest: BaseTestCase {
func testHelpOpensSUMOInTab() {
navigator.nowAt(NewTabScreen)
navigator.goto(SettingsScreen)
let settingsTableView = app.tables[AccessibilityIdentifiers.Settings.tableViewController]

while settingsTableView.staticTexts["Help"].exists == false {
settingsTableView.swipeUp()
}
let helpMenu = settingsTableView.cells["Help"]
XCTAssertTrue(helpMenu.isEnabled)
helpMenu.tap()

waitUntilPageLoad()
mozWaitForValueContains(app.textFields["url"], value: "support.mozilla.org")
mozWaitForElementToExist(app.webViews.staticTexts["Firefox for iOS Support"])

let numTabs = app.buttons["Show Tabs"].value
XCTAssertEqual("2", numTabs as? String, "Sume should be open in a different tab")
}

func testOpenSiriOption() {
waitForTabsButton()
navigator.nowAt(NewTabScreen)
navigator.performAction(Action.OpenSiriFromSettings)
mozWaitForElementToExist(app.cells["SiriSettings"], timeout: 5)
}
class DefaultBrowserTests: BaseTestCase {
// https://testrail.stage.mozaws.net/index.php?/cases/view/2306804
/* Disable test since the option to set Firefox is not available in this build after issue #8513 landed, issue #8627
func testDefaultBrowser() {
func testSetFirefoxDefaultBrowserFromHomeScreenBanner() {
// A default browser card should be available on the home screen
mozWaitForElementToExist(app.staticTexts["Set links from websites, emails, and Messages to open automatically in Firefox."], timeout: 5)
mozWaitForElementToExist(app.buttons["Learn More"], timeout: 5)
Expand Down
63 changes: 63 additions & 0 deletions Tests/XCUITests/SettingsTests.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
// 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

class SettingsTests: BaseTestCase {
// https://testrail.stage.mozaws.net/index.php?/cases/view/2334757
func testHelpOpensSUMOInTab() {
navigator.nowAt(NewTabScreen)
navigator.goto(SettingsScreen)
let settingsTableView = app.tables[AccessibilityIdentifiers.Settings.tableViewController]

while settingsTableView.staticTexts["Help"].exists == false {
settingsTableView.swipeUp()
}
let helpMenu = settingsTableView.cells["Help"]
XCTAssertTrue(helpMenu.isEnabled)
helpMenu.tap()

waitUntilPageLoad()
mozWaitForValueContains(app.textFields["url"], value: "support.mozilla.org")
mozWaitForElementToExist(app.webViews.staticTexts["Firefox for iOS Support"])

let numTabs = app.buttons["Show Tabs"].value
XCTAssertEqual("2", numTabs as? String, "Sume should be open in a different tab")
}

// https://testrail.stage.mozaws.net/index.php?/cases/view/2334760
func testOpenSiriOption() {
waitForTabsButton()
navigator.nowAt(NewTabScreen)
navigator.performAction(Action.OpenSiriFromSettings)
mozWaitForElementToExist(app.cells["SiriSettings"], timeout: 5)
}

// https://testrail.stage.mozaws.net/index.php?/cases/view/2334756
func testCopiedLinks() {
navigator.nowAt(NewTabScreen)
navigator.goto(SettingsScreen)

// Check Offer to open copied links, when opening firefox is off
let value = app.tables.cells.switches["Offer to Open Copied Links, When Opening Firefox"].value
XCTAssertEqual(value as? String, "0")

// Switch on, Offer to open copied links, when opening firefox
app.tables.cells.switches["Offer to Open Copied Links, When Opening Firefox"].tap()

// Check Offer to open copied links, when opening firefox is on
let value2 = app.tables.cells.switches["Offer to Open Copied Links, When Opening Firefox"].value
XCTAssertEqual(value2 as? String, "1")

app.navigationBars["Settings"].buttons["Done"].tap()

app.buttons[AccessibilityIdentifiers.Toolbar.settingsMenuButton].tap()
let settingsmenuitemCell = app.tables.otherElements["Settings"]
settingsmenuitemCell.tap()

// Check Offer to open copied links, when opening firefox is on
let value3 = app.tables.cells.switches["Offer to Open Copied Links, When Opening Firefox"].value
XCTAssertEqual(value3 as? String, "1")
}
}

0 comments on commit a42186c

Please sign in to comment.