-
Notifications
You must be signed in to change notification settings - Fork 339
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add iOS test for connecting to API via bridges
- Loading branch information
1 parent
446ef2b
commit bfcb555
Showing
18 changed files
with
572 additions
and
85 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
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 |
---|---|---|
@@ -0,0 +1,52 @@ | ||
// | ||
// ConnectivityTests.swift | ||
// MullvadVPNUITests | ||
// | ||
// Created by Niklas Berglund on 2024-01-18. | ||
// Copyright © 2024 Mullvad VPN AB. All rights reserved. | ||
// | ||
|
||
import Foundation | ||
import Network | ||
import XCTest | ||
|
||
class ConnectivityTests: LoggedOutUITestCase { | ||
let firewallAPIClient = FirewallAPIClient() | ||
|
||
override func setUpWithError() throws { | ||
super.setUp() | ||
} | ||
|
||
override func tearDownWithError() throws { | ||
super.tearDown() | ||
firewallAPIClient.removeRules() | ||
} | ||
|
||
/// Verifies that the app still functions when API has been blocked | ||
func testAPIConnectionViaBridges() throws { | ||
let app = XCUIApplication() | ||
app.launch() | ||
|
||
NetworkTester.verifyCanAccessAPI() // Just to make sure there's no old firewall rule still active | ||
firewallAPIClient.createRule(FirewallRule.makeBlockAPIAccessFirewallRule()!) | ||
NetworkTester.verifyCannotAccessAPI() | ||
|
||
LoginPage(app) | ||
.tapAccountNumberTextField() | ||
.enterText(self.hasTimeAccountNumber) | ||
.tapAccountNumberSubmitButton() | ||
|
||
// After creating firewall rule first login attempt might fail. One more attempt is allowed since the app is cycling between two methods. | ||
if isLoggedIn() { | ||
LoginPage(app) | ||
.verifySuccessIconShown() | ||
.verifyDeviceLabelShown() | ||
} else { | ||
LoginPage(app) | ||
.verifyFailIconShown() | ||
.tapAccountNumberSubmitButton() | ||
.verifySuccessIconShown() | ||
.verifyDeviceLabelShown() | ||
} | ||
} | ||
} |
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
Oops, something went wrong.