-
Notifications
You must be signed in to change notification settings - Fork 11
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
UI Tests: Permissions #2625
Merged
Merged
UI Tests: Permissions #2625
Changes from all commits
Commits
Show all changes
158 commits
Select commit
Hold shift + click to select a range
fdf89c3
Add accessibiity identifiers for Find in Page controller elements
Halle f4270bc
Add accessibilityIdentifier to NSMenuItemExtension.swift
Halle 55e0e42
Set accessibilityIdentifier for address bar text field
Halle 1141095
Add accessibilityIdentifier for Find in Page menu item
Halle 1b74f49
Add FindInPageTests.swift to project
Halle 8566be2
Add more accessibility identifiers to menu items and fix one incorrec…
Halle c7163ea
Add accessibilityIdentifier to more options find in page
Halle 6c98b35
Change in-use accessibilityIdentifier for optionsButton so it isn't a…
Halle d1e2190
Find in page tests
Halle 1d36c57
Fix accessibilityIdentifiers for find in page text fields, add roles …
Halle 5d7ff4f
Test for number of search hits in page, single window enforecement, a…
Halle 067ea21
Only deal with the HTML once in the test case run
Halle 4e56b98
Merge branch 'main' into halle/find-in-page-tests
Halle d5b4bf3
Add waitForNonExistence XCUIElement extension to UI Tests Common
Halle 2b71d4e
Add NSImage cropping to NSImageExtensions.swift
Halle 0599135
Add extensions to UI Tests target
Halle 5e38ef9
Clean up tests and language
Halle 956a6be
Adds test to detect selected find result highlight color
Halle 21b1d23
Merge branch 'main' into halle/find-in-page-tests
Halle cf26a1a
Add two more accessibility identifiers to menus
Halle bca6b11
Tests of find next, generalize screenshot color checking
Halle d25a6fb
Test cleanup
Halle 0554d06
Formatting cleanup
Halle 3ca9266
Test cleanup
Halle d706994
Merge branch 'main' into halle/find-in-page-tests
Halle 95c0651
Fix line spaces
Halle e1ba012
Add tests
Halle b971c9c
Skip failing test with some info about required fixes
Halle 42ed55e
Bring late fix from Find in Page
Halle 27e01c4
Bring over fix of pixel matching from find in page branch
Halle 3a7dded
Improvements to find in page tests from parallel branch
Halle 4cb3242
Fixes for tests-server on independent scheme
Halle a494a7b
Add accessibility identifiers for recently visited sites
Halle ba5a011
Test of whether visited site is added to recently visited
Halle 91d7981
Merge branch 'main' into halle/browsing-history-tests
Halle c4fc7f4
Set clear history accessibility identifier
Halle f705a9d
Set clear all history alert buttons accessibility identifiers
Halle fd121f4
WIP commit showing fatal error
Halle aee805b
WIP fatal error more cleanup
Halle b42661d
Fix for validateMenuItem error during burning
Halle f746aeb
All passing tests
Halle 5f54cd6
Merge branch 'main' into halle/browsing-history-tests
Halle 906ff8d
Clean up accessibility identifier assignment
Halle 5311891
Merge branch 'main' into halle/browsing-history-tests
Halle 59abc79
Fix bad pbxproj merge
Halle f7ce14f
Remove warnings from tab bar tests
Halle a9a41cb
Restore test dependencies to pbxproj bad merge fix file
Halle 91b155d
Improvement to accessibility identifier for window and tab restoration
Halle 4abac8b
Simplify and clarify tests
Halle 508cebb
Linter warning fixes
Halle 0aa615b
Add test case
Halle 00340e3
Fix tabs in FindInPageTests
Halle e9f324c
Elements and access levels
Halle ffd104f
Sync previous test cases already in PR
Halle c519aeb
More of this file's tabs and spaces linter warning saga
Halle f7a80a6
Formatting fix
Halle 8e95661
Update sync tests with new accessibility identifiers
Halle e504083
Add accessibility identifier for adding bookmarks
Halle 961cbf2
Add accessibility identifiers for resetting data menu items
Halle 807bf6c
Add accessibility identifier to suggestions tableView
Halle e316533
Passing autocomplete tests
Halle 0197f65
Standardize test style across all three test cases
Halle 36d2b89
Standardize test style across test cases
Halle 1384f36
Add BookmarksBarTests
Halle 91c6fb2
Adding accessibility identifiers
Halle adde31e
First working test
Halle 5bb2b44
All tests, one failing
Halle 14c8448
Add URL extension for UI tests
Halle 25dd363
Add extension to project
Halle 0a35341
Use extension for all simple locally-served pages
Halle 7ea6aa5
Bring over find in page test name fixes
Halle 6a57cb1
Fix test names
Halle a067841
Merge branch 'main' into halle/browsing-history-tests
Halle 675dc51
Merge branch 'main' into halle/browsing-history-tests
Halle 6ea92d8
Add files back into project to avoid pbxproj merge badness
Halle 0784ee7
More clarity in makeMenuItems
Halle cd56bcb
Added UITEST_MODE env var
Halle 6a8580a
Merge branch 'main' into halle/browsing-history-tests
Halle 5e9ac28
Don't change menu items more than needed
Halle 4b71bc8
Remove added linebreaks
Halle 8f007b8
Don't use utf8String in TestsURLExtension
Halle 9e1da48
Merge branch 'main' into halle/browsing-history-tests
Halle 5393069
Remove unused DataExtension.swift from target
Halle d290ca0
Merge branch 'main' into halle/browsing-history-tests
Halle d95c05e
Remove unnecessary import
Halle 49e9fa4
Merge branch 'main' into halle/bookmarks-bar-tests
Halle 56ef7c8
Merge branch 'main' into halle/browsing-history-tests
Halle 62ffa72
Merge branch 'halle/browsing-history-tests' into halle/bookmarks-bar-…
Halle 521a0f7
Re-add bookmark bar tests after safety-first pbxproj merge
Halle 0d5ef85
Add accessibility ID for other button on bookmark dialog
Halle 4133f39
Test improvements
Halle b196c11
Merge branch 'main' into halle/bookmarks-bar-tests
Halle ce1f842
Commit fixes for test scheme building review
Halle a09ef6b
Update tests to current style
Halle eae14a7
Add tests back in after safety-first merge
Halle 80a3050
Make pixel matching more forgiving
Halle f8555d1
Merge branch 'main' into halle/bookmarks-bar-tests
Halle 559967b
Make setup easier to follow, arrange act assert spacing
Halle 957b281
SwiftFormat
Halle 5fbabe1
Keeps reappearing
Halle af2e3d0
Better naming
Halle 5df0aa9
Remove extraneous unwraps
Halle 9bec32d
Standardize title string creation
Halle 8ad4d66
Add tests
Halle 5a7e8cd
Remove extraneous imports
Halle eb10b9f
Add accessibility IDs and values
Halle a7834fe
Add accessibiity IDs
Halle 15b29fe
First three pasing tests
Halle b973769
New accessibility function on menu items
Halle dd47d32
Accessibility IDs and values
Halle dd6e0f6
Favorites tests
Halle c3da7ba
Merge branch 'main' into halle/bookmarks-and-favorites-tests
Halle d4cedbe
Set accessibility IDs
Halle 7b6f14c
Merge branch 'main' into halle/bookmarks-and-favorites-tests
Halle 5179582
Re-add test case after safety-first merge
Halle 831d2f9
Add accessibility IDs and values
Halle 5ac85d6
Remove unused id
Halle f37c372
Abstract click and hover after existence is proven
Halle 430cf0d
Increase timeout
Halle 3496bc8
Add IDs
Halle e78f060
Finalize tests
Halle f93bdb0
Merge branch 'main' into halle/bookmarks-and-favorites-tests
Halle aba9a99
Whitespace warnings
Halle faebda4
Move function to extension
Halle 5023958
Add IDs
Halle 2d97b50
Add state restoration tests
Halle d1595c3
Merge branch 'main' into halle/state-restoration-tests
Halle ee28e92
Re-add new tests after safety-first merge
Halle 87bac86
Test which tests edge cases of restore
Halle 7f0ce51
Add app termination for clarity, since we terminate and relaunch.
Halle dc66630
Merge branch 'main' into halle/state-restoration-tests
Halle 931039b
Add new test case
Halle 74df1a6
Add accessibility IDs
Halle cdf15af
Add a debug method and a pre-test-case method to UITests
Halle a496b34
First four tests
Halle 4277590
All tests
Halle 3e200db
Merge branch 'main' into halle/address-bar-keyboard-shortcuts
Halle 75733d3
Re-add tests after safety-first merge
Halle cdc0243
Autocomplete tests need autocomplete on
Halle 7792d8b
Add cleanup script and set defaults to not ask for app move
Halle 73d87cc
Merge branch 'main' into halle/permissions-tests
Halle 02385bf
Add accessibility IDs and values
Halle 5668775
Convenience function for address bar existence and typing
Halle b2eefcb
Convenience function for address bar existence and typing
Halle 3dbb405
Two convenience functions in UITests
Halle 6170cce
Add permissions tests
Halle 33c6a90
Merge branch 'main' into halle/permissions-tests
Halle c561136
Add first run class method to every test case
Halle 5357f67
Make button label matching function variadic and improve color test a…
Halle 03fc2e0
Working first test
Halle c17f10a
Standardize XCTUnwrap behavior across test helpers
Halle a46d036
Add camera deny test
Halle 3829c15
Set accessibility IDs for permission button types
Halle f4576cd
Mic and camera permissions tests all work
Halle 66584f9
Add location tests
Halle fe8696c
Update tests to include website bug information for location permissions
Halle 445c00f
Remove unused value
Halle 9c5ee24
More standardization of style
Halle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -88,4 +88,17 @@ enum UITests { | |
openVanillaBrowser.clickAfterExistenceTestSucceeds() | ||
app.typeKey("w", modifierFlags: [.command, .option]) | ||
} | ||
|
||
/// Avoid some first-run states that we aren't testing. | ||
static func firstRun() { | ||
let notificationCenter = XCUIApplication(bundleIdentifier: "com.apple.UserNotificationCenter") | ||
if notificationCenter.exists { // If tests-server is asking for network permissions, deny them. | ||
notificationCenter.typeKey(.escape, modifierFlags: []) | ||
} | ||
let app = XCUIApplication() | ||
app.launch() | ||
app.typeKey("n", modifierFlags: .command) | ||
app.typeKey("w", modifierFlags: [.command, .option]) | ||
app.terminate() | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Remove fresh-install first-run startup nuisances for all test cases. |
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -63,6 +63,20 @@ extension XCUIElement { | |
} | ||
} | ||
|
||
/// Check for the existence of the address bar and type a URL into it if it passes. Although it doesn't really make sense to restrict its usage to | ||
/// the address bar, it is only foreseen and recommended for use with the address bar. | ||
/// - Parameters: | ||
/// - url: The URL to be typed into the address bar (or other element, for which use with this function should be seen as experimental) | ||
/// - pressingEnter: If the `enter` key should not be pressed after typing this URL in, set this optional parameter to `false`, otherwise it | ||
/// will be pressed. | ||
func typeURLAfterExistenceTestSucceeds(_ url: URL, pressingEnter: Bool = true) { | ||
XCTAssertTrue( | ||
self.waitForExistence(timeout: UITests.Timeouts.elementExistence), | ||
"The element \(self.debugDescription) didn't load with the expected title in a reasonable timeframe." | ||
) | ||
self.typeURL(url, pressingEnter: pressingEnter) | ||
} | ||
|
||
func clickAfterExistenceTestSucceeds() { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. New convenience function. |
||
XCTAssertTrue( | ||
self.waitForExistence(timeout: UITests.Timeouts.elementExistence), | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now that we always start tests with a fresh install, every time we start a case, we also have to quickly make sure there are no first run problems like permissions which always appear, or the onboarding page.