Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hide status bar when clicking using CDP (closes #7483) #7484

Merged
merged 1 commit into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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');
});