Skip to content

Commit 8eea2cd

Browse files
authored
Merge pull request #20 from gemini-testing/FEI-24511.fix_hack_with_remove_body
fix: do not remove body if it does not exist on the page
2 parents 0c74de1 + 7394a2e commit 8eea2cd

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

lib/commands/url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module.exports = (browser, {config}) => {
1212
}
1313

1414
// in order to clear the page from previous search result
15-
await browser.execute(() => document.body.remove());
15+
await browser.execute(() => document.body && document.body.remove());
1616
await baseUrlFn.call(browser, uri);
1717

1818
await browser.waitUntil(

test/lib/commands/url.js

+11
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ describe('"url" command', () => {
5858
assert.callOrder(browser.execute, baseUrlFn);
5959
});
6060

61+
it('should not reject if body element does not exist on the page', async () => {
62+
wrapUrlCommand_(browser);
63+
64+
global.document.body = null;
65+
browser.execute.callsFake(() => {
66+
browser.execute.firstCall.args[0]();
67+
});
68+
69+
await assert.isFulfilled(browser.url('/?text=test'));
70+
});
71+
6172
it('should wait until request will be completed', async () => {
6273
wrapUrlCommand_(browser, {pageLoadTimeout: 100500});
6374

0 commit comments

Comments
 (0)