|
1 | 1 | #Node.js samples |
2 | 2 |
|
3 | | -## prerequisites |
4 | | - |
5 | | -Upgrade Mocha to the latest version: |
6 | | - |
7 | | -``` |
8 | | -npm install -g -f mocha |
9 | | -``` |
| 3 | +## Prerequisites |
10 | 4 |
|
11 | 5 | Install local packages: |
12 | 6 |
|
13 | 7 | ``` |
14 | 8 | npm install |
15 | 9 | ``` |
16 | 10 |
|
17 | | -### to run tests locally |
18 | | - |
19 | | -Install appium and start the appium server for your device, please refer to: |
20 | | - |
21 | | -- http://appium.io |
22 | | -- https://github.com/appium/appium/blob/master/README.md |
23 | | - |
24 | | -### to run tests using Sauce Labs cloud |
| 11 | +### To run tests using Sauce Labs cloud |
25 | 12 |
|
26 | 13 | [Sign up here](https://saucelabs.com/signup/trial) |
27 | 14 |
|
28 | | -Configure your environment: |
| 15 | +Then when running the tests, add your Sauce Labs credentials as npm config parameters, example : |
29 | 16 |
|
30 | 17 | ``` |
31 | | -export SAUCE_USERNAME=<SAUCE_USERNAME> |
32 | | -export SAUCE_ACCESS_KEY=<SAUCE_ACCESS_KEY> |
| 18 | +npm run ios-simple appium-sample-code:sauce=1 appium-sample-code:sauce_username=<SAUCE_USERNAME> appium-sample-code:sauce_access_key=<SAUCE_ACCESS_KEY> |
33 | 19 | ``` |
34 | 20 |
|
35 | | -If you also want to use Sauce Connect (secure tunelling): |
| 21 | +Or set the config parameters directly in package.json : |
36 | 22 |
|
37 | | -- [Read the doc here](https://saucelabs.com/docs/connect) |
38 | | -- Install and start the Sauce Connect client |
39 | | - |
40 | | -## running tests |
41 | | - |
42 | | -###iOS |
43 | | - |
44 | | -####local: |
45 | | - |
46 | | -``` |
47 | | -mocha ios-simple.js |
48 | | -mocha ios-complex.js |
49 | | -mocha ios-webview.js |
50 | | -mocha ios-actions.js |
51 | | -mocha ios-local-server.js |
52 | | -mocha ios-selenium-webdriver-bridge.js |
53 | 23 | ``` |
| 24 | +// package.json |
54 | 25 |
|
55 | | -####using Sauce Labs: |
56 | | - |
57 | | -``` |
58 | | -SAUCE=1 mocha ios-simple.js |
59 | | -SAUCE=1 mocha ios-complex.js |
60 | | -SAUCE=1 mocha ios-webview.js |
61 | | -SAUCE=1 mocha ios-actions.js |
62 | | -SAUCE=1 mocha ios-selenium-webdriver-bridge.js |
| 26 | +... |
| 27 | +"config":{ |
| 28 | + sauce:"1", |
| 29 | + sauce_username:"<SAUCE_USERNAME>", |
| 30 | + sauce_access_key:"<SAUCE_ACCESS_KEY>" |
| 31 | +}, |
| 32 | +... |
63 | 33 | ``` |
64 | 34 |
|
65 | | -####using Sauce Labs + Sauce Connect: |
| 35 | +If you also want to use Sauce Connect (secure tunelling): |
66 | 36 |
|
67 | | -``` |
68 | | -SAUCE=1 mocha ios-local-server.js |
69 | | -``` |
| 37 | +- [Read the doc here](https://saucelabs.com/docs/connect) |
| 38 | +- Install and start the Sauce Connect client |
70 | 39 |
|
71 | | -###Android |
72 | 40 |
|
73 | | -####local: |
| 41 | +### To run tests locally |
74 | 42 |
|
75 | | -``` |
76 | | -mocha android-simple.js |
77 | | -mocha android-complex.js |
78 | | -mocha android-webview.js |
79 | | -mocha android-local-server.js |
80 | | -``` |
| 43 | +Install appium and start the appium server for your device, please refer to: |
81 | 44 |
|
82 | | -####using Sauce Labs: |
| 45 | +- http://appium.io |
| 46 | +- https://github.com/appium/appium/blob/master/README.md |
83 | 47 |
|
84 | | -``` |
85 | | -SAUCE=1 mocha android-simple.js |
86 | | -SAUCE=1 mocha android-complex.js |
87 | | -SAUCE=1 mocha android-webview.js |
88 | | -``` |
| 48 | +## Running tests |
89 | 49 |
|
90 | | -####using Sauce Labs + Sauce Connect |
| 50 | +###iOS |
91 | 51 |
|
92 | 52 | ``` |
93 | | -SAUCE=1 mocha android-local-server.js |
| 53 | +npm run ios-simple |
| 54 | +npm run ios-complex |
| 55 | +npm run ios-webview |
| 56 | +npm run ios-actions |
| 57 | +npm run ios-local-server |
| 58 | +npm run ios-selenium-webdriver-bridge |
94 | 59 | ``` |
95 | 60 |
|
96 | | -###Selendroid |
97 | | - |
98 | | -####local: |
| 61 | +###Android |
99 | 62 |
|
100 | 63 | ``` |
101 | | -mocha selendroid-simple.js |
| 64 | +npm run android-simple |
| 65 | +npm run android-complex |
| 66 | +npm run android-webview |
| 67 | +npm run android-local-server |
102 | 68 | ``` |
103 | 69 |
|
104 | | -####using Sauce Labs: |
| 70 | +###Selendroid |
105 | 71 |
|
106 | 72 | ``` |
107 | | -SAUCE=1 mocha selendroid-simple.js |
| 73 | +npm run selendroid-simple |
108 | 74 | ``` |
109 | 75 |
|
110 | 76 | ###Node.js 0.11 + Generator with Yiewd |
111 | 77 |
|
112 | 78 | prerequisite: switch to node > 0.11 |
113 | 79 |
|
114 | | -####local: |
115 | | - |
116 | | -``` |
117 | | -mocha --harmony ios-yiewd.js |
118 | | -``` |
119 | | - |
120 | | -####using Sauce Labs: |
121 | | - |
122 | 80 | ``` |
123 | | -SAUCE=1 mocha --harmony ios-yiewd.js |
| 81 | +npm run ios-yiewd |
124 | 82 | ``` |
0 commit comments