mirror of
https://github.com/openstf/stf
synced 2025-10-04 02:09:32 +02:00
Add Documentation in Markdown plus express middleware for in-site rendering.
This commit is contained in:
parent
c318cddd14
commit
eb968fa737
13 changed files with 349 additions and 12 deletions
|
@ -22,6 +22,7 @@ var browserIconMiddleware = require('./middleware/browser-icons')
|
||||||
var appstoreIconMiddleware = require('./middleware/appstore-icons')
|
var appstoreIconMiddleware = require('./middleware/appstore-icons')
|
||||||
|
|
||||||
var webpackServerConfig = require('./../../../webpack.config').webpackServer
|
var webpackServerConfig = require('./../../../webpack.config').webpackServer
|
||||||
|
var markdownServe = require('markdown-serve')
|
||||||
|
|
||||||
module.exports = function(options) {
|
module.exports = function(options) {
|
||||||
var log = logger.createLogger('app')
|
var log = logger.createLogger('app')
|
||||||
|
@ -33,6 +34,11 @@ module.exports = function(options) {
|
||||||
log.error('Proxy had an error', err.stack)
|
log.error('Proxy had an error', err.stack)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
app.use('/static/docs', markdownServe.middleware({
|
||||||
|
rootDirectory: pathutil.resource('docs')
|
||||||
|
, view: 'docs'
|
||||||
|
}))
|
||||||
|
|
||||||
app.set('view engine', 'jade')
|
app.set('view engine', 'jade')
|
||||||
app.set('views', pathutil.resource('app/views'))
|
app.set('views', pathutil.resource('app/views'))
|
||||||
app.set('strict routing', true)
|
app.set('strict routing', true)
|
||||||
|
|
|
@ -15,6 +15,7 @@ require.ensure([], function (require) {
|
||||||
require('./menu').name,
|
require('./menu').name,
|
||||||
require('./settings').name,
|
require('./settings').name,
|
||||||
require('./help').name,
|
require('./help').name,
|
||||||
|
require('./docs').name,
|
||||||
require('./../common/lang').name
|
require('./../common/lang').name
|
||||||
])
|
])
|
||||||
.config(function ($routeProvider, $locationProvider) {
|
.config(function ($routeProvider, $locationProvider) {
|
||||||
|
|
19
res/app/docs/docs-controller.js
Normal file
19
res/app/docs/docs-controller.js
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
module.exports = function DocsCtrl($rootScope, $scope, $window, $location) {
|
||||||
|
|
||||||
|
$scope.goBack = function () {
|
||||||
|
$window.history.back()
|
||||||
|
}
|
||||||
|
|
||||||
|
$scope.goHome = function () {
|
||||||
|
$location.path('/docs/en/index')
|
||||||
|
}
|
||||||
|
|
||||||
|
$rootScope.$on("$routeChangeError",
|
||||||
|
function (event, current, previous, rejection) {
|
||||||
|
console.log("ROUTE CHANGE ERROR: " + rejection)
|
||||||
|
console.log('event', event)
|
||||||
|
console.log('current', current)
|
||||||
|
console.log('previous', previous)
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
52
res/app/docs/docs.css
Normal file
52
res/app/docs/docs.css
Normal file
|
@ -0,0 +1,52 @@
|
||||||
|
.stf-docs h1 {
|
||||||
|
/*background: green;*/
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs .widget-container {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs h1 {
|
||||||
|
font-size: 32px;
|
||||||
|
color: #157afb;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs h1 {
|
||||||
|
margin-top: 10px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs h2,
|
||||||
|
.stf-docs h3 {
|
||||||
|
margin-top: 40px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs p,
|
||||||
|
.stf-docs li,
|
||||||
|
.stf-docs a {
|
||||||
|
font-size: 15px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs h1:after,
|
||||||
|
.stf-docs h2:after,
|
||||||
|
.stf-docs h3:after {
|
||||||
|
content: ' ';
|
||||||
|
display: block;
|
||||||
|
margin-top: 10px;
|
||||||
|
margin-bottom: 10px;
|
||||||
|
border: 0;
|
||||||
|
border-top: 1px solid #eee;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs-navigation {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs .docs-back {
|
||||||
|
position: absolute;
|
||||||
|
left: 10px;
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stf-docs .docs-home {
|
||||||
|
border: 1px solid transparent;
|
||||||
|
}
|
14
res/app/docs/index.js
Normal file
14
res/app/docs/index.js
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
require('./docs.css')
|
||||||
|
|
||||||
|
module.exports = angular.module('stf.help.docs', [])
|
||||||
|
.config(['$routeProvider', function ($routeProvider) {
|
||||||
|
|
||||||
|
$routeProvider.when('/docs/:lang/:document*', {
|
||||||
|
templateUrl: function (params) {
|
||||||
|
var document = params.document.replace('.md', '')
|
||||||
|
return '/static/docs/' + params.lang + '/' + document
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}])
|
||||||
|
.controller('DocsCtrl', require('./docs-controller'))
|
|
@ -9,3 +9,4 @@ module.exports = angular.module('stf-ui-language', [
|
||||||
}])
|
}])
|
||||||
.factory('LanguageService', require('./language-service'))
|
.factory('LanguageService', require('./language-service'))
|
||||||
.controller('LanguageCtrl', require('./language-controller'))
|
.controller('LanguageCtrl', require('./language-controller'))
|
||||||
|
//.provider('language', require('./language-service'))
|
||||||
|
|
|
@ -4,6 +4,8 @@ module.exports = function LanguageServiceFactory(
|
||||||
SettingsService
|
SettingsService
|
||||||
, gettextCatalog
|
, gettextCatalog
|
||||||
) {
|
) {
|
||||||
|
// TODO: make this LanguageProvider so it can be used on config
|
||||||
|
|
||||||
var LanguageService = {}
|
var LanguageService = {}
|
||||||
|
|
||||||
function detectLanguage() {
|
function detectLanguage() {
|
||||||
|
|
16
res/app/views/docs.jade
Normal file
16
res/app/views/docs.jade
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
//extends layout
|
||||||
|
block content
|
||||||
|
.row.stf-docs(ng-controller='DocsCtrl')
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
.widget-container.fluid-height
|
||||||
|
.stf-docs-navigation
|
||||||
|
button.btn.btn-primary-outline.docs-back(ng-click='goBack()')
|
||||||
|
i.fa.fa-chevron-left.fa-fw
|
||||||
|
//span Back
|
||||||
|
button.btn.btn-primary-outline.docs-home(ng-click='goHome()')
|
||||||
|
i.fa.fa-home.fa-fw
|
||||||
|
//span Home
|
||||||
|
.widget-content.padded
|
||||||
|
.row
|
||||||
|
.col-md-10.col-md-offset-1
|
||||||
|
!= markdownFile.parseContent()
|
18
res/docs/en/index.md
Normal file
18
res/docs/en/index.md
Normal file
|
@ -0,0 +1,18 @@
|
||||||
|
# STF Documentation
|
||||||
|
|
||||||
|
- Usage
|
||||||
|
- Getting Started
|
||||||
|
- [Remote Debugging](/#!/docs/en/remote-debug)
|
||||||
|
|
||||||
|
- Remote Shell
|
||||||
|
- Browser Navigation
|
||||||
|
- App Uploading
|
||||||
|
- Automation
|
||||||
|
- Appium
|
||||||
|
- Others
|
||||||
|
|
||||||
|
|
||||||
|
- Documentation
|
||||||
|
|
||||||
|
- License
|
||||||
|
- Contributing
|
94
res/docs/en/remote-debug.md
Normal file
94
res/docs/en/remote-debug.md
Normal file
|
@ -0,0 +1,94 @@
|
||||||
|
# Remote Debugging
|
||||||
|
|
||||||
|
## Before starting
|
||||||
|
|
||||||
|
To be able to use the device locally you need to have installed the [Android SDK Tools](https://developer.android.com/sdk/index.html).
|
||||||
|
|
||||||
|
|
||||||
|
## Debugging
|
||||||
|
|
||||||
|
To be able to debug the remote device on a local machine, you need to do the following:
|
||||||
|
|
||||||
|
1. On STF, after controlling a device, go to the **Dashboard** tab -> **Remote Debug** panel.
|
||||||
|
|
||||||
|
2. There will be a text field with content like `adb connect ...`. Click and copy that text.
|
||||||
|
|
||||||
|
3. Paste it and run it your command line.
|
||||||
|
|
||||||
|
This will connect the device locally.
|
||||||
|
|
||||||
|
You can check it worked, by going to your command line and typing:
|
||||||
|
```bash
|
||||||
|
adb devices
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### Android Studio
|
||||||
|
|
||||||
|
You should be able to debug the device, however the IDE still has some bugs when using the debugger.
|
||||||
|
|
||||||
|
|
||||||
|
### Eclipse
|
||||||
|
|
||||||
|
You should be able to debug the device as-is.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Chrome
|
||||||
|
|
||||||
|
#### On the device
|
||||||
|
|
||||||
|
On Chrome 32 and newer, you don't need to do anything on the device.
|
||||||
|
|
||||||
|
On Chrome 32 and earlier, you need to enable USB remote debugging inside *Chrome Settings*:
|
||||||
|
|
||||||
|
1. Open **Chrome**.
|
||||||
|
2. Go to **Settings** -> **Developer Tools**.
|
||||||
|
3. Enable **USB debugging**.
|
||||||
|
|
||||||
|
#### On your desktop browser
|
||||||
|
|
||||||
|
1. Open a new tab
|
||||||
|
2. Go to `chrome://inspect/#devices` on the address bar.
|
||||||
|
3. Enable **Discover USB devices** by clicking the checkbox.
|
||||||
|
|
||||||
|
It should show a list of pages opened inside the Device's Chrome browser and WebViews.
|
||||||
|
|
||||||
|
Now you can debug any page by clicking on **inspect**.
|
||||||
|
|
||||||
|
See more on the [Remote Debugging on Android with Chrome](https://developer.chrome.com/devtools/docs/remote-debugging) docs.
|
||||||
|
|
||||||
|
|
||||||
|
### Firefox
|
||||||
|
|
||||||
|
#### On the device
|
||||||
|
|
||||||
|
1. Open **Firefox**.
|
||||||
|
2. Go to **Settings** -> **Developer tools**.
|
||||||
|
3. Enable **Remote debugging**.
|
||||||
|
|
||||||
|
#### On your command line
|
||||||
|
|
||||||
|
Go to your command line, and type:
|
||||||
|
|
||||||
|
```
|
||||||
|
adb forward tcp:6000 tcp:6000
|
||||||
|
```
|
||||||
|
|
||||||
|
If you are using Firefox OS, type:
|
||||||
|
|
||||||
|
```
|
||||||
|
adb forward tcp:6000 localfilesystem:/data/local/debugger-socket
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
#### On your desktop browser
|
||||||
|
|
||||||
|
1. On the **Web Developer** menu, select **Connect**.
|
||||||
|
2. This will go to `chrome://browser/content/devtools/connect.xhtml`.
|
||||||
|
3. Press the **Connect** button.
|
||||||
|
4. On the device it will ask you to accept an **Incoming Connection**, press **OK**.
|
||||||
|
|
||||||
|
This should show a list of pages opened inside the Device's Firefox browser and WebViews.
|
||||||
|
|
||||||
|
See more on the [Remotely Debugging Firefox for Android](https://developer.mozilla.org/docs/Tools/Remote_Debugging/Firefox_for_Android) docs.
|
4
res/docs/ja/index.md
Normal file
4
res/docs/ja/index.md
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
# STF ドキュメント
|
||||||
|
|
||||||
|
- 利用
|
||||||
|
- [リモートシェル](/#!/docs/ja/remote-shell)
|
110
res/docs/ja/remote-shell.md
Normal file
110
res/docs/ja/remote-shell.md
Normal file
|
@ -0,0 +1,110 @@
|
||||||
|
# リモート・シェル参照
|
||||||
|
|
||||||
|
### ファイル一覧
|
||||||
|
```
|
||||||
|
ls -la
|
||||||
|
```
|
||||||
|
シェル起動直後はディレクトリはルートです。
|
||||||
|
|
||||||
|
|
||||||
|
### パッケージ名列挙
|
||||||
|
|
||||||
|
```
|
||||||
|
pm list packages
|
||||||
|
```
|
||||||
|
インストールされてるアプリのパッケージ名が列挙される。
|
||||||
|
|
||||||
|
パッケージ名を一部しか覚えていないときに `pm list packages [パッケージ名]` のようにフィルタリングすることができる。
|
||||||
|
|
||||||
|
|
||||||
|
### パッケージ削除
|
||||||
|
|
||||||
|
```
|
||||||
|
pm uninstall [パッケージ名]
|
||||||
|
```
|
||||||
|
|
||||||
|
その他のパッケージ・マネジャーのコマンドは [ADB pm | Android Developers](http://developer.android.com/tools/help/adb.html#pm) を参照。
|
||||||
|
|
||||||
|
|
||||||
|
### ファイルの中身
|
||||||
|
|
||||||
|
```
|
||||||
|
cat /sdcard/hoge.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
読み込み権限のあるファイルの中身を簡単に確認するときに使う。
|
||||||
|
|
||||||
|
|
||||||
|
### アプリの起動
|
||||||
|
|
||||||
|
**Activityの起動 (ACTION_VIEW + URL)**
|
||||||
|
|
||||||
|
```
|
||||||
|
am start -a android.intent.action.VIEW -d http://google.com
|
||||||
|
```
|
||||||
|
|
||||||
|
**Activityの起動(クラス名を指定)**
|
||||||
|
|
||||||
|
```
|
||||||
|
am start -n com.hoge.app/.FugaActivity
|
||||||
|
```
|
||||||
|
|
||||||
|
**サービスの起動**
|
||||||
|
|
||||||
|
```
|
||||||
|
am startservice ... # Intentの指定方法はActivityと同じ
|
||||||
|
```
|
||||||
|
|
||||||
|
**ブロードキャストの送信**
|
||||||
|
|
||||||
|
```
|
||||||
|
am broadcast ... # Intentの指定方法はActivityと同じ
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
### キーイベント送信
|
||||||
|
|
||||||
|
```
|
||||||
|
input keyevent 3 # HOMEキー
|
||||||
|
```
|
||||||
|
|
||||||
|
数値でキーコードを指定する。
|
||||||
|
|
||||||
|
キーコードは[KeyEvent | Android Developers](http://developer.android.com/reference/android/view/KeyEvent.html)を参照。
|
||||||
|
|
||||||
|
### 画面録画 (KitKat4.4より)
|
||||||
|
|
||||||
|
最大3分操作情報を録画できる。
|
||||||
|
|
||||||
|
```
|
||||||
|
pre screenrecord [options] <filename>
|
||||||
|
```
|
||||||
|
|
||||||
|
[options]は[ADB screenrecord | Android Developers](http://developer.android.com/tools/help/adb.html#screenrecord)を参照。
|
||||||
|
|
||||||
|
`filename`には端末側のパスを指定する。
|
||||||
|
|
||||||
|
```
|
||||||
|
screenrecord /sdcard/movie/sample.mp4
|
||||||
|
```
|
||||||
|
|
||||||
|
### メモリ専有状況
|
||||||
|
|
||||||
|
```
|
||||||
|
dumpsys procstats [パッケージ名]
|
||||||
|
```
|
||||||
|
|
||||||
|
例: `dumpsys procstats com.android.chrome`
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
|
||||||
|
### その他のシェルコマンド
|
||||||
|
実行可能なシェルコマンドの一覧を取得するのに、下記のコマンドを実行する。
|
||||||
|
|
||||||
|
```
|
||||||
|
ls /system/bin
|
||||||
|
```
|
||||||
|
|
||||||
|
|
||||||
|
もっと詳しいリファレンスは[こちら](https://github.com/jackpal/Android-Terminal-Emulator/wiki/Android-Shell-Command-Reference)。
|
|
@ -47,18 +47,18 @@ module.exports = {
|
||||||
{ test: /\.otf$/, loader: "url-loader?limit=1&mimetype=application/font-woff" },
|
{ test: /\.otf$/, loader: "url-loader?limit=1&mimetype=application/font-woff" },
|
||||||
{ test: /\.ttf$/, loader: "url-loader?limit=1&mimetype=application/font-woff" },
|
{ test: /\.ttf$/, loader: "url-loader?limit=1&mimetype=application/font-woff" },
|
||||||
{ test: /\.eot$/, loader: "url-loader?limit=1&mimetype=vnd.ms-fontobject" },
|
{ test: /\.eot$/, loader: "url-loader?limit=1&mimetype=vnd.ms-fontobject" },
|
||||||
{ test: /\.jade/, loader: 'template-html-loader' },
|
{ test: /\.jade$/, loader: 'template-html-loader' },
|
||||||
{ test: /\.html/, loader: 'html-loader' },
|
{ test: /\.html$/, loader: 'html-loader' },
|
||||||
{ test: /angular\.js/, loader: 'exports?angular'},
|
{ test: /angular\.js$/, loader: 'exports?angular'},
|
||||||
{ test: /angular-route\.js/, loader: 'imports?angular=angular'},
|
{ test: /angular-route\.js$/, loader: 'imports?angular=angular'},
|
||||||
{ test: /angular-touch\.js/, loader: 'imports?angular=angular'},
|
{ test: /angular-touch\.js$/, loader: 'imports?angular=angular'},
|
||||||
{ test: /angular-animate\.js/, loader: 'imports?angular=angular'},
|
{ test: /angular-animate\.js$/, loader: 'imports?angular=angular'},
|
||||||
{ test: /angular-growl\.js/, loader: 'imports?angular=angular'},
|
{ test: /angular-growl\.js$/, loader: 'imports?angular=angular'},
|
||||||
{ test: /oboe-browser\.js/, loader: 'imports?define=>false!exports?oboe'},
|
{ test: /oboe-browser\.js$/, loader: 'imports?define=>false!exports?oboe'},
|
||||||
{ test: /uuid\.js/, loader: 'imports?require=>undefined'},
|
{ test: /uuid\.js$/, loader: 'imports?require=>undefined'},
|
||||||
//{ test: /ui-bootstrap-tpls\.js/, loader: 'script'},
|
//{ test: /ui-bootstrap-tpls\.js$/, loader: 'script'},
|
||||||
{ test: /dialogs\.js/, loader: 'script'},
|
{ test: /dialogs\.js$/, loader: 'script'},
|
||||||
{ test: /bluebird\.js/, loader: 'imports?require=>undefined'}
|
{ test: /bluebird\.js$/, loader: 'imports?require=>undefined'}
|
||||||
],
|
],
|
||||||
noParse: [
|
noParse: [
|
||||||
// pathutil.resource('bower_components')
|
// pathutil.resource('bower_components')
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue