I was wondering if there is a way we can have one recording work on two different mobile application platform, but not at the same time of course. We have a mobile app the runs on iOS and Android. Visually, the layout and flow are exactly the same, but the Xpath for any particular item is not.
Lets assume I built out the item repository to have it organize exactly the same for both platform. Something like this:
A) iOSAppRepo (MobileApp)
a) LoginPage (Container)
1) EmailField (text)
2) PasswordField (text)
3) SignInButton (button)
B) AndroidAppRepo (MobileApp)
a) LoginPage (Container)
1) EmailField (text)
2) PasswordField (text)
3) SignInButton (button)
Can I then have a script that does something like this?
Code: Select all
static var repo;
if (mobileAppGlobalVariable == "iOSApp")
repo = new iOSAppRepo();
else
repo = new AndroidAppRepo();
Code: Select all
repo.LoginPage.EmailField.Element.SetAttribute("Text", myEmailAddress);
repo.LoginPage.PasswordField.Element.SetAttribute("Text", myPassword);
repo.LoginPage.SignInButton.Touch();
If this is NOT possible, whats the best way to tackle developing tests for two applications where the UI is exactly the same? It would seem very tedious for me to recreate the item repository and recreate all the recordings.
Thanks.