Skip to content

Commit

Permalink
PIA-634: Create Protocol page object and step object
Browse files Browse the repository at this point in the history
This is to access protocol settings page so that we can verify whether our system restart the
selection after logout.
  • Loading branch information
kp-ruth-o committed Oct 11, 2023
1 parent 75e958b commit fd36bf3
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 6 deletions.
4 changes: 4 additions & 0 deletions app/src/androidTest/java/helpers/LocatorHelper.kt
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,8 @@ object LocatorHelper {
fun findByText(text : String) : UiObject {
return device.findObject(UiSelector().text(text))
}

fun selectDropDownList(text : String, index : Int) : UiObject {
return device.findObject(UiSelector().resourceId(text).index(index))
}
}
12 changes: 12 additions & 0 deletions app/src/androidTest/java/screens/objects/ProtocolPageObjects.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.privateinternetaccess.android.screens.objects

import androidx.test.uiautomator.UiSelector
import com.privateinternetaccess.android.helpers.LocatorHelper

class ProtocolPageObjects {

val protocolSettings = LocatorHelper.findByResourceId("com.privateinternetaccess.android:id/protocolsSettings")
val protocolSelection = LocatorHelper.findByResourceId("com.privateinternetaccess.android:id/protocolSetting")
val openVPN = LocatorHelper.selectDropDownList("com.privateinternetaccess.android:id/list_settings_radio", 0)
val save = LocatorHelper.findByResourceId("android:id/button1")
}
16 changes: 16 additions & 0 deletions app/src/androidTest/java/screens/steps/ProtocolStepObjects.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
package com.privateinternetaccess.android.screens.steps

import com.privateinternetaccess.android.screens.objects.ProtocolPageObjects

class ProtocolStepObjects {

val protocolPageObjects = ProtocolPageObjects()

fun clickProtocol()
{
protocolPageObjects.openVPN.click()
protocolPageObjects.save.click()
}


}
16 changes: 10 additions & 6 deletions app/src/androidTest/java/tests/SignOutTests.kt
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,26 @@ import com.privateinternetaccess.android.helpers.ActionHelpers.returnOnMainScree
import com.privateinternetaccess.android.screens.objects.SettingsPageObjects
import com.privateinternetaccess.android.screens.steps.GeneralStepObjects
import com.privateinternetaccess.android.screens.objects.GeneralPageObjects
import com.privateinternetaccess.android.screens.objects.ProtocolPageObjects
import com.privateinternetaccess.android.screens.steps.ProtocolStepObjects
import org.junit.Test

class SignOutTests : BaseUiAutomatorClass() {

private val settingsPageObjects = SettingsPageObjects()
private val generalStepObjects = GeneralStepObjects()
private val protocolPageObjects = ProtocolPageObjects()

@Test
fun validatingDefaultSettingsAfterLogout() {
successfulLogin()
goToSettings(settingsPageObjects.general)
goToSettings(protocolPageObjects.protocolSettings, protocolPageObjects.protocolSelection)
ProtocolStepObjects().clickProtocol()
generalStepObjects.launchOnSystemStartUp()
returnOnMainScreen()
successfulLgout()
successfulLogin()
goToSettings(settingsPageObjects.general)
assert(!GeneralPageObjects().toggleLaunchOnSystemStartUp.isChecked())
// returnOnMainScreen()
// successfulLgout()
// successfulLogin()
// goToSettings(settingsPageObjects.general)
// assert(!GeneralPageObjects().toggleLaunchOnSystemStartUp.isChecked())
}
}

0 comments on commit fd36bf3

Please sign in to comment.