Repository: incubator-weex Updated Branches: refs/heads/0.16-dev 781296f44 -> 05c3fc337
* [test] update tc for stable Project: http://git-wip-us.apache.org/repos/asf/incubator-weex/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-weex/commit/23fd3bf0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-weex/tree/23fd3bf0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-weex/diff/23fd3bf0 Branch: refs/heads/0.16-dev Commit: 23fd3bf04ec896057e259e0041645ae0db9181fd Parents: 6f15eb0 Author: gurisxie <279483...@qq.com> Authored: Mon Aug 28 15:45:15 2017 +0800 Committer: gurisxie <279483...@qq.com> Committed: Mon Aug 28 15:45:15 2017 +0800 ---------------------------------------------------------------------- test/pages/attributes/dom-operation.vue | 33 +++++++ test/pages/components/image-onload.vue | 65 +++++++++++++ test/pages/components/list-scroll.vue | 33 +++++++ test/pages/components/scroller-scroll.vue | 31 +++++++ test/pages/components/slider-infinite.vue | 54 +++++++++++ test/pages/dom-operation.vue | 33 ------- test/pages/image-onload.vue | 31 ------- test/pages/index.vue | 30 ------ test/pages/list-scroll.vue | 33 ------- test/pages/scroller-scroll.vue | 31 ------- test/pages/slider-infinite.vue | 54 ----------- test/scripts/attributes/compositing.test.js | 5 +- test/scripts/attributes/dom.test.js | 98 ++++++++++++++++++++ test/scripts/components/a-src.test.js | 2 +- test/scripts/components/iconfont.test.js | 2 +- test/scripts/components/image-onload.test.js | 32 ++----- test/scripts/components/input-event.test.js | 2 +- test/scripts/components/recycler.test.js | 20 +++- test/scripts/components/refresh-loading.test.js | 12 +-- test/scripts/components/scroll-event.test.js | 6 +- test/scripts/components/slider-infinite.test.js | 2 +- test/scripts/components/switch-event.test.js | 2 +- test/scripts/components/video-property.test.js | 2 +- test/scripts/components/web-event.test.js | 2 +- test/scripts/dom.test.js | 98 -------------------- .../scripts/modules/animation-translate.test.js | 5 +- test/scripts/modules/clipboard-event.test.js | 5 +- test/scripts/modules/gesture-longpress.test.js | 5 +- test/scripts/modules/modal-event.test.js | 5 +- test/scripts/modules/picker-event.test.js | 5 +- 30 files changed, 371 insertions(+), 367 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/attributes/dom-operation.vue ---------------------------------------------------------------------- diff --git a/test/pages/attributes/dom-operation.vue b/test/pages/attributes/dom-operation.vue new file mode 100644 index 0000000..334803d --- /dev/null +++ b/test/pages/attributes/dom-operation.vue @@ -0,0 +1,33 @@ +<template> + <scroller> + <text v-if="display" test-id="maynotexist">item</text> + <div v-for="item in repeat_items"> + <text :test-id="'item'+item">repeat item:{{item}}</text> + </div> + <text test-id="btn1" @click="onclick">display</text> + <text test-id="status" @click="onclick2">display</text> + <text test-id="status2" @click="onclick3">{{text}}</text> + </scroller> +</template> +<script> + module.exports = { + data:function(){ + return { + display:false, + repeat_items:[1,2,3,4,5], + text:"display" + } + }, + methods:{ + onclick:function(){ + this.display=true; + this.repeat_items.push(6); + }, + onclick2:function(){ + this.display = false; + this.repeat_items.pop(); + this.text = "finished" + } + } + } +</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/components/image-onload.vue ---------------------------------------------------------------------- diff --git a/test/pages/components/image-onload.vue b/test/pages/components/image-onload.vue new file mode 100644 index 0000000..2509c0e --- /dev/null +++ b/test/pages/components/image-onload.vue @@ -0,0 +1,65 @@ +<template> + <div> + <panel title = 'image-onload' :padding-body='0'> + <div style='flex-direction:row'> + <image class='mr-base' style="width: 300;height: 300;" src="https://gw.alicdn.com/tps/TB1bEMYKXXXXXaLaXXXXXXXXXXX-360-388.png" @load="onload"></image> + <image class='mr-base' style="width: 300;height: 300;border-width:2px;" src="https://cn.vuejs.org/images/logo.png1" @load="onloadFailed"></image> + </div> + <panel title='æ ¡éªç»æï¼'> + <text test-id='imgSize' style="font-size:30px">{{size}}</text> + <text test-id='download' style="font-size:30">{{download}}</text> + </panel> + </panel> + <wxc-desc> + <text class='desc'> +æµè¯ç¹ï¼ + * + +æµè¯æ¹å¼ï¼ + * + * + </text> + </wxc-desc> + </div> +</template> +<script> + module.exports = { + data : { + size:"-1,-1", + download:'success' + }, + components: { + "wxc-desc":require('../include/wxc-desc.vue'), + panel: require('../include/panel.vue'), + button: require('../include/button.vue'), + }, + methods : { + onload : function(e) { + nativeLog(JSON.stringify(e)) + this.size = e.size.naturalWidth + ',' + e.size.naturalHeight; + }, + onloadFailed:function(e) { + if (e.success){ + this.download = 'success'; + }else { + this.download ='failed'; + } + } + } + } +</script> + +<style scoped> + .mr-base{ + margin: 10px; + } + .desc{ + color:#aa0000; + font-size: 30px; + } + .input{ + width: 500px; + height:100px; + border-width: 1px; + } +</style> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/components/list-scroll.vue ---------------------------------------------------------------------- diff --git a/test/pages/components/list-scroll.vue b/test/pages/components/list-scroll.vue new file mode 100644 index 0000000..0a264b7 --- /dev/null +++ b/test/pages/components/list-scroll.vue @@ -0,0 +1,33 @@ +<template> + <list style="background-color: beige; width: 750px; height: 900px" offset-accuracy="10" @scroll="onscroll"> + <header><text test-id="status" ref="status" style="font-size: 40px;">{{status}}</text></header> + <cell v-for="(index, row) in rows" :key="index" style="padding: 10px;"> + <text style="width: 750px; height: 150px; background-color: aqua"> + {{row.id}} + </text> + </cell> + </list> + +</template> + +<script> + module.exports = { + data: function(){ + return { + rows: [], + status: '-' + } + }, + created: function () { + for (var i = 0; i < 20; i++) { + this.rows.push({"id": "Cell " + i}); + } + }, + methods: { + + onscroll: function (e) { + this.status = e.contentOffset.y; + } + } + } +</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/components/scroller-scroll.vue ---------------------------------------------------------------------- diff --git a/test/pages/components/scroller-scroll.vue b/test/pages/components/scroller-scroll.vue new file mode 100644 index 0000000..81335a4 --- /dev/null +++ b/test/pages/components/scroller-scroll.vue @@ -0,0 +1,31 @@ +<template> + <scroller style="background-color: beige; width: 750px; height: 900px" offset-accuracy="10" @scroll="onscroll"> + <text style="font-size: 40px;position:fixed;top:0;left:0;" test-id="status">{{status}}</text> + <div v-for="row in rows" style="padding: 10px;"> + <text style="width: 750px; height: 150px; background-color: aqua"> + {{row.id}} + </text> + </div> + </scroller> +</template> + +<script> + export default { + data: function(){ + return { + rows: [], + status: '-' + } + }, + created: function () { + for (var i = 0; i < 20; i++) { + this.rows.push({"id": "Row " + i}); + } + }, + methods: { + onscroll: function (e) { + this.status = e.contentOffset.y; + } + } + } +</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/components/slider-infinite.vue ---------------------------------------------------------------------- diff --git a/test/pages/components/slider-infinite.vue b/test/pages/components/slider-infinite.vue new file mode 100644 index 0000000..726e376 --- /dev/null +++ b/test/pages/components/slider-infinite.vue @@ -0,0 +1,54 @@ +<template> + <scroller> + <text test-id="txt1">{{d1}}</text> + <slider auto-play="true" @change="change" style="width: 750px;height: 400px;background-color: blue" interval="500" infinite="false"> + <div style="flex: 1;background-color: beige;align-items: center;" v-for="item in items"> + <text style="font-size: 60px;"> + {{item}} + </text> + </div> + <indicator style="height: 20px"></indicator> + </slider> + + <text test-id="txt2" style="margin-top:60">{{d2}}</text> + <slider :auto-play="is_auto" @change="change2" style="width: 750px;height: 400px;background-color: blue;" interval="500"> + <div style="flex: 1;background-color: beige;align-items: center;" v-for="item in items"> + <text style="font-size: 60px;"> + {{item}} + </text> + </div> + <indicator style="height: 20px"></indicator> + </slider> + </scroller> +</template> + +<script> + var itemCount = 2; + module.exports = { + data: function(){ + return { + d1:0, + d2:0, + items: [], + is_auto: true + } + }, + created: function () { + for (var index = 0; index < itemCount ; index++) { + this.items[index] = 'Page: ' + index; + } + let self = this + setTimeout(function(){ + self.is_auto = false + },5000); + }, + methods: { + change: function(e){ + this.d1 = parseInt(this.d1) + 1; + }, + change2: function(e) { + this.d2 = parseInt(this.d2) + 1; + } + } + } +</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/dom-operation.vue ---------------------------------------------------------------------- diff --git a/test/pages/dom-operation.vue b/test/pages/dom-operation.vue deleted file mode 100644 index 334803d..0000000 --- a/test/pages/dom-operation.vue +++ /dev/null @@ -1,33 +0,0 @@ -<template> - <scroller> - <text v-if="display" test-id="maynotexist">item</text> - <div v-for="item in repeat_items"> - <text :test-id="'item'+item">repeat item:{{item}}</text> - </div> - <text test-id="btn1" @click="onclick">display</text> - <text test-id="status" @click="onclick2">display</text> - <text test-id="status2" @click="onclick3">{{text}}</text> - </scroller> -</template> -<script> - module.exports = { - data:function(){ - return { - display:false, - repeat_items:[1,2,3,4,5], - text:"display" - } - }, - methods:{ - onclick:function(){ - this.display=true; - this.repeat_items.push(6); - }, - onclick2:function(){ - this.display = false; - this.repeat_items.pop(); - this.text = "finished" - } - } - } -</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/image-onload.vue ---------------------------------------------------------------------- diff --git a/test/pages/image-onload.vue b/test/pages/image-onload.vue deleted file mode 100644 index 7d0167c..0000000 --- a/test/pages/image-onload.vue +++ /dev/null @@ -1,31 +0,0 @@ -<template> - <scroller style='alignItems:center'> - <image style="width: 500;height: 500;" src="https://gw.alicdn.com/tps/TB1bEMYKXXXXXaLaXXXXXXXXXXX-360-388.png" @load="onload"></image> - <text test-id='imgSize' style="font-size:30">{{size}}</text> - <image style="width: 300;height: 300;border-width:2px;" src="https://cn.vuejs.org/images/logo.png1" @load="onloadFailed"></image> - <text test-id='download' style="font-size:30">{{download}}</text> - </scroller> -</template> -<script> - module.exports = { - data : function(){ - return { - size:"-1,-1", - download:'success' - } - }, - methods : { - onload : function(e) { - nativeLog(JSON.stringify(e)) - this.size = e.size.naturalWidth + ',' + e.size.naturalHeight; - }, - onloadFailed:function(e) { - if (e.success){ - this.download = 'success'; - }else { - this.download ='failed'; - } - } - } - } -</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/index.vue ---------------------------------------------------------------------- diff --git a/test/pages/index.vue b/test/pages/index.vue deleted file mode 100644 index 2ede5f5..0000000 --- a/test/pages/index.vue +++ /dev/null @@ -1,30 +0,0 @@ -<template> - <scroller> - <text test-id="title">hello world.</text> - <input ref="input" test-id="input" value="input" @blur="onblur"></input> - <text style="color:red" test-id="status">{{status}}</text> - <text @click="onclick" test-id="button">button</text> - <text @click="toggleblur" test-id="button2">blur input</text> - </scroller> -</template> -<script> - export default { - data:function(){ - return { - status:"___" - } - }, - methods:{ - onclick:function(e){ - this.status = "btn click." - }, - toggleblur:function(e){ - this.$refs.input.blur(); - // this.$el("input").blur(); - }, - onblur:function(e){ - this.status = "input blur." - } - } - } -</script> http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/list-scroll.vue ---------------------------------------------------------------------- diff --git a/test/pages/list-scroll.vue b/test/pages/list-scroll.vue deleted file mode 100644 index 0a264b7..0000000 --- a/test/pages/list-scroll.vue +++ /dev/null @@ -1,33 +0,0 @@ -<template> - <list style="background-color: beige; width: 750px; height: 900px" offset-accuracy="10" @scroll="onscroll"> - <header><text test-id="status" ref="status" style="font-size: 40px;">{{status}}</text></header> - <cell v-for="(index, row) in rows" :key="index" style="padding: 10px;"> - <text style="width: 750px; height: 150px; background-color: aqua"> - {{row.id}} - </text> - </cell> - </list> - -</template> - -<script> - module.exports = { - data: function(){ - return { - rows: [], - status: '-' - } - }, - created: function () { - for (var i = 0; i < 20; i++) { - this.rows.push({"id": "Cell " + i}); - } - }, - methods: { - - onscroll: function (e) { - this.status = e.contentOffset.y; - } - } - } -</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/scroller-scroll.vue ---------------------------------------------------------------------- diff --git a/test/pages/scroller-scroll.vue b/test/pages/scroller-scroll.vue deleted file mode 100644 index 81335a4..0000000 --- a/test/pages/scroller-scroll.vue +++ /dev/null @@ -1,31 +0,0 @@ -<template> - <scroller style="background-color: beige; width: 750px; height: 900px" offset-accuracy="10" @scroll="onscroll"> - <text style="font-size: 40px;position:fixed;top:0;left:0;" test-id="status">{{status}}</text> - <div v-for="row in rows" style="padding: 10px;"> - <text style="width: 750px; height: 150px; background-color: aqua"> - {{row.id}} - </text> - </div> - </scroller> -</template> - -<script> - export default { - data: function(){ - return { - rows: [], - status: '-' - } - }, - created: function () { - for (var i = 0; i < 20; i++) { - this.rows.push({"id": "Row " + i}); - } - }, - methods: { - onscroll: function (e) { - this.status = e.contentOffset.y; - } - } - } -</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/pages/slider-infinite.vue ---------------------------------------------------------------------- diff --git a/test/pages/slider-infinite.vue b/test/pages/slider-infinite.vue deleted file mode 100644 index 726e376..0000000 --- a/test/pages/slider-infinite.vue +++ /dev/null @@ -1,54 +0,0 @@ -<template> - <scroller> - <text test-id="txt1">{{d1}}</text> - <slider auto-play="true" @change="change" style="width: 750px;height: 400px;background-color: blue" interval="500" infinite="false"> - <div style="flex: 1;background-color: beige;align-items: center;" v-for="item in items"> - <text style="font-size: 60px;"> - {{item}} - </text> - </div> - <indicator style="height: 20px"></indicator> - </slider> - - <text test-id="txt2" style="margin-top:60">{{d2}}</text> - <slider :auto-play="is_auto" @change="change2" style="width: 750px;height: 400px;background-color: blue;" interval="500"> - <div style="flex: 1;background-color: beige;align-items: center;" v-for="item in items"> - <text style="font-size: 60px;"> - {{item}} - </text> - </div> - <indicator style="height: 20px"></indicator> - </slider> - </scroller> -</template> - -<script> - var itemCount = 2; - module.exports = { - data: function(){ - return { - d1:0, - d2:0, - items: [], - is_auto: true - } - }, - created: function () { - for (var index = 0; index < itemCount ; index++) { - this.items[index] = 'Page: ' + index; - } - let self = this - setTimeout(function(){ - self.is_auto = false - },5000); - }, - methods: { - change: function(e){ - this.d1 = parseInt(this.d1) + 1; - }, - change2: function(e) { - this.d2 = parseInt(this.d2) + 1; - } - } - } -</script> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/attributes/compositing.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/attributes/compositing.test.js b/test/scripts/attributes/compositing.test.js index ee1d25e..74b3d73 100644 --- a/test/scripts/attributes/compositing.test.js +++ b/test/scripts/attributes/compositing.test.js @@ -27,7 +27,7 @@ var assert = require('chai').assert describe('compositing test', function () { this.timeout(util.getTimeoutMills()); var driver = util.createDriver(wd); - + var maxW = util.getGETActionWaitTimeMills(); if (process.env.platform !== 'ios') { return; } @@ -41,10 +41,9 @@ describe('compositing test', function () { return util.quit(driver); }) - it('#1 compositing screenshot diff', () => { return driver - .waitForElementById('test-text',util.getGETActionWaitTimeMills() + 2000,1000) + .waitForElementById('test-text',maxW + 2000,1000) .takeScreenshot() .then(imgData => { var newImg = new Buffer(imgData, 'base64'); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/attributes/dom.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/attributes/dom.test.js b/test/scripts/attributes/dom.test.js new file mode 100644 index 0000000..2a75002 --- /dev/null +++ b/test/scripts/attributes/dom.test.js @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you under the Apache License, Version 2.0 (the + * "License"); you may not use this file except in compliance + * with the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, + * software distributed under the License is distributed on an + * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY + * KIND, either express or implied. See the License for the + * specific language governing permissions and limitations + * under the License. + */ +'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"); + +describe('dom-operation', function () { + this.timeout(util.getTimeoutMills()); + var driver = util.createDriver(wd); + var maxW = util.getGETActionWaitTimeMills(); + beforeEach(function () { + return util.init(driver) + .get(util.getPage('/attributes/dom-operation.js')) + }); + + afterEach(function () { + return util.quit(driver) + }) + + it('#1 Repeat', ()=>{ + return driver + .waitForElementById('status',maxW,1000) + .elementById("item5") + .then((elem)=>{ + assert.notEqual(elem ,undefined) + }) + .elementById("maynotexist") + .then((noexist)=>{ + assert.equal(noexist,undefined) + }) + }) + + it('#2 Add new item', ()=>{ + return driver + .waitForElementById('status',maxW,1000) + .elementById("btn1") + .click() + .sleep(2000) + .elementById("item6") + .then((elem)=>{ + assert.notEqual(elem ,undefined) + }) + .elementById("maynotexist") + .then((existed)=>{ + assert.notEqual(existed,undefined) + }) + }) + + it('#3 Remove item', ()=>{ + return driver + .waitForElementById('status',maxW,1000) + .click() + .sleep(2000) + .elementById("item6") + .then((elem)=>{ + assert.equal(elem,undefined) + }) + .elementById("maynotexist") + .then((noexist)=>{ + assert.equal(noexist,undefined) + }) + }) + + it('#4 Update DOM attr', ()=>{ + return driver + .waitForElementById('status',maxW,1000) + .click() + .sleep(2000) + .elementById("status2") + .text() + .then((text)=>{ + assert.equal("finished",text); + }) + }) + + +}); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/a-src.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/a-src.test.js b/test/scripts/components/a-src.test.js index 8709895..d4049d9 100644 --- a/test/scripts/components/a-src.test.js +++ b/test/scripts/components/a-src.test.js @@ -14,7 +14,6 @@ describe('a-src-test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/a-src.js')) - .waitForElementByName("a-src",maxWt,2000) }); afterEach(function () { @@ -23,6 +22,7 @@ describe('a-src-test', function () { it('#1 Click A tag itself', () => { return driver + .waitForElementByName("a-src",maxWt,2000) .waitForElementById('a-itself', maxWt, 2000) .click() .waitForElementByName('a-support-href1', maxWt, 2000) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/iconfont.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/iconfont.test.js b/test/scripts/components/iconfont.test.js index eea46f8..46d5cc3 100644 --- a/test/scripts/components/iconfont.test.js +++ b/test/scripts/components/iconfont.test.js @@ -18,7 +18,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName(goal, interval, 2000) }); afterEach(function () { @@ -28,6 +27,7 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { //TODO ï¼æªå¾æ¯å¯¹ return driver.waitForElementByName('change', interval, 2000) + .waitForElementByName(goal, interval, 2000) .click() .sleep(500); }) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/image-onload.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/image-onload.test.js b/test/scripts/components/image-onload.test.js index 74f4dc7..59b49da 100644 --- a/test/scripts/components/image-onload.test.js +++ b/test/scripts/components/image-onload.test.js @@ -25,43 +25,27 @@ var path = require('path'); var os = require('os'); var util = require("../util.js"); -describe('image onload @ignore-ios', function () { +var goal = 'image-onload'; +var maxW = 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('/image-onload.js')) - .waitForElementById('imgSize',util.getGETActionWaitTimeMills(),1000) + .get(util.getPage('/components/'+goal+'.js')) }); afterEach(function () { return util.quit(driver); }) - - it('#1 download image', () => { + it('image onload success and failed', () => { return driver - .sleep(5000) - .elementById('imgSize') - .text() - .then((text)=>{ - if(text == '-1,-1') { - return; - } - assert.equal(text, '360,388') - }) + .waitForElementByName(goal, maxW, 2000) + .waitForElementByName('360,388',maxW, 2000) + .waitForElementByName('failed',maxW, 2000) }); - - it('#2 test download image failed event', () => { - return driver - .sleep(5000) - .elementById('download') - .text() - .then((text)=>{ - assert.equal(text, 'failed') - }) - }) }); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/input-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/input-event.test.js b/test/scripts/components/input-event.test.js index 4ceeac6..e7393c1 100644 --- a/test/scripts/components/input-event.test.js +++ b/test/scripts/components/input-event.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName(goal, interval, 2000) }); afterEach(function () { @@ -26,6 +25,7 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { return driver + .waitForElementByName(goal, interval, 2000) .waitForElementById("input-obj", interval, 2000) .sendKeys('testInput') .sleep(500) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/recycler.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/recycler.test.js b/test/scripts/components/recycler.test.js index f54a8fd..2d15fbc 100644 --- a/test/scripts/components/recycler.test.js +++ b/test/scripts/components/recycler.test.js @@ -35,11 +35,11 @@ const isApproximate = (x, y) => { describe('recycler @ignore-android @ignore-ios', function () { this.timeout(util.getTimeoutMills()) const driver = util.createDriver(wd) + var maxW = util.getGETActionWaitTimeMills(); beforeEach(function () { return util.init(driver) .get(util.getPage('/components/recycler.js')) - .waitForElementById('waterfall',util.getGETActionWaitTimeMills(),1000) }); afterEach(function () { @@ -54,6 +54,7 @@ describe('recycler @ignore-android @ignore-ios', function () { let cell2Height = 0 it('#1 test recyler layout', () => { return driver + .waitForElementById('waterfall',maxW,1000) .getWindowSize() .then(size=>{ scaleFactor = size.width / 750 @@ -130,6 +131,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#2 test column count', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('cell2') .click() .elementById('cell0') @@ -171,6 +173,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#3 test column gap', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('cell1') .click() .elementById('cell0') @@ -213,7 +216,8 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#4 test column width', () => { return driver - .elementById('cell0') + .waitForElementById('waterfall',maxW,1000) + .elementById('cell0') .click() .elementById('cell0') .getRect() @@ -240,6 +244,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#5 test deleting header', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('header2') .click() .elementById('header1') @@ -256,7 +261,8 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#6 test footer', () => { return driver - .elementById('fixed1') + .waitForElementById('waterfall',maxW,1000) + .elementById('fixed1') .click() .sleep(500) .elementById('footer1') @@ -272,7 +278,8 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#7 test sticky and fixed', () => { return driver - .elementById('fixed1') + .waitForElementById('waterfall',maxW,1000) + .elementById('fixed1') .getRect() .then((rect)=>{ console.log(`fixed rect:${JSON.stringify(rect)}`) @@ -294,6 +301,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#8 test removing cell', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('cell28') .click() .elementById('cell27') @@ -308,6 +316,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#9 test moving cell', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('cell29') .click() .elementById('fixed1') @@ -323,6 +332,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#10 test recycler padding', () => { return driver + .waitForElementById('waterfall',maxW,1000) .elementById('cell26') .click() .elementById('fixed1') @@ -358,6 +368,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#11 test onscroll', () => { let originContentOffset = 0 return driver + .waitForElementById('waterfall',maxW,1000) .elementById((isAndroid ? 'cell27' : 'cell28')) .click() .elementById('stickyText1') @@ -383,6 +394,7 @@ describe('recycler @ignore-android @ignore-ios', function () { it('#12 test scrollable', () => { let originContentOffset = 0 return driver + .waitForElementById('waterfall',maxW,1000) .elementById((isAndroid ? 'cell25' : 'cell26')) .click() .elementById('stickyText1') http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/refresh-loading.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/refresh-loading.test.js b/test/scripts/components/refresh-loading.test.js index f8adb82..8962915 100644 --- a/test/scripts/components/refresh-loading.test.js +++ b/test/scripts/components/refresh-loading.test.js @@ -11,11 +11,10 @@ var goal = 'refresh-loading'; describe('weex '+goal+' test', function () { this.timeout(util.getTimeoutMills()); var driver = util.createDriver(wd); - + var maxW = util.getGETActionWaitTimeMills(); beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName("refresh:hide", util.getGETActionWaitTimeMills(), 2000) }); afterEach(function () { @@ -24,15 +23,16 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { return driver + .waitForElementByName("refresh:hide", maxW, 2000) .drag('toUp',0.4) - .waitForElementByName("refresh:show", util.getGETActionWaitTimeMills(), 2000) + .waitForElementByName("refresh:show", maxW, 2000) .waitForElementByName("hideRefresh").click() - .waitForElementByName("refresh:hide", util.getGETActionWaitTimeMills(), 2000) + .waitForElementByName("refresh:hide", maxW, 2000) .drag('toDown',0.4) .drag('toDown',0.4) - .waitForElementByName("loading:show", util.getGETActionWaitTimeMills(), 2000) + .waitForElementByName("loading:show", maxW, 2000) .waitForElementByName("hideLoading").click() - .waitForElementByName("loading:hide", util.getGETActionWaitTimeMills(), 2000) + .waitForElementByName("loading:hide", maxW, 2000) }) }); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/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 108a559..9b7aa6c 100644 --- a/test/scripts/components/scroll-event.test.js +++ b/test/scripts/components/scroll-event.test.js @@ -28,10 +28,10 @@ var util = require("../util.js"); describe('list scroll event', function () { this.timeout(util.getTimeoutMills()); var driver = util.createDriver(wd); - + var maxW = util.getGETActionWaitTimeMills(); beforeEach(function () { return util.init(driver) - .get(util.getPage('/list-scroll.js')) + .get(util.getPage('/components/list-scroll.js')) }); afterEach(function () { @@ -42,7 +42,7 @@ describe('list scroll event', function () { it('#1 Drag list', () => { return driver .sleep(1000) - .waitForElementById('status',util.getGETActionWaitTimeMills(),1000) + .waitForElementById('status',maxW,1000) .dragUp(200) .dragUp(200) .elementById('status') http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/slider-infinite.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/slider-infinite.test.js b/test/scripts/components/slider-infinite.test.js index 0d1c62d..d96fe2c 100644 --- a/test/scripts/components/slider-infinite.test.js +++ b/test/scripts/components/slider-infinite.test.js @@ -31,7 +31,7 @@ describe('slider infinite scroll', function () { beforeEach(function () { return util.init(driver) - .get(util.getPage('/slider-infinite.js')) + .get(util.getPage('/components/slider-infinite.js')) }); afterEach(function () { http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/switch-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/switch-event.test.js b/test/scripts/components/switch-event.test.js index b8bdbc0..95db388 100644 --- a/test/scripts/components/switch-event.test.js +++ b/test/scripts/components/switch-event.test.js @@ -18,7 +18,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName(goal, interval, 2000) }); afterEach(function () { @@ -27,6 +26,7 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { return driver + .waitForElementByName(goal, interval, 2000) .waitForElementById(switchTag, interval, 2000) .click() .waitForElementByName('change response:true', interval, 2000) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/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 index 4f433cf..014d807 100644 --- a/test/scripts/components/video-property.test.js +++ b/test/scripts/components/video-property.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName(goal, interval, 2000) }); afterEach(function () { @@ -26,6 +25,7 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { return driver + .waitForElementByName(goal, interval, 2000) // .waitForElementByName("video-fail", interval, 2000) //androidæªè§¦å .waitForElementByName("setSrc", interval, 2000) .click() http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/components/web-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/components/web-event.test.js b/test/scripts/components/web-event.test.js index af9f2fc..a7f4b36 100644 --- a/test/scripts/components/web-event.test.js +++ b/test/scripts/components/web-event.test.js @@ -16,7 +16,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/components/'+goal+'.js')) - .waitForElementByName(goal, interval, 2000) }); afterEach(function () { @@ -25,6 +24,7 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { return driver + .waitForElementByName(goal, interval, 2000) .waitForElementByName('page finish', interval, 2000) }) }); \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/dom.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/dom.test.js b/test/scripts/dom.test.js deleted file mode 100644 index 484f732..0000000 --- a/test/scripts/dom.test.js +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Licensed to the Apache Software Foundation (ASF) under one - * or more contributor license agreements. See the NOTICE file - * distributed with this work for additional information - * regarding copyright ownership. The ASF licenses this file - * to you under the Apache License, Version 2.0 (the - * "License"); you may not use this file except in compliance - * with the License. You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, - * software distributed under the License is distributed on an - * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY - * KIND, either express or implied. See the License for the - * specific language governing permissions and limitations - * under the License. - */ -'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"); - -describe('dom-operation', function () { - this.timeout(util.getTimeoutMills()); - var driver = util.createDriver(wd); - - beforeEach(function () { - return util.init(driver) - .get(util.getPage('/dom-operation.js')) - }); - - afterEach(function () { - return util.quit(driver) - }) - - it('#1 Repeat', ()=>{ - return driver - .waitForElementById('status',util.getGETActionWaitTimeMills(),1000) - .elementById("item5") - .then((elem)=>{ - assert.notEqual(elem ,undefined) - }) - .elementById("maynotexist") - .then((noexist)=>{ - assert.equal(noexist,undefined) - }) - }) - - it('#2 Add new item', ()=>{ - return driver - .waitForElementById('status',util.getGETActionWaitTimeMills(),1000) - .elementById("btn1") - .click() - .sleep(2000) - .elementById("item6") - .then((elem)=>{ - assert.notEqual(elem ,undefined) - }) - .elementById("maynotexist") - .then((existed)=>{ - assert.notEqual(existed,undefined) - }) - }) - - it('#3 Remove item', ()=>{ - return driver - .waitForElementById('status',util.getGETActionWaitTimeMills(),1000) - .click() - .sleep(2000) - .elementById("item6") - .then((elem)=>{ - assert.equal(elem,undefined) - }) - .elementById("maynotexist") - .then((noexist)=>{ - assert.equal(noexist,undefined) - }) - }) - - it('#4 Update DOM attr', ()=>{ - return driver - .waitForElementById('status',util.getGETActionWaitTimeMills(),1000) - .click() - .sleep(2000) - .elementById("status2") - .text() - .then((text)=>{ - assert.equal("finished",text); - }) - }) - - -}); http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/modules/animation-translate.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/animation-translate.test.js b/test/scripts/modules/animation-translate.test.js index 95a9f54..78305fc 100644 --- a/test/scripts/modules/animation-translate.test.js +++ b/test/scripts/modules/animation-translate.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/modules/'+goal+'.js')) - .waitForElementByName(goal, timeout, 2000) }); afterEach(function () { @@ -26,7 +25,9 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { //TODO ï¼æªå¾æ¯å¯¹ - return driver.waitForElementByName('translate', timeout, 2000) + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('translate', timeout, 2000) .click() .waitForElementByName('translateç»æ') .waitForElementByName('translateX', timeout, 2000) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/modules/clipboard-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/clipboard-event.test.js b/test/scripts/modules/clipboard-event.test.js index b61e8f3..91c12cd 100644 --- a/test/scripts/modules/clipboard-event.test.js +++ b/test/scripts/modules/clipboard-event.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/modules/'+goal+'.js')) - .waitForElementByName(goal, timeout, 2000) }); afterEach(function () { @@ -26,7 +25,9 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { //TODO ï¼æªå¾æ¯å¯¹ - return driver.waitForElementByName('setItem', timeout, 2000) + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('setItem', timeout, 2000) .click() .waitForElementByName('getItem', timeout, 2000) .click() http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/modules/gesture-longpress.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/gesture-longpress.test.js b/test/scripts/modules/gesture-longpress.test.js index e6b92e8..6a8f94c 100644 --- a/test/scripts/modules/gesture-longpress.test.js +++ b/test/scripts/modules/gesture-longpress.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/modules/'+goal+'.js')) - .waitForElementByName(goal, timeout, 2000) }); afterEach(function () { @@ -25,7 +24,9 @@ describe('weex '+goal+' test', function () { }) it('#1 '+goal + ' event', () => { - return driver.waitForElementByName('longpress', timeout, 2000) + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('longpress', timeout, 2000) .touch('press', { duration: 2 }) .sleep(1000) .waitForElementById('result',timeout,1000) http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/modules/modal-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/modal-event.test.js b/test/scripts/modules/modal-event.test.js index d5b4de4..1e61363 100644 --- a/test/scripts/modules/modal-event.test.js +++ b/test/scripts/modules/modal-event.test.js @@ -16,7 +16,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/modules/'+goal+'.js')) - .waitForElementByName(goal, timeout, 2000) }); afterEach(function () { @@ -25,7 +24,9 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { //TODO ï¼æªå¾æ¯å¯¹ - return driver.waitForElementByName('alertClick', timeout, 2000) + return driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('alertClick', timeout, 2000) .click() .sleep(1000) .dismissAlert() http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/23fd3bf0/test/scripts/modules/picker-event.test.js ---------------------------------------------------------------------- diff --git a/test/scripts/modules/picker-event.test.js b/test/scripts/modules/picker-event.test.js index 1561bc7..db5a002 100644 --- a/test/scripts/modules/picker-event.test.js +++ b/test/scripts/modules/picker-event.test.js @@ -17,7 +17,6 @@ describe('weex '+goal+' test', function () { beforeEach(function () { return util.init(driver) .get(util.getPage('/modules/'+goal+'.js')) - .waitForElementByName(goal, timeout, 2000) }); afterEach(function () { @@ -26,7 +25,9 @@ describe('weex '+goal+' test', function () { it('#1 '+goal + ' event', () => { //TODO ï¼æªå¾æ¯å¯¹ - var self = driver.waitForElementByName('showPicker', timeout, 2000) + var self = driver + .waitForElementByName(goal, timeout, 2000) + .waitForElementByName('showPicker', timeout, 2000) .click(); if(util.isIos()){ return self.waitForElementByName('Done', timeout, 2000)