weex-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acton...@apache.org
Subject [2/6] incubator-weex git commit: * [test] add text placeholder tc
Date Fri, 01 Sep 2017 10:16:33 GMT
* [test] add text placeholder tc


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

Branch: refs/heads/0.16-dev
Commit: 5747390ba048de0e626756b08e686735c7a9b03b
Parents: b344e47
Author: gurisxie <279483595@qq.com>
Authored: Fri Sep 1 15:01:33 2017 +0800
Committer: gurisxie <279483595@qq.com>
Committed: Fri Sep 1 15:01:33 2017 +0800

----------------------------------------------------------------------
 test/pages/components/textarea-placeholder.vue  | 62 ++++++++++++++++++
 .../components/textarea-placeholder.test.js     | 69 ++++++++++++++++++++
 test/scripts/util.js                            | 31 +++++++++
 3 files changed, 162 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5747390b/test/pages/components/textarea-placeholder.vue
----------------------------------------------------------------------
diff --git a/test/pages/components/textarea-placeholder.vue b/test/pages/components/textarea-placeholder.vue
new file mode 100644
index 0000000..b43be6c
--- /dev/null
+++ b/test/pages/components/textarea-placeholder.vue
@@ -0,0 +1,62 @@
+<template>
+  <div>
+    <panel title = 'textarea-placeholder' :padding-body='0'>
+      <div>
+        <textarea test-id='textarea' type="text" :placeholder="placeholder" class="textarea"
:value="value"></textarea>
+      </div>
+    </panel>
+    <wxc-desc>
+      <text class='desc'>
+测试点:
+  * 
+
+测试方式:
+  * 
+  * 
+      </text>
+    </wxc-desc>
+  </div>
+</template>
+<script>
+  module.exports = {
+    data : {
+      placeholder:'1111',
+      value:'muti line'
+    },
+    components: {
+      "wxc-desc":require('../include/wxc-desc.vue'),
+      panel: require('../include/panel.vue'),
+      button: require('../include/button.vue'),
+    },
+    created:function(){
+      setTimeout(() => {
+          this.placeholder = 'Hello,I am placeHolder';
+        },1000);
+    },
+    methods : {
+    }
+  }
+</script>
+
+<style scoped>
+  .mr-base{
+    margin: 10px;
+  }
+  .desc{
+    color:#aa0000;
+    font-size: 30px;
+  }
+  .textarea {
+    padding:10;
+    font-size: 40;
+    height: 280;
+    border-width:1;
+    border-style:solid;
+    border-color: #dddddd;
+    margin-top:30;
+    margin-left:20;
+    width: 600;
+  }
+</style>
+
+

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5747390b/test/scripts/components/textarea-placeholder.test.js
----------------------------------------------------------------------
diff --git a/test/scripts/components/textarea-placeholder.test.js b/test/scripts/components/textarea-placeholder.test.js
new file mode 100644
index 0000000..dfad11a
--- /dev/null
+++ b/test/scripts/components/textarea-placeholder.test.js
@@ -0,0 +1,69 @@
+/*
+ * 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 assert = require('chai').assert
+var wd = require('weex-wd')
+var path = require('path');
+var util = require("../util.js");
+var assert = require('chai').assert
+
+var goal = 'textarea-placeholder'
+
+describe('weex '+goal+' test', function () {
+  this.timeout(util.getTimeoutMills());
+  var driver = util.createDriver(wd);
+  var maxW = util.getGETActionWaitTimeMills();
+  if (process.env.platform !== 'ios') {
+    return;
+  }
+
+  beforeEach(function () {
+    return util.init(driver)
+      .get(util.getPage('/components/'+goal+'.js'))
+  });
+
+  afterEach(function () {
+    return util.quit(driver);
+  })
+
+  it('weex '+goal+' test', () => {
+    return driver
+      .waitForElementByName(goal,maxW,1000)
+      .waitForElementById('textarea',maxW,1000)
+      .text().then((text)=>{
+        console.log(text)
+        assert.notInclude(text,'Hello,I am placeHolder');
+        return driver
+          .clickScreenById('textarea')
+          .waitForElementById('textarea',maxW,1000)
+          .clear()
+          .waitForElementByName('Hello,I am placeHolder',maxW,1000)
+          .waitForElementById('textarea',maxW,1000)
+          .sendKeys('hello weex').sleep(1000)
+          .waitForElementById('textarea',maxW,1000)
+          .text().then((text)=>{
+            console.log(text)
+            assert.notInclude(text,'Hello,I am placeHolder');
+          })
+      })
+  })
+});
+
+

http://git-wip-us.apache.org/repos/asf/incubator-weex/blob/5747390b/test/scripts/util.js
----------------------------------------------------------------------
diff --git a/test/scripts/util.js b/test/scripts/util.js
index 64e99a8..4637069 100644
--- a/test/scripts/util.js
+++ b/test/scripts/util.js
@@ -231,6 +231,37 @@ module.exports = {
                 return this;
               })
           });
+
+          driverFactory.addPromiseChainMethod('clickScreenById', function(id,index) {
+              if(!index)index = 0;
+              return this.elementsById(id)
+                  .then((array)=>{
+                      if(array){
+                          if(index<0)index=0;
+                          if(index>=array.length)index=array.length-1;
+                          return array[index].getRect()
+                            .then(rect => {
+                              var left = rect.x;
+                              var top = rect.y;
+                              var width = rect.width;
+                              var height = rect.height;
+                              var touchX = Math.floor(left + width / 2);
+                              var touchY = Math.floor(top + height / 2);
+                              console.log('rect:' + touchX + " " + touchY);
+                              return this
+                                .touch('tap', {
+                                    x: touchX,
+                                    y: touchY
+                                })
+                                .sleep(500)
+                            })
+                      }else{
+                        console.log('id='+id+'的元素不存在!')
+                        return this;
+                      }
+                  })          
+          });
+
           driver = driverFactory.initPromiseChain();
           driver.configureHttp({
               timeout: 100000


Mime
View raw message