Skip to content

Commit

Permalink
fix(baselineprofile): avoid back pressure for back component.
Browse files Browse the repository at this point in the history
  • Loading branch information
GerardPaligot committed Apr 12, 2024
1 parent 3d733c9 commit 96c6ff0
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@ import androidx.benchmark.macro.junit4.BaselineProfileRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
import androidx.test.platform.app.InstrumentationRegistry
import androidx.test.uiautomator.By
import androidx.test.uiautomator.UiDevice
import androidx.test.uiautomator.Until
import org.gdglille.devfest.baselineprofile.scenarios.AgendaPOM
import org.gdglille.devfest.baselineprofile.scenarios.EventListPOM
import org.gdglille.devfest.baselineprofile.scenarios.InfoPOM
Expand Down Expand Up @@ -73,16 +70,16 @@ class BaselineProfileGenerator {
with(agendaPom) {
open()
openFilters()
device.pressBack()
back()
openFirstItem()
device.pressBack()
back()
scrollUpDown()
}

with(speakersPom) {
open()
openFirstItem()
device.pressBack()
back()
scrollUpDown()
}

Expand All @@ -93,7 +90,7 @@ class BaselineProfileGenerator {
with(partnersPom) {
open()
openFirstItem()
device.pressBack()
back()
scrollUpDown()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,8 @@ class AgendaPOM(private val device: UiDevice) {
fling(Direction.UP)
}
}

fun back() {
device.runAction(DevfestScenario.back) { click() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.gdglille.devfest.android.theme.m3.schedules.semantics.SchedulesSemant
import org.gdglille.devfest.android.theme.m3.speakers.semantics.SpeakersSemantics

object DevfestScenario {
val back = By.desc("Back")
object Event {
val pastEvents = By.text("Past events")
val name = By.text("Devfest Lille 2023")
Expand All @@ -26,6 +27,7 @@ object DevfestScenario {
}
object Partners {
val tabName = By.desc("Partners")
val detailName = By.text("Partner detail")
val first = By.desc("SFEIR")
val list = By.res(PartnersSemantics.list)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.gdglille.devfest.baselineprofile.scenarios
import androidx.test.uiautomator.Direction
import androidx.test.uiautomator.UiDevice
import org.gdglille.devfest.baselineprofile.runAction
import org.gdglille.devfest.baselineprofile.waitForObject

class PartnersPOM(private val device: UiDevice) {
fun open() {
Expand All @@ -11,6 +12,7 @@ class PartnersPOM(private val device: UiDevice) {

fun openFirstItem() {
device.runAction(DevfestScenario.Partners.first) { click() }
device.waitForObject(DevfestScenario.Partners.detailName)
}

fun scrollUpDown() {
Expand All @@ -19,4 +21,8 @@ class PartnersPOM(private val device: UiDevice) {
fling(Direction.UP)
}
}

fun back() {
device.runAction(DevfestScenario.back) { click() }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,8 @@ class SpeakersPOM(private val device: UiDevice) {
fling(Direction.UP)
}
}

fun back() {
device.runAction(DevfestScenario.back) { click() }
}
}

0 comments on commit 96c6ff0

Please sign in to comment.