Dactyloidae iOS initial commit

This commit is contained in:
wuggy 2026-06-26 21:04:09 -07:00
commit 7154a0497e
2123 changed files with 197052 additions and 0 deletions

View file

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>10.6</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>
</plist>

View file

@ -0,0 +1,74 @@
/* 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 L10nBaseSnapshotTests: XCTestCase {
var skipIntro: Bool {
return true
}
override func setUp() {
super.setUp()
continueAfterFailure = false
let app = XCUIApplication()
setupSnapshot(app)
app.launchArguments = [LaunchArguments.Test, LaunchArguments.ClearProfile]
if skipIntro {
app.launchArguments.append(LaunchArguments.SkipIntro)
}
app.launch()
}
func waitforExistence(_ element: XCUIElement) {
let exists = NSPredicate(format: "exists == true")
expectation(for: exists, evaluatedWith: element, handler: nil)
waitForExpectations(timeout: 20, handler: nil)
}
func waitforNoExistence(_ element: XCUIElement) {
let exists = NSPredicate(format: "exists != true")
expectation(for: exists, evaluatedWith: element, handler: nil)
waitForExpectations(timeout: 20, handler: nil)
}
func loadWebPage(url: String, waitForOtherElementWithAriaLabel ariaLabel: String) {
let app = XCUIApplication()
UIPasteboard.general.string = url
app.textFields["url"].press(forDuration: 2.0)
app.sheets.element(boundBy: 0).buttons.element(boundBy: 0).tap()
sleep(3) // TODO Otherwise we detect the body in the currently loaded document, before the new page has loaded
let webView = app.webViews.element(boundBy: 0)
let element = webView.otherElements[ariaLabel]
expectation(for: NSPredicate(format: "exists == 1"), evaluatedWith: element, handler: nil)
waitForExpectations(timeout: 5.0) { (error) -> Void in
if error != nil {
XCTFail("Failed to detect element with ariaLabel=\(ariaLabel) on \(url): \(error)")
}
}
}
func loadWebPage(url: String, waitForLoadToFinish: Bool = true) {
let LoadingTimeout: TimeInterval = 60
let exists = NSPredicate(format: "exists = true")
let loaded = NSPredicate(format: "value BEGINSWITH '100'")
let app = XCUIApplication()
UIPasteboard.general.string = url
app.textFields["url"].press(forDuration: 2.0)
app.sheets.element(boundBy: 0).buttons.element(boundBy: 0).tap()
if waitForLoadToFinish {
let progressIndicator = app.progressIndicators.element(boundBy: 0)
expectation(for: exists, evaluatedWith: progressIndicator, handler: nil)
expectation(for: loaded, evaluatedWith: progressIndicator, handler: nil)
waitForExpectations(timeout: LoadingTimeout, handler: nil)
}
}
}

View file

@ -0,0 +1,28 @@
/* 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 L10nIntroSnapshotTests: L10nBaseSnapshotTests {
override var skipIntro: Bool {
return false
}
func testIntro() {
let app = XCUIApplication()
snapshot("Intro-1")
app.scrollViews["IntroViewController.scrollView"].swipeLeft()
sleep(2)
snapshot("Intro-2")
app.scrollViews["IntroViewController.scrollView"].swipeLeft()
sleep(2)
snapshot("Intro-3")
app.scrollViews["IntroViewController.scrollView"].swipeLeft()
sleep(2)
snapshot("Intro-4")
app.scrollViews["IntroViewController.scrollView"].swipeLeft()
sleep(2)
snapshot("01Intro-5")
}
}

View file

@ -0,0 +1,13 @@
/* 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 L10nPermissionStringsSnapshotTests: L10nBaseSnapshotTests {
func testNSLocationWhenInUseUsageDescription() {
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/geolocation.html", waitForOtherElementWithAriaLabel: "body")
snapshot("15LocationDialog-01")
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
}
}

View file

@ -0,0 +1,268 @@
/* 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 L10nSnapshotTests: L10nBaseSnapshotTests {
func test02DefaultTopSites() {
snapshot("02DefaultTopSites-01")
}
func test03MenuOnTopSites() {
let app = XCUIApplication()
app.buttons["TabToolbar.menuButton"].tap()
snapshot("03MenuOnTopSites-01")
app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.25)).tap()
loadWebPage(url: "about:blank", waitForLoadToFinish: false)
sleep(2)
app.buttons["TabToolbar.menuButton"].tap()
snapshot("10MenuOnWebPage-01")
app.otherElements["MenuViewController.menuView"].swipeLeft()
snapshot("10MenuOnWebPage-02")
app.coordinate(withNormalizedOffset: CGVector(dx: 0.5, dy: 0.25)).tap()
app.buttons["URLBarView.tabsButton"].tap()
app.buttons["TabTrayController.menuButton"].tap()
snapshot("10MenuOnTabsTray-02")
}
func test04Foo() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
snapshot("10MenuOnWebPage-01")
app.otherElements["MenuViewController.menuView"].swipeLeft()
snapshot("10MenuOnWebPage-02")
}
func test04Settings() {
let app = XCUIApplication()
app.buttons["TabToolbar.menuButton"].tap()
app.otherElements["MenuViewController.menuView"].swipeLeft()
app.cells["SettingsMenuItem"].tap()
snapshot("04SettingsTopLevel")
// TODO Scroll through the settings and make a screenshot of every page
// Screenshot all the settings that have a separate page
for cellName in ["Search", "NewTab", "Homepage", "Logins"] {
app.tables["AppSettingsTableViewController.tableView"].cells[cellName].tap()
snapshot("04Settings-\(cellName)")
app.navigationBars.element(boundBy: 0).buttons.element(boundBy: 0).tap()
}
// Unclear why this is needed - without it the test framework finds two TouchIDPasscode cells
app.tables["AppSettingsTableViewController.tableView"].swipeUp()
for cellName in ["TouchIDPasscode", "ClearPrivateData", "TrackingProtection"] {
app.tables["AppSettingsTableViewController.tableView"].cells[cellName].tap()
snapshot("04Settings-\(cellName)")
app.navigationBars.element(boundBy: 0).buttons.element(boundBy: 0).tap()
}
}
func test05PrivateBrowsingTabsEmptyState() {
let app = XCUIApplication()
app.buttons["URLBarView.tabsButton"].tap() // Open tabs tray
app.buttons["TabTrayController.maskButton"].tap() // Switch to private mode
snapshot("05PrivateBrowsingTabsEmptyState-01")
}
func test06PanelsEmptyState() {
let app = XCUIApplication()
app.textFields["url"].tap()
app.buttons["HomePanels.Bookmarks"].tap()
snapshot("06PanelsEmptyState-01")
app.buttons["HomePanels.History"].tap()
snapshot("06PanelsEmptyState-02")
app.cells["HistoryPanel.syncedDevicesCell"].tap()
snapshot("06PanelsEmptyState-03")
app.buttons["HomePanels.ReadingList"].tap()
snapshot("06PanelsEmptyState-04")
}
// From here on it is fine to load pages
func test07AddSearchProvider() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/addSearchProvider.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).buttons["focus"].tap()
snapshot("07AddSearchProvider-01", waitForLoadingIndicator: false)
app.buttons["BrowserViewController.customSearchEngineButton"].tap()
snapshot("07AddSearchProvider-02", waitForLoadingIndicator: false)
let alert = XCUIApplication().alerts.element(boundBy: 0)
expectation(for: NSPredicate(format: "exists == 1"), evaluatedWith: alert, handler: nil)
waitForExpectations(timeout: 3, handler: nil)
alert.buttons.element(boundBy: 0).tap()
}
func test08URLBar() {
let app = XCUIApplication()
app.textFields["url"].tap()
snapshot("08URLBar-01")
app.textFields["address"].typeText("moz")
snapshot("08URLBar-02")
}
func test09URLBarContextMenu() {
let app = XCUIApplication()
// Long press with nothing on the clipboard
app.textFields["url"].press(forDuration: 2.0)
snapshot("09LocationBarContextMenu-01")
app.sheets.element(boundBy: 0).buttons.element(boundBy: 0).tap()
sleep(2)
// Long press with a URL on the clipboard
UIPasteboard.general.string = "https://www.mozilla.com"
app.textFields["url"].press(forDuration: 2.0)
snapshot("09LocationBarContextMenu-02")
app.sheets.element(boundBy: 0).buttons.element(boundBy: 0).tap()
sleep(2)
}
func test10MenuOnWebPage() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
snapshot("10MenuOnWebPage-01")
app.otherElements["MenuViewController.menuView"].swipeLeft()
snapshot("10MenuOnWebPage-02")
}
func test11WebViewContextMenu() {
let app = XCUIApplication()
// Link
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/link.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).links["link"].press(forDuration: 2.0)
snapshot("11WebViewContextMenu-01")
app.sheets.element(boundBy: 0).buttons.element(boundBy: app.sheets.element(boundBy: 0).buttons.count-1).tap()
// Image
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/image.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).images["image"].press(forDuration: 2.0)
snapshot("11WebViewContextMenu-02")
app.sheets.element(boundBy: 0).buttons.element(boundBy: app.sheets.element(boundBy: 0).buttons.count-1).tap()
// Image inside Link
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/imageWithLink.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).links["link"].press(forDuration: 2.0)
snapshot("11WebViewContextMenu-03")
app.sheets.element(boundBy: 0).buttons.element(boundBy: app.sheets.element(boundBy: 0).buttons.count-1).tap()
}
func test12WebViewAuthenticationDialog() {
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/basicauth/index.html", waitForLoadToFinish: false)
let predicate = NSPredicate(format: "exists == 1")
let query = XCUIApplication().alerts.element(boundBy: 0)
expectation(for: predicate, evaluatedWith: query, handler: nil)
self.waitForExpectations(timeout: 3, handler: nil)
snapshot("12WebViewAuthenticationDialog-01", waitForLoadingIndicator: false)
}
func test13ReloadButtonContextMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.stopReloadButton"].press(forDuration: 2.0)
snapshot("13ContextMenuReloadButton-01", waitForLoadingIndicator: false)
app.sheets.element(boundBy: 0).buttons.element(boundBy: 0).tap()
app.buttons["TabToolbar.stopReloadButton"].press(forDuration: 2.0)
snapshot("13ContextMenuReloadButton-02", waitForLoadingIndicator: false)
}
func test14SetHompage() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
app.cells["SetHomePageMenuItem"].tap()
snapshot("14SetHomepage-01", waitForLoadingIndicator: false)
}
func test17PasswordSnackbar() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/password.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).buttons["submit"].tap()
snapshot("17PasswordSnackbar-01")
app.buttons["SaveLoginPrompt.saveLoginButton"].tap()
// The password is pre-filled with a random value so second this this will cause the update prompt
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/password.html", waitForOtherElementWithAriaLabel: "body")
app.webViews.element(boundBy: 0).buttons["submit"].tap()
snapshot("17PasswordSnackbar-02")
}
func test18TopSitesMenu() {
let app = XCUIApplication()
let topSites = app.cells["TopSitesCell"]
topSites.cells.matching(identifier: "TopSite").element(boundBy: 0).press(forDuration: 2.0)
snapshot("18TopSitesMenu-01")
}
func test19HistoryTableContextMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
app.toolbars.buttons["HistoryMenuToolbarItem"].tap()
app.tables["History List"].cells.element(boundBy: 2).press(forDuration: 2.0)
snapshot("19HistoryTableContextMenu-01")
}
func test20BookmarksTableContextMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
app.cells["AddBookmarkMenuItem"].tap()
waitforNoExistence(app.otherElements["MenuViewController.menuView"])
app.textFields["url"].tap()
app.buttons["HomePanels.Bookmarks"].tap()
app.tables["Bookmarks List"].cells.element(boundBy: 0).press(forDuration: 2.0)
snapshot("20BookmarksTableContextMenu-01")
}
func test21ReaderModeSettingsMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabLocationView.readerModeButton"].tap()
app.buttons["ReaderModeBarView.settingsButton"].tap()
snapshot("21ReaderModeSettingsMenu-01")
}
func test22ReadingListTableContextMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabLocationView.readerModeButton"].tap()
app.buttons["ReaderModeBarView.listStatusButton"].tap()
app.textFields["url"].tap()
app.buttons["HomePanels.ReadingList"].tap()
app.tables["ReadingTable"].cells.element(boundBy: 0).press(forDuration: 2.0)
snapshot("22ReadingListTableContextMenu-01")
}
func test23ReadingListTableRowMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabLocationView.readerModeButton"].tap()
app.buttons["ReaderModeBarView.listStatusButton"].tap()
app.textFields["url"].tap()
app.buttons["HomePanels.ReadingList"].tap()
app.tables["ReadingTable"].cells.element(boundBy: 0).swipeLeft()
snapshot("23ReadingListTableRowMenu-01")
app.tables["ReadingTable"].cells.element(boundBy: 0).buttons.element(boundBy: 1).tap()
app.tables["ReadingTable"].cells.element(boundBy: 0).swipeLeft()
snapshot("23ReadingListTableRowMenu-02")
}
func test24BookmarksListTableRowMenu() {
let app = XCUIApplication()
loadWebPage(url: "http://wopr.norad.org/~sarentz/fxios/testpages/index.html", waitForOtherElementWithAriaLabel: "body")
app.buttons["TabToolbar.menuButton"].tap()
app.cells["AddBookmarkMenuItem"].tap()
waitforNoExistence(app.otherElements["MenuViewController.menuView"])
app.textFields["url"].tap()
app.buttons["HomePanels.Bookmarks"].tap()
app.tables["Bookmarks List"].cells.element(boundBy: 0).swipeLeft()
snapshot("24BookmarksListTableRowMenu-01")
}
}