Skip to content

Commit

Permalink
Add test with multiple commas in uiautomator code
Browse files Browse the repository at this point in the history
  • Loading branch information
imurchie committed Jul 10, 2018
1 parent df6115c commit 8178072
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions test/functional/commands/find/by-uiautomator-e2e-specs.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,15 +121,21 @@ describe('Find - uiautomator', function () {
let el = await driver.findElement('-android uiautomator', selector);
await driver.getText(el.ELEMENT).should.eventually.equal('Views');
});
it('should parse commas in quotes correctly', async function () {
// two commas could mess with the parsing
let selector = 'new UiScrollable(new UiSelector().scrollable(true).instance(0)).scrollIntoView(new UiSelector().text("One thing, another thing, and yet a third.").instance(0));';
await driver.findElement('-android uiautomator', selector)
.should.eventually.be.rejectedWith(/An element could not be located/);
});
it('should error reasonably if a UiScrollable does not return a UiObject', async function () {
let selector = 'new UiScrollable(new UiSelector().scrollable(true).instance(0)).setMaxSearchSwipes(10)';
await driver.findElement('-android uiautomator', selector)
.should.eventually.be.rejectedWith(/Last method called on a UiScrollable object must return a UiObject object/);
});
it('should allow UiScrollable with unicode string', async function () {
await driver.startActivity('io.appium.android.apis', '.text.Unicode');
let selector = 'new UiSelector().text("عربي").instance(0);';
let selector = 'new UiSelector().text("english, august").instance(0);';
let el = await driver.findElement('-android uiautomator', selector);
await driver.getText(el.ELEMENT).should.eventually.equal('عربي');
await driver.getText(el.ELEMENT).should.eventually.equal('english, august');
});
});

0 comments on commit 8178072

Please sign in to comment.