added clear tests

This commit is contained in:
sebv
2014-11-21 23:20:57 +08:00
parent b334698446
commit 679c13fed5
+106 -76
View File
@@ -17,88 +17,118 @@ describe("apidemos - clear", function () {
}, desired);
setup(this, _desired).then(function (d) { driver = d; });
it('should hide the keyboard using the default strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard()
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
describe('clear', function () {
it('should clear an empty field with hint', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.clear()
.sleep(1000)
.elementByClassName('android.widget.EditText')
.text().should.become('hint text')
.nodeify(done);
});
it('should clear a field with hint', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sendKeys('Are you looking at me!')
.sleep(1000)
.clear()
.sleep(1000)
.elementByClassName('android.widget.EditText')
.text().should.become('hint text')
.nodeify(done);
});
});
it('should hide the keyboard using the "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard('Done')
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
describe('hideKeyboard', function () {
it('should hide the keyboard using the "press" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'press', key: 'Done'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the default strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard()
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "pressKey" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'pressKey', key: 'Done'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard('Done')
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "pressKey" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'swipeDown'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "press" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'press', key: 'Done'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "tapOutside" strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'tapOutside'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "pressKey" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'pressKey', key: 'Done'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "tapOut" strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'tapOut'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "pressKey" strategy and "Done" key', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'swipeDown'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "tapOutside" strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'tapOutside'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
it('should hide the keyboard using the "tapOut" strategy', function (done) {
driver
.waitForElementByClassName('android.widget.EditText')
.click()
.sleep(1000)
.hideKeyboard({strategy:'tapOut'})
.sleep(1000)
.elementByClassName('android.widget.EditText')
.should.eventually.exist
.nodeify(done);
});
});
});