Skip to content

Commit

Permalink
hide status bar when clicking using CDP (closes #7483) (#7484)
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexKamaev authored Feb 2, 2023
1 parent 7048138 commit 5e0c96a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 4 deletions.
8 changes: 6 additions & 2 deletions src/client/browser/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,14 +198,18 @@ export function closeWindow (closeWindowUrl, createXHR, windowId) {
});
}

export function dispatchProxylessEvent (dispatchProxylessEventUrl, createXHR, type, options) {
export async function dispatchProxylessEvent (dispatchProxylessEventUrl, testCafeUI, createXHR, type, options) {
await testCafeUI.hide();

const data = JSON.stringify({ //eslint-disable-line no-restricted-globals
type,
options,
});

return sendXHR(dispatchProxylessEventUrl, createXHR, {
await sendXHR(dispatchProxylessEventUrl, createXHR, {
method: 'POST',
data,
});

await testCafeUI.show();
}
5 changes: 3 additions & 2 deletions src/client/driver/driver.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {

import { cursor } from './deps/testcafe-automation';

import { StatusBar } from './deps/testcafe-ui';
import testCafeUI from './deps/testcafe-ui';

import {
CHECK_IFRAME_DRIVER_LINK_DELAY,
Expand Down Expand Up @@ -1174,6 +1174,7 @@ export default class Driver extends serviceUtils.EventEmitter {
browser.dispatchProxylessEvent,
browser.dispatchProxylessEvent,
this.communicationUrls.dispatchProxylessEvent,
testCafeUI,
hammerhead.createNativeXHR) : null;

const executor = new ActionExecutor(command, {
Expand Down Expand Up @@ -1898,7 +1899,7 @@ export default class Driver extends serviceUtils.EventEmitter {
});

this.nativeDialogsTracker = new NativeDialogTracker(this.contextStorage, { proxyless, dialogHandler });
this.statusBar = new StatusBar(this.runInfo.userAgent, this.runInfo.fixtureName, this.runInfo.testName, this.contextStorage);
this.statusBar = new testCafeUI.StatusBar(this.runInfo.userAgent, this.runInfo.fixtureName, this.runInfo.testName, this.contextStorage);

const self = this;

Expand Down
23 changes: 23 additions & 0 deletions test/functional/fixtures/regression/gh-7483/pages/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<style>
button {
position: fixed;
bottom: 10px;
left: 0;
}
</style>
</head>

<body>
<button>click me</button>
<div id="logger"></div>
<script>
document.querySelector('button').addEventListener('click', function () {
document.querySelector('#logger').innerHTML = 'OK';
});
</script>
</body>
</html>
9 changes: 9 additions & 0 deletions test/functional/fixtures/regression/gh-7483/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
const { onlyInProxyless } = require('../../../utils/skip-in');

describe('[Regression](GH-7483)', function () {
onlyInProxyless('Should click on the element if the element is behind the Status Bar', function () {
return runTests('testcafe-fixtures/index.js');
});
});


Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Selector } from 'testcafe';

fixture `Should click on the element if the element is behind the Status Bar`
.page('../pages/index.html');

test('Click the button behind the StatusBar', async t => {
await t.click('button');

await t.expect(Selector('#logger').innerText).eql('OK');
});

0 comments on commit 5e0c96a

Please sign in to comment.