Scenario 1:
In my ios, the 1st stage is signup which is a bit lengthy. I need to fill up 15 pages to complete the signup process. In 5th page is for a verification code, the code is already sent to the email id. so from this verification code page what I want to do is —>
- Switch to safari
- do the task in safari
- Want to come back the app in the verification code page.
I can do successfully step 1 & 2 . The problem is in step 3 when I have opened my app with driver.launchApp() command, the app starts from the beginning but I want to start it from the ‘verification code’ page.
Because if a start it from the first page then another code will be generated.
Scenario 2:
Suppose during run the script I got an error in the 4th page of my signup process. After fixing the problem I want to run it from the 4th page. What I mean is I want to start it exactly from the same place where I leave it last time. How can I do this in appium ???
Appium Desktop Version: 1.10.0
Xcode version : 10.1
Simulator: iphone- 6s (12.1)
Below I have attached my code, please have a look ,
public class Base {
private String reportDirectory = “reports”;
private String reportFormat = “xml”;
private String testName = “TestIOS”;
public static int counter= 0;
public AppiumDriver driver;
public static SeeTestClient client;
public DesiredCapabilities dc = new DesiredCapabilities();
static UUID uuid = UUID.randomUUID();
static long l = ByteBuffer.wrap(uuid.toString().getBytes()).getLong();
static String id = Long.toString(l, Character.MAX_RADIX);
static String storedId= id;
@BeforeTest
public void setUp() throws MalformedURLException {
dc.setCapability("reportDirectory", reportDirectory);
dc.setCapability("reportFormat", reportFormat);
dc.setCapability("testName", testName);
dc.setCapability("automationName", "XCUITest");
dc.setCapability("platformName", "iOS");
dc.setCapability("deviceName", "iPhone 6s");
dc.setCapability("platformVersion", "12.1");
dc.setCapability("app", "/Users/bs215/IdeaProjects/meedapptest/Apps/MEED/meed.app");
dc.setCapability(IOSMobileCapabilityType.BUNDLE_ID, "net.....");
dc.setCapability("autoAcceptAlerts", true);
dc.setCapability("fullReset", false);
dc.setCapability("noReset", true);
dc.setCapability("clearSystemFiles", true);
dc.setCapability("autoWebview", true);
driver = new IOSDriver<>(new URL("http://localhost:4723/wd/hub"), dc);
client = new SeeTestClient(driver);
driver.setLogLevel(Level.INFO);
}
@Test(priority = 11)
public void GMA_TC_10_verifyEmailVerificationCode () throws Exception{
signupPage signUp= new signupPage();
String code= other.varificationCode.emailid(driver);
driver.launchApp();
}
package other;
public class varificationCode extends Base {
public static String emailId(AppiumDriver driver) throws Exception {
dc.setCapability(MobileCapabilityType.BROWSER_NAME, “Safari”);
dc.setCapability(“autoWebview”, true);
driver.get(“http://www.yopmail.com”);
driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);
String requiredcode;
=======doing the task and get the code from mail========
return requiredcode;
}
}