diff --git a/test/functional/android/apidemos/clear-specs.js b/test/functional/android/apidemos/clear-specs.js index 8269a90a8..d2713ecda 100644 --- a/test/functional/android/apidemos/clear-specs.js +++ b/test/functional/android/apidemos/clear-specs.js @@ -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); + }); + }); });