This repository has been archived by the owner on Mar 6, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 263
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add MTE-2019 automated test for URL validation (#3983)
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
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
43 changes: 43 additions & 0 deletions
43
focus-ios/focus-ios-tests/XCUITest/URLValidationTest.swift
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 |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// 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 Foundation | ||
import XCTest | ||
|
||
class URLValidationTest: BaseTestCase { | ||
override func setUp() { | ||
super.setUp() | ||
continueAfterFailure = true | ||
} | ||
|
||
let urlTypes = ["mozilla.org", "mozilla.org/", "https://mozilla.org", "mozilla.org/en", "mozilla.org/en-", | ||
"mozilla.org/en-US", "https://mozilla.org/", "https://mozilla.org/en", "https://mozilla.org/en-US"] | ||
let urlHttpTypes=["http://example.com", "http://example.com/"] | ||
|
||
// https://testrail.stage.mozaws.net/index.php?/cases/view/2460275 | ||
func testDifferentURLTypes() { | ||
for i in urlTypes { | ||
loadAndValidateURL(URL: i) | ||
} | ||
|
||
for i in urlHttpTypes { | ||
loadAndValidateHttpURLs(URL: i) | ||
} | ||
} | ||
|
||
private func loadAndValidateURL(URL: String) { | ||
loadWebPage(URL) | ||
waitForWebPageLoad() | ||
XCTAssertTrue(app.otherElements.staticTexts["Mozilla"].exists, "The website was not loaded properly") | ||
XCTAssertTrue(app.buttons["Menu"].exists) | ||
XCTAssertEqual(app.textFields["URLBar.urlText"].value as? String, "www.mozilla.org") | ||
} | ||
|
||
private func loadAndValidateHttpURLs(URL: String) { | ||
loadWebPage(URL) | ||
waitForWebPageLoad() | ||
XCTAssertTrue(app.otherElements.staticTexts["Example Domain"].exists, "The website was not loaded properly") | ||
XCTAssertEqual(app.textFields["URLBar.urlText"].value as? String, "example.com") | ||
} | ||
} |