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

Bug 1505735 - XCUITests Sync Integration Desktop-iOS History Tabs Logins #4362

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
33 changes: 33 additions & 0 deletions SyncIntegrationTests/test_history_desktop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/*
* The list of phases mapped to their corresponding profiles. The object
* here must be in strict JSON format, as it will get parsed by the Python
* testrunner (no single quotes, extra comma's, etc).
*/
EnableEngines(["history"]);

var phases = { "phase1": "profile1" };


// expected history state
var historyCreated = [
{ uri: "http://www.example.com/",
visits: [
{ type: 1 ,
date: 0
},
{ type: 2,
date: -1
}
]
}
];

// sync and verify history
Phase("phase1", [
[Sync],
[History.add, historyCreated],
[Sync]
]);
12 changes: 12 additions & 0 deletions SyncIntegrationTests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,15 @@ def test_sync_logins_from_device(tps, xcodebuild):
def test_sync_bookmark_from_desktop(tps, xcodebuild):
tps.run('test_bookmark_desktop.js')
xcodebuild.test('XCUITests/IntegrationTests/testFxASyncBookmarkDesktop')

def test_sync_history_from_desktop(tps, xcodebuild):
tps.run('test_history_desktop.js')
xcodebuild.test('XCUITests/IntegrationTests/testFxASyncHistoryDesktop')

def test_sync_logins_from_desktop(tps, xcodebuild):
tps.run('test_password_desktop.js')
xcodebuild.test('XCUITests/IntegrationTests/testFxASyncPasswordDesktop')

def test_tabs_tabs_from_desktop(tps, xcodebuild):
tps.run('test_tabs_desktop.js')
xcodebuild.test('XCUITests/IntegrationTests/testFxASyncTabsDesktop')
30 changes: 30 additions & 0 deletions SyncIntegrationTests/test_password_desktop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/*
* The list of phases mapped to their corresponding profiles. The object
* here must be in strict JSON format, as it will get parsed by the Python
* testrunner (no single quotes, extra comma's, etc).
*/
EnableEngines(["passwords"]);

var phases = { "phase1": "profile1" };


// expected tabs state
var password_list = [{
hostname: "https://accounts.google.com",
submitURL: "https://accounts.google.com/signin/challenge/sl/password",
realm: null,
username: "iosmztest",
password: "test15mz",
usernameField: "Email",
passwordField: "Passwd",
}];

// sync and verify tabs
Phase("phase1", [
[Sync],
[Passwords.add, password_list],
[Sync]
]);
25 changes: 25 additions & 0 deletions SyncIntegrationTests/test_tabs_desktop.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/* Any copyright is dedicated to the Public Domain.
http://creativecommons.org/publicdomain/zero/1.0/ */

/*
* The list of phases mapped to their corresponding profiles. The object
* here must be in strict JSON format, as it will get parsed by the Python
* testrunner (no single quotes, extra comma's, etc).
*/
EnableEngines(["tabs"]);

var phases = { "phase1": "profile1" };


var tabs1 = [
{ uri: "http://example.com/",
profile: "Fennec on iOS"
}
];

// sync and verify tabs
Phase("phase1", [
[Sync],
[Tabs.add, tabs1],
[Sync]
]);
54 changes: 53 additions & 1 deletion XCUITests/IntegrationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import XCTest
private let testingURL = "example.com"
private let userName = "iosmztest"
private let userPassword = "test15mz"
private let historyItemSavedOnDesktop = "http://www.example.com/"
private let loginEntry = "iosmztest, https://accounts.google.com"
private let tabOpenInDesktop = "http://example.com/"

class IntegrationTests: BaseTestCase {

Expand Down Expand Up @@ -80,7 +83,7 @@ class IntegrationTests: BaseTestCase {
waitForInitialSyncComplete()
navigator.goto(HomePanelsScreen)
waitForTabsButton()
navigator.goto(BrowserTabMenu)
navigator.nowAt(HomePanelsScreen)
navigator.goto(HomePanel_Bookmarks)
waitForExistence(app.tables["Bookmarks List"].cells.element(boundBy: 1).staticTexts["Example Domain"])
}
Expand Down Expand Up @@ -129,4 +132,53 @@ class IntegrationTests: BaseTestCase {
// Wait for initial sync to complete
waitForInitialSyncComplete()
}

func testFxASyncHistoryDesktop () {
// Sign into Firefox Accounts
signInFxAccounts()

// Wait for initial sync to complete
waitForInitialSyncComplete()

// Check synced History
navigator.goto(HomePanelsScreen)
waitForTabsButton()
navigator.nowAt(HomePanelsScreen)
navigator.goto(HomePanel_History)
waitForExistence(app.tables.cells.staticTexts[historyItemSavedOnDesktop], timeout: 5)
}

func testFxASyncPasswordDesktop () {
// Sign into Firefox Accounts
signInFxAccounts()

// Wait for initial sync to complete
waitForInitialSyncComplete()

// Check synced Logins
navigator.nowAt(SettingsScreen)
navigator.goto(LoginsSettings)
waitForExistence(app.tables["Login List"], timeout: 5)
XCTAssertTrue(app.tables.cells[loginEntry].exists, "The login saved on desktop is not synced")
}

func testFxASyncTabsDesktop () {
// Sign into Firefox Accounts
signInFxAccounts()

// Wait for initial sync to complete
waitForInitialSyncComplete()

// Check synced Tabs
navigator.goto(HomePanelsScreen)
waitForTabsButton()
navigator.nowAt(HomePanelsScreen)
navigator.goto(HomePanel_History)
waitForExistence(app.cells["HistoryPanel.syncedDevicesCell"], timeout: 5)
app.cells["HistoryPanel.syncedDevicesCell"].tap()
// Need to swipe to get the data on the screen on focus
app.swipeDown()
waitForExistence(app.tables.otherElements["profile1"], timeout: 5)
XCTAssertTrue(app.tables.staticTexts[tabOpenInDesktop].exists, "The tab is not synced")
}
}