Skip to content

Commit

Permalink
PIA-809: Update application
Browse files Browse the repository at this point in the history
  • Loading branch information
kp-laura-sempere committed Nov 9, 2023
2 parents 374153f + a2de346 commit bf7b533
Show file tree
Hide file tree
Showing 21 changed files with 474 additions and 95 deletions.
14 changes: 5 additions & 9 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ concurrency:
cancel-in-progress: true
jobs:
build:
runs-on: macos-13
runs-on: macos-latest
env:
TEST_RUNNER_PIA_TEST_USER: ${{ secrets.PIA_ACCOUNT_USERNAME}}
TEST_RUNNER_PIA_TEST_PASSWORD: ${{ secrets.PIA_ACCOUNT_PASSWORD }}
Expand All @@ -19,9 +19,6 @@ jobs:
- uses: actions/checkout@v3

- name: Select XCode version
run: sudo xcode-select -s /Applications/Xcode_15.0.app

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand All @@ -36,11 +33,10 @@ jobs:
- name: Check fastlane env
run: cat fastlane/.env

- name: Run e2e tests with fastlane
run: bundle exec fastlane e2e_tests
continue-on-error: true

- name: Run tests
- name: Run unit tests
run: bundle exec fastlane tests

- name: Run e2e tests
run: bundle exec fastlane e2e_tests


5 changes: 1 addition & 4 deletions .github/workflows/testflight_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ concurrency:
cancel-in-progress: true
jobs:
build:
runs-on: macos-13
runs-on: macos-latest
env:
CERTIFICATE_PASSWORD: ${{ secrets.CERTIFICATE_PASSWORD }}
KEYCHAIN_NAME: ${{ secrets.KEYCHAIN_NAME }}
Expand All @@ -26,9 +26,6 @@ jobs:
- uses: actions/checkout@v3

- name: Select XCode version
run: sudo xcode-select -s /Applications/Xcode_15.0.app

- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
Expand Down
120 changes: 78 additions & 42 deletions PIA VPN.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions PIA-VPN_E2E_Tests/Core/BaseTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ import Quick
import Nimble
import XCTest

class BaseTest: QuickSpec{
class BaseTest: QuickSpec {
static var app: XCUIApplication!

override class func spec(){
override class func spec() {
beforeEach {
app = XCUIApplication()
app.launch()
Expand Down
6 changes: 5 additions & 1 deletion PIA-VPN_E2E_Tests/Helpers/ElementHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ extension XCUIApplication {
var defaultTimeout: TimeInterval { 10.0 }
var shortTimeout: TimeInterval { 5.0 }

func navigationbar(with id: String) -> XCUIElement{
func navigationbar(with id: String) -> XCUIElement {
return navigationBars[id]
}

Expand Down Expand Up @@ -51,5 +51,9 @@ extension XCUIApplication {
func image(with id: String) -> XCUIElement {
return images[id]
}

func switches(with id: String) -> XCUIElement {
return switches[id]
}
}

6 changes: 3 additions & 3 deletions PIA-VPN_E2E_Tests/Helpers/WaitHelper.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import XCTest

enum ElementError: Error, CustomStringConvertible{
enum ElementError: Error, CustomStringConvertible {
case visibilityTimeout
case invisibilityTimeout

Expand All @@ -34,7 +34,7 @@ class WaitHelper{
onSuccess()
}

else{
else {
onFailure(.visibilityTimeout)
}
}
Expand All @@ -48,7 +48,7 @@ class WaitHelper{
onSuccess()
}

else{
else {
onFailure(.invisibilityTimeout)
}
}
Expand Down
1 change: 0 additions & 1 deletion PIA-VPN_E2E_Tests/PIA-VPN-e2e-simulator.xctestplan
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
},
"testTargets" : [
{
"parallelizable" : true,
"target" : {
"containerPath" : "container:PIA VPN.xcodeproj",
"identifier" : "69B70AAF2ACBF51C0072A09D",
Expand Down
2 changes: 1 addition & 1 deletion PIA-VPN_E2E_Tests/Screens/Common.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import XCTest

extension XCUIApplication{
extension XCUIApplication {
/// Sometimes a system alert to request permissions about Notifications or VPN profile installation can appear
/// at any time when the app is running
/// This makes not possible to contitnue with the test unless the alert is dismissed
Expand Down
31 changes: 28 additions & 3 deletions PIA-VPN_E2E_Tests/Screens/HomeScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

import XCTest

extension XCUIApplication{
extension XCUIApplication {
var dashboardMenuButton: XCUIElement{
button(with: PIALibraryAccessibility.Id.Dashboard.menu)
}
Expand All @@ -17,14 +17,23 @@ extension XCUIApplication{
button(with: AccessibilityId.Dashboard.connectionButton)
}

var confirmationDialogButton: XCUIElement{
var confirmationDialogButton: XCUIElement {
button(with: PIALibraryAccessibility.Id.Dialog.destructive)
}

var logOutButton: XCUIElement{
var logOutButton: XCUIElement {
staticText(with: "Log out")
}

var settingsButton: XCUIElement {
staticText(with: "Settings")
}

var settingsBackButton: XCUIElement {
button(with: "Settings")
}


func logOut() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()
Expand All @@ -37,4 +46,20 @@ extension XCUIApplication{
welcomeLoginButton.waitForExistence(timeout: defaultTimeout)
}
}

func navigateToSettings() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()

if settingsButton.waitForExistence(timeout: defaultTimeout) {
settingsButton.tap()
}
}

func navigateToHomeScreenFromSettings() {
if settingsBackButton.waitForExistence(timeout: defaultTimeout) {
settingsBackButton.tap()
}
closeButton.tap()
}
}
6 changes: 3 additions & 3 deletions PIA-VPN_E2E_Tests/Screens/LoginScreen.swift
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,13 @@ extension XCUIApplication {
otherElement(with: PIALibraryAccessibility.Id.Login.Error.banner)
}

func fillLoginScreen(with credentials: Credentials) {
func logIn(with credentials: Credentials) {
loginUsernameTextField.waitForExistence(timeout: defaultTimeout) && loginPasswordTextField.waitForExistence(timeout: defaultTimeout)
loginUsernameTextField.tap()
loginUsernameTextField.typeText(credentials.username)
loginPasswordTextField.tap()
loginPasswordTextField.typeText(credentials.password)
loginButton.tap()
}

/// This method authenticates the user and installs the VPN profile
Expand All @@ -41,8 +42,7 @@ extension XCUIApplication {
logOut()

navigateToLoginScreen()
fillLoginScreen(with: CredentialsUtil.credentials(type: .valid))
loginButton.tap()
logIn(with: CredentialsUtil.credentials(type: .valid))

guard vpnPermissionScreen.waitForExistence(timeout: defaultTimeout) else { return }
guard vpnPermissionButton.exists else { return }
Expand Down
28 changes: 28 additions & 0 deletions PIA-VPN_E2E_Tests/Screens/Settings/AutomationSettingsScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//
// AutomationSettingsScreen.swift
// PIA-VPN_E2E_Tests
//
// Created by Geneva Parayno on 6/11/23.
// Copyright © 2023 Private Internet Access Inc. All rights reserved.
//

import XCTest

extension XCUIApplication {
var enableAutomationSwitch: XCUIElement{
switches(with: "Enable Automation")
}

func navigateToAutomationSettings() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()

if settingsButton.waitForExistence(timeout: defaultTimeout) {
settingsButton.tap()
}

if automationSettingsButton.waitForExistence(timeout: defaultTimeout) {
automationSettingsButton.tap()
}
}
}
44 changes: 44 additions & 0 deletions PIA-VPN_E2E_Tests/Screens/Settings/GeneralSettingsScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
//
// GeneralSettingsScreen.swift
// PIA-VPN_E2E_Tests
//
// Created by Geneva Parayno on 2/11/23.
// Copyright © 2023 Private Internet Access Inc. All rights reserved.
//

import XCTest

extension XCUIApplication {
var connectSiriButton: XCUIElement {
staticText(with: "'Connect' Siri Shortcut")
}

var disconnectSiriButton: XCUIElement {
staticText(with: "'Disconnect' Siri Shortcut")
}

var serviceCommMessageSwitch: XCUIElement {
switches(with: "Show Service Communication Messages")
}

var geoLocatedRegionsSwitch: XCUIElement {
switches(with: "Show Geo-located Regions")
}

var resetSettingsButton: XCUIElement {
staticText(with: "Reset settings to default")
}

func navigateToGeneralSettings() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()

if settingsButton.waitForExistence(timeout: defaultTimeout) {
settingsButton.tap()
}

if generalSettingsButton.waitForExistence(timeout: defaultTimeout) {
generalSettingsButton.tap()
}
}
}
36 changes: 36 additions & 0 deletions PIA-VPN_E2E_Tests/Screens/Settings/HelpSettingsScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// HelpSettingsScreen.swift
// PIA-VPN_E2E_Tests
//
// Created by Geneva Parayno on 6/11/23.
// Copyright © 2023 Private Internet Access Inc. All rights reserved.
//

import XCTest

extension XCUIApplication {
var sendDebugButton: XCUIElement {
staticText(with: "Send Debug Log to support")
}

var helpImprovePIASwitch: XCUIElement {
switches(with: "Help improve PIA")
}

var latestNewsButton: XCUIElement {
staticText(with: "Latest News")
}

func navigateToHelpSettings() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()

if settingsButton.waitForExistence(timeout: defaultTimeout) {
settingsButton.tap()
}

if helpSettingsButton.waitForExistence(timeout: defaultTimeout) {
automationSettingsButton.tap()
}
}
}
36 changes: 36 additions & 0 deletions PIA-VPN_E2E_Tests/Screens/Settings/PrivacySettingsScreen.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
//
// PrivacySettingsScreen.swift
// PIA-VPN_E2E_Tests
//
// Created by Geneva Parayno on 6/11/23.
// Copyright © 2023 Private Internet Access Inc. All rights reserved.
//

import XCTest

extension XCUIApplication {
var vpnKillSwitch: XCUIElement {
switches(with: "VPN Kill Switch")
}

var safariContentBlockerSwitch: XCUIElement {
switches(with: "Safari Content Blocker state")
}

var refreshBlockListButton: XCUIElement {
staticText(with: "Refresh block list")
}

func navigateToPrivacySettings() {
guard dashboardMenuButton.exists else { return }
dashboardMenuButton.tap()

if settingsButton.waitForExistence(timeout: defaultTimeout) {
settingsButton.tap()
}

if privacySettingsButton.waitForExistence(timeout: defaultTimeout) {
privacySettingsButton.tap()
}
}
}
Loading

0 comments on commit bf7b533

Please sign in to comment.