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 06:04:10 UTC
[30/46] incubator-weex git commit: * [test] fix textcase with new
version of macaca
* [test] fix textcase with new version of macaca
Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/230ddb72
Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/230ddb72
Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/230ddb72
Branch: refs/heads/master
Commit: 230ddb729f9e0cd0936e27cc2d1752f824d815a5
Parents: 41c1445
Author: sospartan <so...@apache.org>
Authored: Thu May 18 12:09:36 2017 +0800
Committer: sospartan <so...@apache.org>
Committed: Thu May 18 12:09:50 2017 +0800
----------------------------------------------------------------------
test/scripts/components/scroll-event.test.js | 27 +++++--------------
test/scripts/components/scroller-fixed.test.js | 5 +---
test/scripts/components/text.test.js | 24 ++++++-----------
.../components/textarea-maxlength.test.js | 2 +-
test/scripts/util.js | 28 ++++++++++++++++++--
5 files changed, 42 insertions(+), 44 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/230ddb72/test/scripts/components/scroll-event.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/scroll-event.test.js b/test/scripts/components/scroll-event.test.js
index 1ad1cdb..5df6f75 100644
--- a/test/scripts/components/scroll-event.test.js
+++ b/test/scripts/components/scroll-event.test.js
@@ -42,22 +42,8 @@ describe('list scroll event', function () {
it('#1 Drag list', () => {
return driver
- .touch('drag', {
- fromX: 200,
- fromY: 500,
- toX: 200,
- toY: 200,
- duration: 0.5
- })
- .sleep(2000)
- .touch('drag', {
- fromX:200,
- fromY:600,
- toX:100,
- toY:200,
- duration: 0.5
- })
- .sleep(2000)
+ .dragUp(200)
+ .dragUp(200)
.elementById('status')
.text()
.then((text)=>{
@@ -78,20 +64,19 @@ describe('scroller scroll event', function () {
});
after(function () {
- return util.quit(driver)
+ // return util.quit(driver)
})
it('#1 Drag scroller', () => {
return driver
- .touch('drag', {fromX:200, fromY:500, toX:200, toY: 200})
- .sleep(2000)
- .touch('drag', {fromX:200, fromY:500, toX:100, toY:200})
- .sleep(2000)
+ .dragUp(200)
+ .dragUp(200)
.elementById('status')
.text()
.then((text)=>{
var y = Math.abs(parseInt(text))
+ console.log(`y=${y}`)
assert.equal(y > 200,true)
})
})
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/230ddb72/test/scripts/components/scroller-fixed.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/scroller-fixed.test.js b/test/scripts/components/scroller-fixed.test.js
index 7add2a5..3902be3 100644
--- a/test/scripts/components/scroller-fixed.test.js
+++ b/test/scripts/components/scroller-fixed.test.js
@@ -42,10 +42,7 @@ describe('scroller fixed position item ', function () {
it('#1 position:fixed items', () => {
return driver
- .touch('drag', {fromX:200, fromY:500, toX:200, toY: 400})
- .sleep(2000)
- .touch('drag', {fromX:200, fromY:400, toX:200, toY: 500})
- .sleep(2000)
+ .dragUpAndDown()
.elementByXPath('//scroller[1]/div[1]/text[1]')
.text()
.then((text)=>{
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/230ddb72/test/scripts/components/text.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/text.test.js b/test/scripts/components/text.test.js
index 0c867cf..23028b2 100644
--- a/test/scripts/components/text.test.js
+++ b/test/scripts/components/text.test.js
@@ -49,7 +49,7 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, screenWidth)
assert.closeTo(rect.height, 32 * scaleFactor * 2, 2)
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
@@ -60,7 +60,7 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, screenWidth)
assert.isAtLeast(rect.height, Math.floor(2 * 48 * scaleFactor))
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
@@ -71,7 +71,7 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, Math.floor(300 * scaleFactor))
assert.equal(rect.height, Math.floor(100 * scaleFactor))
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
@@ -82,7 +82,7 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, Math.floor(500 * scaleFactor))
assert.equal(rect.height, Math.floor(300 * scaleFactor))
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
@@ -93,7 +93,7 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, Math.floor(500 * scaleFactor))
assert.closeTo(rect.height, 40 * scaleFactor, 1)
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
@@ -104,28 +104,20 @@ describe('weex text @ignore-ios', function () {
.then(rect => {
assert.equal(rect.width, Math.floor(500 * scaleFactor))
assert.closeTo(rect.height, 300 * scaleFactor, 1)
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
it('#9 flex:1; align-Items: auto; flex-direction:column', () => {
return driver
+ .sleep(2000)
.elementById('flexgrow-column')
.getRect()
.then(rect => {
assert.isBelow(rect.width, 500 * scaleFactor / 2)
assert.closeTo(rect.height, 300 * scaleFactor, 1)
- scroll(rect.height)
+ return driver.dragUp(rect.height)
})
})
- function scroll(height) {
- driver.touch('drag', {
- fromX: 100,
- fromY: 300 + height,
- toX: 100,
- toY: 300,
- duration: 0.5
- })
- }
});
\ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/230ddb72/test/scripts/components/textarea-maxlength.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/textarea-maxlength.test.js b/test/scripts/components/textarea-maxlength.test.js
index d72329d..7473d3d 100644
--- a/test/scripts/components/textarea-maxlength.test.js
+++ b/test/scripts/components/textarea-maxlength.test.js
@@ -25,7 +25,7 @@ var path = require('path');
var os = require('os');
var util = require("../util.js");
-describe('textarea maxlength vue test2 ', function () {
+describe('@ignore-android textarea maxlength vue test2 ', function () {
this.timeout(util.getTimeoutMills());
var driver = util.createDriver(wd);
http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/230ddb72/test/scripts/util.js
----------------------------------------------------------------------
diff --git a/test/scripts/util.js b/test/scripts/util.js
index 81dc100..174d71d 100644
--- a/test/scripts/util.js
+++ b/test/scripts/util.js
@@ -42,7 +42,7 @@ var androidOpts = {
platformName: 'Android',
target: 'android',
slowEnv: isRunInCI,
- app: path.join(__dirname, '..', `../android/playground/app/build/outputs/apk/playground.apk`)
+ app: path.join(__dirname, '..', '../android/playground/app/build/outputs/apk/playground-debug.apk')
};
var androidChromeOpts = {
@@ -131,7 +131,31 @@ module.exports = {
var driver = global._wxDriver;
if(!driver){
console.log('Create new driver');
- driver = wd(this.getConfig()).initPromiseChain();
+ let driverFactory = wd(this.getConfig())
+ driverFactory.addPromiseChainMethod('dragUpAndDown',function(){
+ return this
+ .getWindowSize()
+ .then(size=>{
+ let middleX = size.width * 0.5
+ return this
+ .touch('drag', {fromX:middleX, fromY:size.height*0.7, toX:middleX, toY: size.height*0.3, duration: 1})
+ .sleep(1000)
+ .touch('drag', {fromX:middleX, fromY:size.height*0.3, toX:middleX, toY: size.height*0.7, duration: 1})
+ .sleep(1000)
+ })
+ })
+ driverFactory.addPromiseChainMethod('dragUp',function(distance){
+ return this
+ .getWindowSize()
+ .then(size=>{
+ let middleX = size.width * 0.5
+ let startY = size.height * 0.7
+ return this
+ .touch('drag', {fromX:middleX, fromY:startY+distance, toX:middleX, toY: startY, duration: 1})
+ .sleep(1000)
+ })
+ })
+ driver = driverFactory.initPromiseChain();
driver.configureHttp({
timeout: 100000
});