You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@weex.apache.org by so...@apache.org on 2017/06/02 02:50:06 UTC

[12/36] incubator-weex git commit: + [test] update testcase

+ [test] update testcase


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

Branch: refs/heads/0.14-dev
Commit: cce536225f304622b1c52aafad53a1f0f3ff89d3
Parents: ca5c57e
Author: moxun.ljf <fu...@foxmail.com>
Authored: Fri May 26 17:35:45 2017 +0800
Committer: moxun.ljf <fu...@foxmail.com>
Committed: Fri May 26 17:35:45 2017 +0800

----------------------------------------------------------------------
 ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m |  2 +-
 test/pages/components/slider-common.vue             |  4 ++--
 test/scripts/components/recycler.test.js            |  6 +++---
 test/scripts/components/slider-common.test.js       | 13 ++++++++++++-
 test/scripts/util.js                                | 12 ++++++++++++
 5 files changed, 30 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cce53622/ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m
----------------------------------------------------------------------
diff --git a/ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m b/ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m
index 946660d..7914dc5 100644
--- a/ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m
+++ b/ios/playground/WeexDemo/WXConfigCenterDefaultImpl.m
@@ -28,7 +28,7 @@
         return @YES;
     }
     if ([keys[0] isEqualToString:@"iOS_weex_ext_config"] && [keys[1] isEqualToString:@"slider_class_name"]){
-        return @"WXCycleSliderComponent";
+        return @"WXSliderComponent";
     }
     if ([keys[0] isEqualToString:@"weex_prerender_config"] && [keys[1] isEqualToString:@"is_switch_on"]){
         return @YES;

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cce53622/test/pages/components/slider-common.vue
----------------------------------------------------------------------
diff --git a/test/pages/components/slider-common.vue b/test/pages/components/slider-common.vue
index 841f5ca..f050b0e 100644
--- a/test/pages/components/slider-common.vue
+++ b/test/pages/components/slider-common.vue
@@ -182,14 +182,14 @@
         }
         this.progress = 233 * this.index + 233 * -ratio;
         this.count++;
-        this.flag = this.count / 100 < this.switchCount;
+        this.flag = this.count <= 100;
       },
       onchange(e) {
         this.goto(parseInt(e.index));
         this.switchCount++;
+        this.count = 0;
       },
       update(index) {
-        console.log('update switch count >>>')
         if (index == 1) {
           this.count1++;
         } else if (index == 2) {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cce53622/test/scripts/components/recycler.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/recycler.test.js b/test/scripts/components/recycler.test.js
index 025fec2..a6eafa8 100644
--- a/test/scripts/components/recycler.test.js
+++ b/test/scripts/components/recycler.test.js
@@ -43,7 +43,7 @@ describe('recycler @ignore-android @ignore-ios', function () {
   });
 
   after(function () {
-      return util.quit(driver); 
+      return util.quit(driver);
   })
 
   let scaleFactor = 0
@@ -361,7 +361,7 @@ describe('recycler @ignore-android @ignore-ios', function () {
     .elementById((isAndroid ? 'cell27' : 'cell28'))
     .click()
     .elementById('stickyText1')
-    .text() 
+    .text()
     .then(text => {
       console.log(text)
       originContentOffset = Number.parseInt(text.replace('Content Offset:-',''))
@@ -391,7 +391,7 @@ describe('recycler @ignore-android @ignore-ios', function () {
       console.log(text)
       originContentOffset = Number.parseInt(text.replace('Content Offset:-',''))
     })
-    .touch('drag', {fromX:recyclerWidth / 2, fromY:screenHeight / 5, toX:recyclerWidth / 2, toY: screenHeight * 4 / 5})
+    .touch('drag', {fromX:recyclerWidth / 2, fromY:screenHeight / 5, toX:recyclerWidth / 2, toY: screenHeight * 4 / 5,duration: 2})
     .elementById('stickyText1')
     .text()
     .then(text => {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cce53622/test/scripts/components/slider-common.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/slider-common.test.js b/test/scripts/components/slider-common.test.js
index 80855cd..c2a7b0c 100644
--- a/test/scripts/components/slider-common.test.js
+++ b/test/scripts/components/slider-common.test.js
@@ -25,10 +25,21 @@ var path = require('path');
 var os = require('os');
 var util = require("../util.js");
 
+const platform = process.env.platform.toLowerCase() || 'android';
+const isAndroid = platform === 'android';
+var dragOption = {};
+
 describe('slider common', function () {
   this.timeout(util.getTimeoutMills());
   var driver = util.createDriver(wd);
 
+  if (isAndroid) {
+    dragOption = {fromX: 1000, toX: -1000, fromY: 700, toY: 700, duration: 5, steps: 100};
+  } else {
+    //TODO: add drag option for iOS
+    dragOption = {fromX:350, fromY:150, toX:650, toY: 150, duration: 2}
+  }
+
   before(function () {
     return util.init(driver)
       .get(util.getPage('/components/slider-common.js'))
@@ -56,7 +67,7 @@ describe('slider common', function () {
         assert.equal(t, '1')
       })
       .elementById('slider_1')
-      .touch('drag', {fromX: 1000, toX: -1000, fromY: 700, toY: 700, duration: 5, steps:100})
+      .swipeLeft(1, 0.4)
       .elementById('s1_f')
       .text()
       .then(t => {

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/cce53622/test/scripts/util.js
----------------------------------------------------------------------
diff --git a/test/scripts/util.js b/test/scripts/util.js
index 00275d7..a56c096 100644
--- a/test/scripts/util.js
+++ b/test/scripts/util.js
@@ -155,6 +155,18 @@ module.exports = {
                     .sleep(1000)
                 })
             })
+          driverFactory.addPromiseChainMethod('swipeLeft', function (distanceRatio, yRatio) {
+                return this
+                  .getWindowSize()
+                  .then(size => {
+                    let y = yRatio * size.height;
+                    let startX = size.width * 0.8;
+                    let endX = startX - size.width * distanceRatio;
+                    return this
+                      .touch('drag', {fromX: startX, toX: endX, fromY: y, toY: y, duration: 1})
+                      .sleep(1000)
+                  })
+          })
             driver = driverFactory.initPromiseChain();
             driver.configureHttp({
                 timeout: 100000