From d6b96069f1b5dfc92fe232beaa52018df0e68200 Mon Sep 17 00:00:00 2001 From: srishti11010 Date: Wed, 2 May 2018 16:54:16 +0530 Subject: [PATCH] Changes for new sample app --- ios/README.md | 2 +- ios/singleTest.js | 46 +++++++++++++++------------------------------- 2 files changed, 16 insertions(+), 32 deletions(-) diff --git a/ios/README.md b/ios/README.md index fc1e444..212288c 100644 --- a/ios/README.md +++ b/ios/README.md @@ -14,7 +14,7 @@ $ npm install wd curl -u "username:accesskey" -X POST "https://api.browserstack.com/app-automate/upload" -F "file=@/path/to/app/file/Application-debug.ipa" ``` -- If you do not have an .ipa file and looking to simply try App Automate, you can download our [sample app](https://www.browserstack.com/app-automate/sample-apps/ios/WordPressSample.ipa) and upload to the BrowserStack servers using the above API. +- If you do not have an .ipa file and looking to simply try App Automate, you can download our [sample app](https://www.browserstack.com/app-automate/sample-apps/ios/BStackSampleApp.ipa) and upload to the BrowserStack servers using the above API. - For LocalSample tests, you can use our [local sample app](https://www.browserstack.com/app-automate/sample-apps/ios/LocalSample.ipa). - Update the desired capability "app" with the App URL returned from the above API call diff --git a/ios/singleTest.js b/ios/singleTest.js index 8fd95b2..b4751ce 100644 --- a/ios/singleTest.js +++ b/ios/singleTest.js @@ -18,43 +18,27 @@ driver = wd.promiseRemote("http://hub-cloud.browserstack.com/wd/hub"); driver .init(desiredCaps) .then(function () { - return driver.waitForElementById('Log In', asserters.isDisplayed && asserters.isEnabled, 30000); + return driver.waitForElementById('Text Button', asserters.isDisplayed && asserters.isEnabled, 30000); }) - .then(function (loginButton) { - return loginButton.click(); + .then(function (textButton) { + return textButton.click(); }) .then(function () { - return driver.waitForElementById('Email address', asserters.isDisplayed && asserters.isEnabled, 30000); + return driver.waitForElementById('Text Input', asserters.isDisplayed && asserters.isEnabled, 30000); }) - .then(function (emailInput) { - return emailInput.sendKeys("hello@browserstack.com"); + .then(function (textInput) { + return textInput.sendKeys("hello@browserstack.com"+"\n"); }) .then(function () { - return driver.waitForElementById('Next', asserters.isDisplayed, 30000); - }) - .then(function (nextButton) { - return nextButton.click().then(function() { - sleep.sleep(5); + return driver.waitForElementById('Text Output', asserters.isDisplayed && asserters.isEnabled, 30000); + }) + .then(function (textOutput) { + return textOutput.text().then(function(value) { + if (value === "hello@browserstack.com") + assert(true); + else + assert(false); }); }) - .then(function() { - return driver.waitForElementsByXPath("//XCUIElementTypeStaticText", asserters.isDisplayed, 30000); - }) - .then(function (textElements) { - return Q().then(function () { - return textElements.map(function (textElement) { - if (textElement === null) { - return; - } else { - return textElement.text().then(function(value) { - if (value.indexOf('not registered') !== -1) { - console.log(value); - assert(value.indexOf('This email address is not registered on WordPress.com') !== -1); - } - }); - } - }) - }).all() - }) .fin(function() { return driver.quit(); }) - .done(); + .done(); \ No newline at end of file