Skip to content

Commit

Permalink
Bug 1505735 - XCUITests Sync Integration Desktop-iOS History Tabs Log…
Browse files Browse the repository at this point in the history
…ins (#4362)
  • Loading branch information
isabelrios committed Nov 15, 2018
1 parent 898fa2b commit ad3e46c
Show file tree
Hide file tree
Showing 5 changed files with 153 additions and 1 deletion.
33 changes: 33 additions & 0 deletions 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]
]);
12 changes: 12 additions & 0 deletions SyncIntegrationTests/test_integration.py
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
@@ -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
@@ -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
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")
}
}

0 comments on commit ad3e46c

Please sign in to comment.