diff --git a/SyncIntegrationTests/test_history_desktop.js b/SyncIntegrationTests/test_history_desktop.js new file mode 100644 index 000000000000..0ced84b5bf99 --- /dev/null +++ b/SyncIntegrationTests/test_history_desktop.js @@ -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] +]); diff --git a/SyncIntegrationTests/test_integration.py b/SyncIntegrationTests/test_integration.py index 05368753d98d..7efb9e129a4c 100644 --- a/SyncIntegrationTests/test_integration.py +++ b/SyncIntegrationTests/test_integration.py @@ -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') diff --git a/SyncIntegrationTests/test_password_desktop.js b/SyncIntegrationTests/test_password_desktop.js new file mode 100644 index 000000000000..16eb4bcf3416 --- /dev/null +++ b/SyncIntegrationTests/test_password_desktop.js @@ -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] +]); \ No newline at end of file diff --git a/SyncIntegrationTests/test_tabs_desktop.js b/SyncIntegrationTests/test_tabs_desktop.js new file mode 100644 index 000000000000..ef55b66c358c --- /dev/null +++ b/SyncIntegrationTests/test_tabs_desktop.js @@ -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] +]); diff --git a/XCUITests/IntegrationTests.swift b/XCUITests/IntegrationTests.swift index f60d0c87a93c..12cd6ee12457 100644 --- a/XCUITests/IntegrationTests.swift +++ b/XCUITests/IntegrationTests.swift @@ -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 { @@ -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"]) } @@ -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") + } }