-
Notifications
You must be signed in to change notification settings - Fork 196
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
correct run command in mobile installation page #228
Open
AutomatedTester
wants to merge
1
commit into
versions/2.0
Choose a base branch
from
issue/mobile-run
base: versions/2.0
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,26 +15,25 @@ In order to run mobile app testing with Nightwatch, there are a few things that | |
3. SDKs for respective platforms | ||
4. Virtual devices | ||
|
||
However, Nightwatch simplifies the setup of all these via the Mobile Helper tool. | ||
However, Nightwatch simplifies the setup of all these via the Mobile Helper tool. | ||
|
||
[Mobile Helper Github][1] | ||
[Mobile Helper Github](https://github.com/nightwatchjs/mobile-helper-tool) | ||
|
||
### Setting up a new project | ||
|
||
When you run | ||
When you run | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npm init nightwatch</code> <code style="color: #aaa9a2; font-size: 20px"><directory-name></code></pre> | ||
|
||
the 1st question presented would be | ||
the 1st question presented would be | ||
|
||
<pre class="hide-indicator"><code>? Select testing type to setup for your project (Press <space> | ||
to select,<a> to toggle all,<i> to invert selection,and | ||
<enter> to proceed) | ||
❯◯ End-to-End testing | ||
◯ Component testing | ||
◉ Mobile app testing</code></pre> | ||
|
||
Make sure that the Mobile app testing is selected. The rest will be a series of questions/steps that you will have to go through and Nightwatch will do the heavy-lifting of installing everything required or giving instructions wherever needed. | ||
Make sure that the Mobile app testing is selected. The rest will be a series of questions/steps that you will have to go through and Nightwatch will do the heavy-lifting of installing everything required or giving instructions wherever needed. | ||
|
||
If you are planning to just do mobile app testing,you can alternatively initiate Nightwatch installation with the app mode using the command | ||
|
||
|
@@ -44,46 +43,43 @@ In case you select Android,there is 1 important point to note. Select the defaul | |
|
||
<pre class="hide-indicator"><code>? Where do you want the Android SDK setup? Please give the path | ||
to your existing setup (if any): | ||
(/Users/vishal/Library/Android/sdk) </code></pre> | ||
|
||
That’s it. Nightwatch setup for mobile app testing is complete! | ||
|
||
### Add mobile app testing to existing project | ||
|
||
#### Android | ||
|
||
<b>Step 1</b></br> | ||
Step 1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we still need some emphasis here or a small header |
||
Go the to the Nightwatch project directory and run the following command | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx @nightwatch/mobile-helper android --appium | ||
</code></pre> | ||
|
||
<b>Step 2</b></br> | ||
Step 2 | ||
Answer the questions based on your requirements. | ||
|
||
In case you select Android,there is 1 important point to note. Select the default option only if you don’t have the SDK installed to avoid duplication of SDK download. In case you have the SDK installed,please provide the path when this question comes up | ||
|
||
<pre class="hide-indicator"><code>? Where do you want the Android SDK setup? Please give the path | ||
to your existing setup (if any): | ||
(/Users/vishal/Library/Android/sdk) </code></pre>s | ||
|
||
<b>Step 3</b></br> | ||
After verification if all requirements are not met or if there is an error, follow the instructions to resolve them. | ||
Step 3 | ||
After verification if all requirements are not met or if there is an error, follow the instructions to resolve them. | ||
|
||
<b>Step 4</b></br> | ||
Step 4 | ||
Next, setup Appium 2 in your project with the following command. | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npm i appium@next --save-dev</code></pre> | ||
|
||
<b>Step 5</b></br> | ||
Step 5 | ||
Install Appium UiAutomator2 driver for Android | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx appium driver install uiautomator2</code></pre> | ||
|
||
<b>Step 6</b></br> | ||
Download the sample [wikipedia app][3] and save it in your project's root directory (alongside nightwatch.conf.js file). | ||
Step 6 | ||
Download the sample [wikipedia app](https://raw.githubusercontent.com/priyansh3133/wikipedia/main/wikipedia.apk) and save it in your project's root directory (alongside nightwatch.conf.js file). | ||
|
||
<b>Step 7</b></b> | ||
Step 7 | ||
Add Nightwatch environments for Android emulators and real devices. | ||
|
||
<div class="sample-test"> | ||
|
@@ -175,7 +171,7 @@ Add Nightwatch environments for Android emulators and real devices. | |
} | ||
</code></pre></div> | ||
|
||
<b>Step 8</b></b> | ||
Step 8 | ||
Add the following sample test file under the `nightwatch/examples/mobile-app-tests/wikipedia-android.js` file: | ||
|
||
<div class="sample-test"> | ||
|
@@ -198,39 +194,38 @@ describe('Wikipedia Android app test',function(){ | |
.appium.setContext('WEBVIEW_org.wikipedia') | ||
.assert.textEquals('.pcs-edit-section-title','BrowserStack'); // command run in webview context | ||
}); | ||
|
||
}); | ||
</code></pre></div> | ||
|
||
And done! 🎉 Your Android setup is now complete. | ||
|
||
#### iOS | ||
|
||
<b>Step 1</b></br> | ||
Step 1 | ||
Go the to the Nightwatch project directory and run the following command | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx @nightwatch/mobile-helper ios --setups | ||
</code></pre> | ||
|
||
<b>Step 2</b></br> | ||
Step 2 | ||
Answer the questions based on your requirements. | ||
|
||
<b>Step 3</b></br> | ||
After verification if all requirementss are not met or if there is an error,follow the instructions to resolve them. | ||
Step 3 | ||
After verification if all requirementss are not met or if there is an error,follow the instructions to resolve them. | ||
|
||
<b>Step 4</b></br> | ||
Step 4 | ||
After this,setup Appium 2 in your project using | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npm i appium@next --save-dev</code></pre> | ||
|
||
<b>Step 5</b></br> | ||
Step 5 | ||
Install Appium XCUITest driver for iOS using | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx appium driver install xcuitest</code></pre> | ||
|
||
<b>Step 6</b></br> | ||
Download the sample [wikipedia app][4] and save it in your project's root directory (alongside nightwatch.conf.js file). | ||
Step 6 | ||
Download the sample [wikipedia app](https://raw.githubusercontent.com/priyansh3133/wikipedia/main/wikipedia.zip) and save it in your project's root directory (alongside nightwatch.conf.js file). | ||
|
||
<b>Step 7</b></b> | ||
Step 7 | ||
Add Nightwatch environments for iOS simulators and real devices | ||
|
||
<div class="sample-test"> | ||
|
@@ -284,7 +279,7 @@ Add Nightwatch environments for iOS simulators and real devices | |
} | ||
} | ||
}, | ||
|
||
'app.ios.real': { | ||
extends: 'app', | ||
'desiredCapabilities': { | ||
|
@@ -308,10 +303,10 @@ Add Nightwatch environments for iOS simulators and real devices | |
} | ||
}, | ||
} | ||
|
||
} | ||
</code></pre></div> | ||
|
||
<b>Step 8</b></b> | ||
Step 8 | ||
Add the following sample test file under the `nightwatch/examples/mobile-app-tests/wikipedia-ios.js` file | ||
|
||
<div class="sample-test"> | ||
|
@@ -334,14 +329,14 @@ Add the following sample test file under the `nightwatch/examples/mobile-app-tes | |
.perform(async function() { | ||
// switch to webview context | ||
const contexts = await this.appium.getContexts(); | ||
|
||
await this.appium.setContext(contexts[1]); | ||
}) | ||
.useCss() | ||
.assert.textEquals('.pcs-edit-section-title','BrowserStack'); // command run in webview context | ||
}); | ||
|
||
}); | ||
</code></pre></div> | ||
|
||
Congratulations,your iOS setup is complete | ||
|
||
|
@@ -350,40 +345,24 @@ Congratulations,your iOS setup is complete | |
Once your installation is complete,validate the setup with the following command to run sample tests on Android emulators using | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx nightwatch nightwatch/examples/mobile-app-tests/wikipedia-android.js --env app.android.emulator | ||
</code></pre> | ||
|
||
or on iOS simulators using | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx nightwatch./nightwatch/examples/mobile-app-tests/wikipedia-ios.js --env app.ios.simulator | ||
</code></pre> | ||
|
||
<pre style="max-width: 800px; border-radius: 10px; padding: 10px 20px"><code class="language-bash" style="font-size: 20px">npx nightwatch /nightwatch/examples/mobile-app-tests/wikipedia-ios.js --env app.ios.simulator | ||
|
||
### Install Appium Inspector | ||
|
||
Appium inspector would be very helpful in identifying selectors and debugging tests. Inorder to install Appium inspector,go to [Appium Inspector releases][2] and download the latest version. After installing,simply open Appium Inspector and you are ready to go. Below is how the application will look like on Mac. | ||
|
||
![Appium Inspector][image-1] | ||
Appium inspector would be very helpful in identifying selectors and debugging tests. Inorder to install Appium inspector,go to [Appium Inspector releases](https://github.com/appium/appium-inspector/releases) and download the latest version. After installing,simply open Appium Inspector and you are ready to go. Below is how the application will look like on Mac. | ||
|
||
![Appium Inspector](https://user-images.githubusercontent.com/1677755/220174481-f423292a-4577-4740-8518-503d1fa19dbd.png) | ||
|
||
### Recommended next steps | ||
|
||
Now that you understand how mobile app testing works with Nightwatch,let's dive into the setup. We recommend you cover all the below listed topics to get a complete understanding on mobile app automated testing using Nightwatch. | ||
|
||
[Write tests to automate native applications][5] </br> | ||
[Run tests on virtual devices,real devices & cloud providers][6] </br> | ||
[Debug tests][7] | ||
|
||
[1]: https://github.com/nightwatchjs/mobile-helper-tool | ||
[2]: https://github.com/appium/appium-inspector/releases | ||
[3]: https://raw.githubusercontent.com/priyansh3133/wikipedia/main/wikipedia.apk | ||
[4]: https://raw.githubusercontent.com/priyansh3133/wikipedia/main/wikipedia.zip | ||
[5]: /guide/mobile-app-testing/introduction-writing-tests.html | ||
[6]: /guide/mobile-app-testing/running-tests.html | ||
[7]: /guide/mobile-app-testing/debug-tests.html | ||
|
||
|
||
[image-1]: https://user-images.githubusercontent.com/1677755/220174481-f423292a-4577-4740-8518-503d1fa19dbd.png | ||
|
||
[Write tests to automate native applications](/guide/mobile-app-testing/introduction-writing-tests.html) | ||
[Run tests on virtual devices,real devices & cloud providers](/guide/mobile-app-testing/running-tests.html) | ||
[Debug tests](/guide/mobile-app-testing/debug-tests.html) | ||
|
||
<div class="doc-pagination pt-40"> | ||
<div class="previous"> | ||
|
@@ -404,4 +383,3 @@ Now that you understand how mobile app testing works with Nightwatch,let's dive | |
</div> | ||
</div> | ||
</div> | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code
andpre
tags aren't closed now.