You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by ac...@apache.org on 2017/08/24 14:17:41 UTC

[2/7] incubator-weex git commit: * [test] video

* [test] video


Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/64346c3a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/64346c3a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/64346c3a

Branch: refs/heads/0.16-dev
Commit: 64346c3acdb0898fe7b8f2ed5c85c921116ca1a0
Parents: decd6ca
Author: gurisxie <27...@qq.com>
Authored: Thu Aug 24 18:32:06 2017 +0800
Committer: gurisxie <27...@qq.com>
Committed: Thu Aug 24 18:32:06 2017 +0800

----------------------------------------------------------------------
 test/pages/components/video-property.vue       | 97 +++++++++++++++++++++
 test/scripts/components/video-property.test.js | 45 ++++++++++
 2 files changed, 142 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/64346c3a/test/pages/components/video-property.vue
----------------------------------------------------------------------
diff --git a/test/pages/components/video-property.vue b/test/pages/components/video-property.vue
new file mode 100644
index 0000000..acaf457
--- /dev/null
+++ b/test/pages/components/video-property.vue
@@ -0,0 +1,97 @@
+<template>
+  <div>
+    <panel title = 'video-property' :padding-body='0'>
+      <div>
+        <video class="video" :play-status="dataSource.playStatus"  :auto-play="dataSource.autoPlay" :src = "dataSource.src" @start = "start" @pause = "pause" @finish = "finish" @fail = "fail"></video>
+      </div>
+      <div style='flex-direction:row'> 
+        <button class='mr-base' type="info" size="middle" value="setSrc" @click.native="setSrc"></button>
+        <button class='mr-base' type="info" size="middle" value="setPlay" @click.native="setPlay"></button>
+        <button class='mr-base' type="info" size="middle" value="setPause" @click.native="setPause"></button>
+      </div>
+      <panel title='校验结果:'>
+        <text style="font-size:30px">{{resultTxt}}</text>
+      </panel>
+    </panel>
+    <wxc-desc>
+      <text class='desc'>
+测试点:
+  * video属性更新
+
+测试方式:
+  * 
+  * 
+      </text>
+    </wxc-desc>
+  </div>
+</template>
+<script>
+  module.exports = {
+    data: function(){
+      return{
+        dataSource: {
+            autoPlay: false,
+            playStatus: 'pause',
+            src: 'http://test.mp4'
+        },
+        resultTxt:''
+      }
+    },
+    methods: {
+        start:function(e){
+            console.log('video-start');
+            this.resultTxt = "video-start";
+        },
+        pause:function(){
+            console.log('video-pause');
+            this.resultTxt = "video-pause";
+        },
+        finish:function() {
+            console.log('video-finish');
+            this.resultTxt = "video-finish";
+        },
+        fail:function() {
+            console.log('video-fail');
+            this.resultTxt = "video-fail";
+        },
+        setSrc: function () {
+            console.log('setSrc');
+            this.dataSource.src="http://g.tbcdn.cn/ali-wireless-h5/res/0.0.6/toy.mp4";
+        },
+        setPlay:function(){
+            console.log('setPlay');
+            this.dataSource.playStatus='play';
+        },
+        setPause:function(){
+            console.log('setPause');
+            this.dataSource.playStatus='pause';
+        },
+        setStop:function(){
+            console.log('setStop');
+            this.dataSource.playStatus='stop';
+        },
+    },
+    components: {
+      "wxc-desc":require('../include/wxc-desc.vue'),
+      panel: require('../include/panel.vue'),
+      button: require('../include/button.vue'),
+    }
+  }
+</script>
+
+<style scoped>
+  .video {
+    width: 710; 
+    height: 300;
+    border-style: solid;
+    border-width:1;
+    border-color:#ff0000;
+  }
+  .mr-base{
+    margin: 10px;
+  }
+  .desc{
+    color:#aa0000;
+    font-size: 30px;
+  }
+</style>

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/64346c3a/test/scripts/components/video-property.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/video-property.test.js b/test/scripts/components/video-property.test.js
new file mode 100644
index 0000000..3a6f820
--- /dev/null
+++ b/test/scripts/components/video-property.test.js
@@ -0,0 +1,45 @@
+'use strict';
+
+var _ = require('macaca-utils');
+var assert = require('chai').assert
+var wd = require('weex-wd')
+var path = require('path');
+var os = require('os');
+var util = require("../util.js");
+
+
+var goal = 'video-property';
+var interval = util.getGETActionWaitTimeMills();
+describe('weex '+goal+' test', function () {
+  this.timeout(util.getTimeoutMills());
+  var driver = util.createDriver(wd);
+
+  beforeEach(function () {
+    return util.init(driver)
+      .get(util.getPage('/components/'+goal+'.js'))
+      .waitForElementByName(goal, interval, 2000)
+  });
+
+  afterEach(function () {
+    return util.quit(driver);
+  })
+
+  it('#1 '+goal + ' event', () => {
+    return driver
+      .waitForElementByName("video-fail", interval, 2000)
+      .waitForElementByName("setSrc", interval, 2000)
+      .click()
+      .waitForElementByName("video-pause", interval, 2000)
+      .sleep(1000)
+      .waitForElementByName('setPlay', interval, 2000)
+      .click()
+      .waitForElementByName("video-start", interval, 2000)
+      .waitForElementByName('setPause', interval, 2000)
+      .click()
+      .waitForElementByName("video-pause", interval, 2000)
+      .waitForElementByName('setPlay', interval, 2000)
+      .click()
+      .sleep(5000)
+      .waitForElementByName('video-finish', interval, 2000)
+  })
+});
\ No newline at end of file