I am writing some automation test for a test setup on different Android and IOS devices, and i wanted to make a method on my ADT that returns a locator, that fits the specific platform.
final case object HomeMenu extends MenuPoint {
override def locator(implicit platform: Platform): String = platform match {
case Base.Android => "AndroidWidget"
case Base.Apple => "Apple ID"
case browser: Base.Browser => ""
}
}
i am building the adt with two parameters, the given TestDevice, and the Brand of the app i am testing.
The Brand is where the adt is built, and every clickable element in the adt have the method locator.
so what i want is that i can give the TestDevice in as a parameter, and then it handles the implicit for me so i dont have to give the Platform as parameter to the locator method.
println(MainAppAdt(AndroidSmartPhone("Galaxy S9+"), WebTv).brand.menu.head.locator)
println(MainAppAdt(AppleSmartPhone("iPhone X"),WebTv).brand.menu.head.locator)
I have tried to make a companion object for the AndroidSmartPhone and AppleSmartPhone with the implicit stored there. but it looks like it just takes one of them