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

For #5958 enable sync ui tests - iOS 13.4 update #6356

Merged
merged 3 commits into from
Apr 2, 2020
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
2 changes: 1 addition & 1 deletion XCUITests/ActivityStreamTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -172,8 +172,8 @@ class ActivityStreamTest: BaseTestCase {
waitForExistence(TopSiteCellgroup.cells["apple"])
TopSiteCellgroup.cells["apple"].press(forDuration: 1)
app.tables["Context Menu"].cells["Open in New Tab"].tap()
// The new tab is open but curren screen is still Homescreen
XCTAssert(TopSiteCellgroup.exists)
XCTAssertFalse(app.staticTexts["apple"].exists)

navigator.goto(TabTray)
app.collectionViews.cells["Home"].tap()
Expand Down
2 changes: 1 addition & 1 deletion XCUITests/ClipBoardTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class ClipBoardTests: BaseTestCase {
func copyUrl() {
navigator.goto(URLBarOpen)
waitForExistence(app.textFields["address"])
app.textFields["address"].press(forDuration: 3)
app.textFields["address"].tap()
waitForExistence(app.menuItems["Copy"])
app.menuItems["Copy"].tap()
app.typeText("\r")
Expand Down
4 changes: 2 additions & 2 deletions XCUITests/FindInPageTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ class FindInPageTests: BaseTestCase {
let stringToFind = app.webViews.staticTexts.matching(identifier: textToFind)
let firstStringToFind = stringToFind.element(boundBy: 0)
firstStringToFind.press(forDuration: 3)
waitForExistence(app.menuItems["Copy"])
waitForExistence(app.menuItems["Copy"], timeout: 5)
// Find in page is correctly launched, bar with text pre-filled and
// the buttons to find next and previous
if (app.menuItems["Find in Page"].exists) {
app.menuItems["Find in Page"].tap()
} else {
app.menus.children(matching: .menuItem).element(boundBy: 3).tap()
app.menuItems["show.next.items.menu.button"].tap()
waitForExistence(app.menuItems["Find in Page"])
app.menuItems["Find in Page"].tap()
}
Expand Down
4 changes: 2 additions & 2 deletions XCUITests/FxScreenGraph.swift
Original file line number Diff line number Diff line change
Expand Up @@ -694,8 +694,8 @@ func createScreenGraph(for test: XCTestCase, with app: XCUIApplication) -> MMScr

screenState.gesture(forAction: Action.FxATypeEmail) { userState in
if isTablet {
app.webViews.textFields.element(boundBy: 0).tap()
app.webViews.textFields.element(boundBy: 0).typeText(userState.fxaUsername!)
app.webViews.textFields.firstMatch.tap()
app.webViews.textFields.firstMatch.typeText(userState.fxaUsername!)
} else {
app.textFields.element(boundBy: 0).tap()
app.textFields.element(boundBy: 0).typeText(userState.fxaUsername!)
Expand Down
3 changes: 1 addition & 2 deletions XCUITests/HomePageSettingsUITest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,7 @@ class HomePageSettingsUITests: BaseTestCase {
enterWebPageAsHomepage(text: websiteUrl1)
waitForValueContains(app.textFields["HomeAsCustomURLTextField"], value: "mozilla")
navigator.goto(SettingsScreen)
//Assert that the label showing up in Settings is equal to the URL entere (NOT CURRENTLY WORKING, SHOWING HOMEPAGE INSTEAD OF URL)
XCTAssertEqual(app.tables.cells["Home"].label, "Home, Homepage")
XCTAssertEqual(app.tables.cells["Home"].label, "Home, Firefox Home")
//Switch to FXHome and check label
navigator.performAction(Action.SelectHomeAsFirefoxHomePage)
navigator.nowAt(HomeSettings)
Expand Down
25 changes: 11 additions & 14 deletions XCUITests/NavigationTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -91,23 +91,20 @@ class NavigationTest: BaseTestCase {
signInToFirefoxStaticText.tap()
checkFirefoxSyncScreenShownViaSettings()

// Disable check, page load issues on iOS13.3 sims, issue #5937
// After that it is possible to go back to Settings
// let settingsButton = app.navigationBars["Client.FxAContentView"].buttons["Settings"]
// settingsButton.tap()
let settingsButton = app.navigationBars["Client.FxAWebView"].buttons["Settings"]
settingsButton.tap()
}

// Beacuse the Settings menu does not stretch tot the top we need a different function to check if the Firefox Sync screen is shown
private func checkFirefoxSyncScreenShownViaSettings() {
// Disable check, page load issues on iOS13.3 sims, issue #5937
waitForExistence(app.webViews.firstMatch, timeout: 20)
// waitForExistence(app.navigationBars["Client.FxAContentView"], timeout: 50)
// waitForExistence(app.webViews.textFields.element(boundBy: 0), timeout:50)
// let email = app.webViews.textFields.element(boundBy: 0)
// // Verify the placeholdervalues here for the textFields
// let mailPlaceholder = "Email"
// let defaultMailPlaceholder = email.placeholderValue!
// XCTAssertEqual(mailPlaceholder, defaultMailPlaceholder, "The mail placeholder does not show the correct value")
waitForExistence(app.navigationBars["Client.FxAWebView"], timeout: 20)
waitForExistence(app.webViews.textFields.element(boundBy: 0), timeout:20)
let email = app.webViews.textFields.element(boundBy: 0)
// Verify the placeholdervalues here for the textFields
let mailPlaceholder = "Email"
let defaultMailPlaceholder = email.placeholderValue!
XCTAssertEqual(mailPlaceholder, defaultMailPlaceholder, "The mail placeholder does not show the correct value")
}

func testTapSignInShowsFxAFromRemoteTabPanel() {
Expand All @@ -117,8 +114,8 @@ class NavigationTest: BaseTestCase {
app.tables.buttons["Sign in to Sync"].tap()
checkFirefoxSyncScreenShown()

// Disable check, page load issues on iOS13.3 sims, issue #5937 app.navigationBars["Client.FxAContentView"].buttons["Close"].tap()
// navigator.nowAt(LibraryPanel_SyncedTabs)
app.navigationBars["Client.FxAWebView"].buttons["Close"].tap()
navigator.nowAt(LibraryPanel_SyncedTabs)
}

private func checkFirefoxSyncScreenShown() {
Expand Down
2 changes: 1 addition & 1 deletion XCUITests/NewTabSettings.swift
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class NewTabSettingsTest: BaseTestCase {
waitForValueContains(app.textFields["NewTabAsCustomURLTextField"], value: "mozilla")
navigator.goto(SettingsScreen)
//Assert that the label showing up in Settings is equal to the URL entere (NOT CURRENTLY WORKING, SHOWING HOMEPAGE INSTEAD)
XCTAssertEqual(app.tables.cells["NewTab"].label, "New Tab, Homepage")
XCTAssertEqual(app.tables.cells["NewTab"].label, "New Tab, Firefox Home")
//Switch to Blank page and check label
navigator.performAction(Action.SelectNewTabAsBlankPage)
navigator.nowAt(NewTabSettings)
Expand Down
3 changes: 3 additions & 0 deletions XCUITests/PhotonActionSheetTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ class PhotonActionSheetTest: BaseTestCase {
// Disable issue #5554

func testShareOptionIsShown() {
navigator.goto(BrowserTab)
navigator.browserPerformAction(.shareOption)

// Wait to see the Share options sheet
Expand Down Expand Up @@ -86,6 +87,8 @@ class PhotonActionSheetTest: BaseTestCase {
navigator.goto(PageOptionsMenu)
app.tables["Context Menu"].staticTexts["Share Page With…"].tap()
waitForExistence(app.cells["Copy"], timeout: 5)
// This is not ideal but only way to get the element on iPhone 8
// for iPhone 11, that would be boundBy: 2
let fennecElement = app.collectionViews.scrollViews.cells.element(boundBy: 1)

fennecElement.tap()
Expand Down
4 changes: 2 additions & 2 deletions XCUITests/SearchTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -192,8 +192,8 @@ class SearchTests: BaseTestCase {
// Select some text and long press to find the option
app.webViews.staticTexts["cloud"].press(forDuration: 1)
if !iPad() {
waitForExistence(app.menus.children(matching: .menuItem).element(boundBy: 3))
app.menus.children(matching: .menuItem).element(boundBy: 3).tap()
waitForExistence(app.menuItems["show.next.items.menu.button"], timeout: 5)
app.menuItems["show.next.items.menu.button"].tap()
}
waitForExistence(app.menuItems["Search with Firefox"])
app.menuItems["Search with Firefox"].tap()
Expand Down
58 changes: 23 additions & 35 deletions XCUITests/SyncFAUITests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,37 +27,30 @@ class SyncUITests: BaseTestCase {
navigator.goto(FxASigninScreen)
verifyFxASigninScreen()

// Disabling, xcode 11.3 update Issue 5937
/*
// Check menu available from a website
navigator.openURL("mozilla.org")
waitUntilPageLoad()
navigator.goto(BrowserTabMenu)
waitForExistence(app.tables["Context Menu"].cells["menu-sync"])
navigator.goto(FxASigninScreen)
verifyFxASigninScreen()*/
verifyFxASigninScreen()
}

private func verifyFxASigninScreen() {
// Disable check, page load issues on iOS13.3 sims, issue #5937
waitForExistence(app.webViews.firstMatch, timeout: 20)
// Workaround BB iOS13
// waitForExistence(app.navigationBars["Client.FxAContentView"], timeout: 60)
// waitForExistence(app.webViews.textFields["Email"], timeout: 60)
// XCTAssertTrue(app.navigationBars["Client.FxAContentView"].exists)
// XCTAssertTrue(app.webViews.textFields["Email"].exists)
//
// // Verify the placeholdervalues here for the textFields
// let mailPlaceholder = "Email"
// let defaultMailPlaceholder = app.webViews.textFields["Email"].placeholderValue!
// XCTAssertEqual(mailPlaceholder, defaultMailPlaceholder, "The mail placeholder does not show the correct value")
// XCTAssertTrue(app.webViews.buttons["Continue"].exists)
waitForExistence(app.navigationBars["Client.FxAWebView"], timeout: 30)
waitForExistence(app.webViews.textFields["Email"], timeout: 10)
XCTAssertTrue(app.webViews.textFields["Email"].exists)

// Verify the placeholdervalues here for the textFields
let mailPlaceholder = "Email"
let defaultMailPlaceholder = app.webViews.textFields["Email"].placeholderValue!
XCTAssertEqual(mailPlaceholder, defaultMailPlaceholder, "The mail placeholder does not show the correct value")
XCTAssertTrue(app.webViews.buttons["Continue"].exists)
}
// Disabling, xcode 11.3 update Issue 5937
/*

func testTypeOnGivenFields() {
navigator.goto(FxASigninScreen)
waitForExistence(app.navigationBars["Client.FxAContentView"], timeout: 60)
waitForExistence(app.navigationBars["Client.FxAWebView"], timeout: 60)

// Tap Sign in without any value in email Password focus on Email
navigator.performAction(Action.FxATapOnContinueButton)
Expand All @@ -69,7 +62,7 @@ class SyncUITests: BaseTestCase {
navigator.performAction(Action.FxATapOnContinueButton)
waitForExistence(app.webViews.staticTexts["Valid email required"])

userState.fxaUsername = "valid@gmail.com"
userState.fxaUsername = "foo1bar2@gmail.com"
navigator.performAction(Action.FxATypeEmail)
navigator.performAction(Action.FxATapOnSignInButton)

Expand All @@ -83,39 +76,34 @@ class SyncUITests: BaseTestCase {
userState.fxaPassword = "atleasteight"
navigator.performAction(Action.FxATypePassword)
waitForExistence(app.secureTextFields["Repeat password"], timeout: 10)
}*/
}

func testCreateAnAccountLink() {
navigator.goto(FxASigninScreen)
// Disable check, page load issues on iOS13.3 sims, issue #5937
waitForExistence(app.webViews.firstMatch, timeout: 20)
// waitForExistence(app.navigationBars["Client.FxAContentView"], timeout: 60)
// waitForExistence(app.webViews.textFields["Email"], timeout: 40)
// userState.fxaUsername = "[email protected]"
// navigator.performAction(Action.FxATypeEmail)
// navigator.performAction(Action.FxATapOnContinueButton)
// waitForExistence(app.webViews.buttons["Create account"])
waitForExistence(app.webViews.textFields["Email"], timeout: 40)
userState.fxaUsername = "[email protected]"
navigator.performAction(Action.FxATypeEmail)
navigator.performAction(Action.FxATapOnContinueButton)
waitForExistence(app.webViews.buttons["Create account"])
}
// Disabling, xcode 11.3 update Issue 5937
/*

func testShowPassword() {
// The aim of this test is to check if the option to show password is shown when user starts typing and dissapears when no password is typed
navigator.goto(FxASigninScreen)
// Workaround BB iOS13
waitForExistence(app.navigationBars["Client.FxAContentView"], timeout: 60)
waitForExistence(app.webViews.textFields["Email"], timeout: 50)
waitForExistence(app.webViews.textFields["Email"], timeout: 20)
// Typing on Email should not show Show (password) option
userState.fxaUsername = "[email protected]"
navigator.performAction(Action.FxATypeEmail)
navigator.performAction(Action.FxATapOnContinueButton)
// Typing on Password should show Show (password) option
userState.fxaPassword = "f"
navigator.performAction(Action.FxATypePassword)
waitForExistence(app.webViews.staticTexts["Show password"])
waitForExistence(app.webViews.otherElements["Show password"], timeout: 3)
// Remove the password typed, Show (password) option should not be shown
app.secureTextFields.element(boundBy: 0).typeText(XCUIKeyboardKey.delete.rawValue)
waitForNoExistence(app.webViews.staticTexts["Show password"])
}*/
}

// Smoketest
/*Disabled due to the new 6 digits authen code to verify account
Expand Down
26 changes: 13 additions & 13 deletions XCUITests/TopTabsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -308,30 +308,30 @@ class TopTabsTestIphone: IphoneOnlyTestCase {
func testSwitchBetweenTabsToastButton() {
if skipPlatform { return }

navigator.openURL(toastUrl["url"]!)
navigator.openURL(urlExample)
waitUntilPageLoad()

app.webViews.links.staticTexts[toastUrl["link"]!].press(forDuration: 1)
app.webViews.links.firstMatch.press(forDuration: 1)
waitForExistence(app.buttons["Open in New Tab"])
app.buttons["Open in New Tab"].press(forDuration: 1)
waitForExistence(app.buttons["Switch"])
app.buttons["Switch"].tap()

// Check that the tab has changed
waitUntilPageLoad()
waitForValueContains(app.textFields["url"], value: toastUrl["urlLabel"]!)
XCTAssertTrue(app.staticTexts[toastUrl["link"]!].exists)
waitForValueContains(app.textFields["url"], value: "iana")
XCTAssertTrue(app.links["RFC 2606"].exists)
waitForExistence(app.buttons["Show Tabs"])
let numTab = app.buttons["Show Tabs"].value as? String
XCTAssertEqual("2", numTab)


// Go to Private mode and do the same
navigator.toggleOn(userState.isPrivate, withAction: Action.TogglePrivateMode)
navigator.openURL(toastUrl["url"]!)
navigator.openURL(urlExample)
waitUntilPageLoad()
waitForExistence(app.webViews.links[toastUrl["link"]!])
app.webViews.links[toastUrl["link"]!].press(forDuration: 1)
waitForExistence(app.webViews.links.firstMatch)
app.webViews.links.firstMatch.press(forDuration: 1)
waitForExistence(app.buttons["Open in New Private Tab"])
app.buttons["Open in New Private Tab"].press(forDuration: 1)
waitForExistence(app.buttons["Switch"])
Expand All @@ -340,8 +340,8 @@ class TopTabsTestIphone: IphoneOnlyTestCase {
// Check that the tab has changed
waitUntilPageLoad()
waitForExistence(app.textFields["url"], timeout: 5)
waitForValueContains(app.textFields["url"], value: toastUrl["urlLabel"]!)
XCTAssertTrue(app.staticTexts[toastUrl["link"]!].exists)
waitForValueContains(app.textFields["url"], value: "iana")
XCTAssertTrue(app.links["RFC 2606"].exists)
waitForExistence(app.buttons["Show Tabs"])
let numPrivTab = app.buttons["Show Tabs"].value as? String
XCTAssertEqual("2", numPrivTab)
Expand All @@ -352,10 +352,10 @@ class TopTabsTestIphone: IphoneOnlyTestCase {
func testSwitchBetweenTabsNoPrivatePrivateToastButton() {
if skipPlatform { return }

navigator.openURL(toastUrl["url"]!)
navigator.openURL(urlExample)
waitUntilPageLoad()

app.webViews.links[toastUrl["link"]!].press(forDuration: 1)
app.webViews.links.firstMatch.press(forDuration: 1)
waitForExistence(app.buttons["Open in New Tab"], timeout: 3)
app.buttons["Open in New Private Tab"].press(forDuration: 1)
waitForExistence(app.buttons["Switch"], timeout: 5)
Expand All @@ -364,8 +364,8 @@ class TopTabsTestIphone: IphoneOnlyTestCase {
// Check that the tab has changed to the new open one and that the user is in private mode
waitUntilPageLoad()
waitForExistence(app.textFields["url"], timeout: 5)
waitForValueContains(app.textFields["url"], value: toastUrl["urlLabel"]!)
XCTAssertTrue(app.staticTexts[toastUrl["link"]!].exists)
waitForValueContains(app.textFields["url"], value: "iana")
XCTAssertTrue(app.links["RFC 2606"].exists)
navigator.goto(TabTray)
XCTAssertTrue(app.buttons["TabTrayController.maskButton"].isEnabled)
}
Expand Down
6 changes: 3 additions & 3 deletions XCUITests/TranslationSnackBarTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import XCTest

class TranslationSnackBarTest: BaseTestCase {
/*

// This test checks to the correct functionalty of the Translation prompt and Translation is done corrrectly using Google
func testSnackBarDisplayed() {
userState.localeIsExpectedDifferent = true
Expand All @@ -19,7 +19,7 @@ class TranslationSnackBarTest: BaseTestCase {
navigator.performAction(Action.SelectTranslateThisPage)
waitForValueContains(app.textFields["url"], value: "translate.google")
}

// This test checks to see if Translation is enabled by default from the Settings menu and can be correctly disabled
func testTranslationDisabled() {
navigator.goto(TranslationSettings)
Expand All @@ -40,5 +40,5 @@ class TranslationSnackBarTest: BaseTestCase {
waitUntilPageLoad()
navigator.performAction(Action.SelectTranslateThisPage)
waitForValueContains(app.textFields["url"], value: "translatetheweb")
}*/
}
}