I have an app with a login screen. I am exploring making automated tests for my app. I cannot get past the login screen.
The screen has two text fields, a secure text field, and a button. I need to enter a base URL into the first and a username into the second text fields, a password into the secure text field and click the login button.
Th app hangs when I click the login button. In the simulator if I click the login button there (using the URL/username/password entered by the simulator) it works normally
Here is the WD code:
// Requires the admc/wd client library
// (npm install wd)
// Then paste this into a .js file and run with Node 7.6+
const wd = require('wd');
const driver = wd.promiseChainRemote("http://localhost:4723/wd/hub");
const caps = {"platformName":"iOS","deviceName":"iPad Pro (9.7-inch)","automationName":"XCUITest","uuid":"E85ADF43-A1D0-472D-909A-B90E11767266","app":"/Users/user/Documents/GIT/B52/build/Release-iphonesimulator/B52FloorManagement.app"};
async function main () {
await driver.init(caps);
let el1 = await driver.elementByXPath("//XCUIElementTypeTextField[@name=\"baseURLEntry\"]");
await el1.sendKeys("http://example.com/login");
let el2 = await driver.elementByXPath("//XCUIElementTypeTextField[@name=\"userNameEntry\"]");
await el2.sendKeys("XXXXXXXX");
let el3 = await driver.elementByXPath("//XCUIElementTypeSecureTextField[@name=\"passwordEntry\"]");
await el3.sendKeys("XXXXXXX");
let el4 = await driver.elementByAccessibilityId("loginButton");
await el4.click();
await driver.quit();
}
main().catch(console.log);