Skip to content

Commit

Permalink
test: try to stabilize client tests on Safari (#6879)
Browse files Browse the repository at this point in the history
* try to stabilize client tests on Safari 14.5

* one more test

* select element tests

* update emulator version
  • Loading branch information
miherlosev authored Feb 17, 2022
1 parent 7ec61d8 commit 933208c
Show file tree
Hide file tree
Showing 3 changed files with 163 additions and 72 deletions.
2 changes: 1 addition & 1 deletion gulp/constants/client-test-settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ const CLIENT_TESTS_MOBILE_BROWSERS = [
// NOTE: https://github.com/DevExpress/testcafe/issues/471
// problem with extra scroll reproduced only on saucelabs
// virtual machines with ios device emulators
version: '14.5',
version: '15.0',
deviceName: 'iPhone 7 Plus Simulator',
},
];
Expand Down
33 changes: 24 additions & 9 deletions test/client/fixtures/automation/click-test.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const hammerhead = window.getTestCafeModule('hammerhead');
const browserUtils = hammerhead.utils.browser;
const featureDetection = hammerhead.utils.featureDetection;
const Promise = hammerhead.Promise;

const testCafeCore = window.getTestCafeModule('testCafeCore');
const styleUtils = testCafeCore.styleUtils;
Expand Down Expand Up @@ -647,11 +648,13 @@ $(document).ready(function () {
border: '0px',
});

$el.click(function (e) {
const el = $el[0];

const handler = function (e) {
eventPoint = { x: e.pageX, y: e.pageY };
});
};

const el = $el[0];
el.addEventListener('click', handler);

return getOffsetOptions($el[0], 20, 20)
.then(function (offsets) {
Expand All @@ -663,6 +666,8 @@ $(document).ready(function () {
return click.run();
})
.then(function () {
el.removeEventListener('click', handler);

const expectedPoint = { x: el.offsetLeft + 20, y: el.offsetTop + 20 };

equal(JSON.stringify(eventPoint), JSON.stringify(expectedPoint));
Expand All @@ -680,11 +685,13 @@ $(document).ready(function () {
border: '0px',
});

$el.click(function (e) {
const el = $el[0];

const handler = function (e) {
eventPoint = { x: e.pageX, y: e.pageY };
});
};

const el = $el[0];
el.addEventListener('click', handler);

return getOffsetOptions($el[0], -20, -20)
.then(function (offsets) {
Expand All @@ -696,6 +703,8 @@ $(document).ready(function () {
return click.run();
})
.then(function () {
el.removeEventListener('click', handler);

const expectedPoint = {
x: el.offsetLeft + el.offsetWidth - 20,
y: el.offsetTop + el.offsetHeight - 20,
Expand Down Expand Up @@ -738,12 +747,18 @@ $(document).ready(function () {

textarea.value = '11';

textarea.focus();
const onTextAreaFocusPromise = new Promise(function (resolve) {
textarea.addEventListener('focus', resolve);
});

const clickAutomation = new ClickAutomation(label, { }, window, cursor);

clickAutomation
.run()
textarea.focus();

onTextAreaFocusPromise
.then(function () {
return clickAutomation.run();
})
.then(function () {
ok(changed, 'change');
ok(checkbox.checked, 'checked');
Expand Down
Loading

0 comments on commit 933208c

Please sign in to comment.