-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
PIA-1604: Added Dedicated IP tests (#129)
- Loading branch information
1 parent
52d6e81
commit 4df04ce
Showing
14 changed files
with
194 additions
and
28 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,53 @@ | ||
// | ||
// DedicatedIPScreen.swift | ||
// PIA-VPN_tvOS_E2E_Tests | ||
// | ||
// Created by Geneva Parayno on 28/3/24. | ||
// Copyright © 2024 Private Internet Access Inc. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
|
||
extension XCUIApplication{ | ||
var dIPTokenTextField:XCUIElement {textField(with: "Enter Your Dedicated IP Token")} | ||
var activateButton: XCUIElement {button(with: "Activate")} | ||
var emptyTokenErrorMessage: XCUIElement {staticText(with: "Your token can't be empty.")} | ||
var invalidTokenErrorMessage: XCUIElement {staticText(with: "Your token is either invalid or has expired.")} | ||
var activeDIPMessage: XCUIElement {staticText(with: "Your Dedicated IP it's now active.")} | ||
var deleteDedicatedIPButton: XCUIElement {button(with: "Delete Dedicated IP")} | ||
var activeDIPStatus: XCUIElement {staticText(with: "Active")} | ||
var confirmDeleteButton: XCUIElement {button(with: "Yes, Delete")} | ||
|
||
func activateDIPToken(DIP: DedicatedIP){ | ||
|
||
dIPTokenTextField.waitForElementToAppear() | ||
moveFocus(to: dIPTokenTextField) | ||
XCUIRemote.shared.press(.select) | ||
let navigator = KeyboardNavigator() | ||
navigator.resetKeyboardPosition() | ||
navigator.typeText(DIP.token, keyboardType: .multiRow) | ||
navigator.clickNext() | ||
activateButton.waitForElementToAppear() | ||
moveFocus(to: activateButton, startingDirection: .down) | ||
XCUIRemote.shared.press(.select) | ||
|
||
if(emptyTokenErrorMessage.exists || invalidTokenErrorMessage.exists) { | ||
return | ||
} | ||
|
||
else if(continueButton.exists) { | ||
moveFocus(to: continueButton.firstMatch) | ||
XCUIRemote.shared.press(.select) | ||
} | ||
} | ||
|
||
func deleteDedicatedIP(){ | ||
deleteDedicatedIPButton.waitForElementToAppear() | ||
moveFocus(to: deleteDedicatedIPButton) | ||
XCUIRemote.shared.press(.select) | ||
confirmDeleteButton.waitForElementToAppear() | ||
moveFocus(to: confirmDeleteButton.firstMatch) | ||
XCUIRemote.shared.press(.select) | ||
XCTAssert(dIPTokenTextField.waitForElementToAppear()) | ||
} | ||
} |
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,61 @@ | ||
// | ||
// DedicatedIPTests.swift | ||
// PIA-VPN_tvOS_E2E_Tests | ||
// | ||
// Created by Geneva Parayno on 27/3/24. | ||
// Copyright © 2024 Private Internet Access Inc. All rights reserved. | ||
// | ||
|
||
import Nimble | ||
|
||
class DedicatedIPTests: BaseTest { | ||
override class func spec() { | ||
super.spec() | ||
|
||
describe("dedicated ip tests") { | ||
context("when activating dedicated ip tokens") { | ||
it("should display an error notification for invalid tokens") { | ||
app.navigateToSettingsScreen() | ||
app.navigateToDedicatedIPScreen() | ||
if(app.deleteDedicatedIPButton.exists) { | ||
app.deleteDedicatedIP() | ||
} | ||
app.activateDIPToken(DIP: DedicatedIPUtil.dedicatedIP(type: .invalid)) | ||
expect(app.invalidTokenErrorMessage.waitForElementToAppear()).to(beTrue()) | ||
} | ||
|
||
it("should display an error notification for empty token") { | ||
app.navigateToSettingsScreen() | ||
app.navigateToDedicatedIPScreen() | ||
if(app.deleteDedicatedIPButton.exists) { | ||
app.deleteDedicatedIP() | ||
} | ||
app.activateDIPToken(DIP: DedicatedIPUtil.dedicatedIP(type: .empty)) | ||
expect(app.emptyTokenErrorMessage.waitForElementToAppear()).to(beTrue()) | ||
} | ||
|
||
it("should successully activate valid tokens") { | ||
app.navigateToSettingsScreen() | ||
app.navigateToDedicatedIPScreen() | ||
if(app.deleteDedicatedIPButton.exists) { | ||
app.deleteDedicatedIP() | ||
} | ||
app.activateDIPToken(DIP: DedicatedIPUtil.dedicatedIP(type: .valid)) | ||
expect(app.activeDIPStatus.waitForElementToAppear()).to(beTrue()) | ||
} | ||
} | ||
|
||
context("when deleting dedicated ip") { | ||
it("should remove the dip from the list") { | ||
app.navigateToSettingsScreen() | ||
app.navigateToDedicatedIPScreen() | ||
if(!app.deleteDedicatedIPButton.exists) { | ||
app.activateDIPToken(DIP: DedicatedIPUtil.dedicatedIP(type: .valid)) | ||
} | ||
app.deleteDedicatedIP() | ||
expect(app.enterDedicatedIPTitle.waitForElementToAppear()).to(beTrue()) | ||
} | ||
} | ||
} | ||
} | ||
} |
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
Oops, something went wrong.