Skip to content

Instantly share code, notes, and snippets.

@acthp
Created October 13, 2016 22:13
Show Gist options
  • Save acthp/a43adadd7cc6464898362daeaf6db189 to your computer and use it in GitHub Desktop.
Save acthp/a43adadd7cc6464898362daeaf6db189 to your computer and use it in GitHub Desktop.
describe.only('example', function () {
it('should find visible element, low arity', function () {
browser.execute(function () {
document.body.innerHTML = '<div id="a" class="a">foo</div><div id="b">blah</div>';
});
// We pretend we're waiting on a list of dom elements to be
// created.
browser.waitUntil(
() => browser.elements('//*[@class="a"]').value.length > 0,
2000,
'has list',
200);
browser.execute(function () {
var a = document.getElementById('a');
a.parentElement.removeChild(a);
});
browser.waitForVisible('//*[@id="b"]', 100);
// XXX fails because it waits for div a.
});
it('should find visible element, full arity', function () {
browser.execute(function () {
document.body.innerHTML = '<div id="a" class="a">foo</div><div id="b">blah</div>';
});
// We pretend we're waiting on a list of dom elements to be
// created.
browser.waitUntil(
() => browser.elements('//*[@class="a"]').value.length > 0,
2000,
'has list',
200);
browser.execute(function () {
var a = document.getElementById('a');
a.parentElement.removeChild(a);
});
browser.waitForVisible('//*[@id="b"]', 100, false);
// XXX works because all optional args are passed.
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment