Skip to content
This repository was archived by the owner on Feb 17, 2025. It is now read-only.

Commit 5704346

Browse files
authored
Bug #5021 - desktop UA test not working on ipad (#5029)
* Bug #5021 - desktop UA test not working on ipad * Make tests iPhone only
1 parent 7a4d9d0 commit 5704346

File tree

2 files changed

+10
-2
lines changed

2 files changed

+10
-2
lines changed

XCUITests/DesktopModeTests.swift

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@
33
file, You can obtain one at http://mozilla.org/MPL/2.0/. */
44

55
import XCTest
6-
class DesktopModeTests: BaseTestCase {
6+
class DesktopModeTests: IphoneOnlyTestCase {
77

88
func testClearPrivateData() {
9+
if skipPlatform { return }
10+
911
navigator.openURL(path(forTestPage: "test-user-agent.html"))
1012
waitUntilPageLoad()
1113
XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0)
@@ -28,6 +30,8 @@ class DesktopModeTests: BaseTestCase {
2830
}
2931

3032
func testSameHostInMultipleTabs() {
33+
if skipPlatform { return }
34+
3135
navigator.openURL(path(forTestPage: "test-user-agent.html"))
3236
waitUntilPageLoad()
3337
XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0)
@@ -56,6 +60,8 @@ class DesktopModeTests: BaseTestCase {
5660
}
5761

5862
func testPrivateModeOffAlsoRemovesFromNormalMode() {
63+
if skipPlatform { return }
64+
5965
navigator.openURL(path(forTestPage: "test-user-agent.html"))
6066
waitUntilPageLoad()
6167
XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0)
@@ -84,6 +90,8 @@ class DesktopModeTests: BaseTestCase {
8490
}
8591

8692
func testPrivateModeOnHasNoAffectOnNormalMode() {
93+
if skipPlatform { return }
94+
8795
navigator.openURL(path(forTestPage: "test-user-agent.html"))
8896
waitUntilPageLoad()
8997
XCTAssert(app.webViews.staticTexts.matching(identifier: "MOBILE_UA").count > 0)

test-fixtures/test-user-agent.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
<script>
66
window.onload = () => {
7-
let found = navigator.userAgent.indexOf("iPhone") > -1
7+
let found = /iPhone|iPad/.exec(navigator.userAgent) != null
88
if (found) {
99
document.body.innerHTML = "MOBILE_UA"
1010
} else {

0 commit comments

Comments
 (0)