Skip to content

Commit fcd4e60

Browse files
committed
fix: tests failing on desktop timing issues
1 parent 86a71e6 commit fcd4e60

File tree

1 file changed

+12
-16
lines changed

1 file changed

+12
-16
lines changed

test/spec/LiveDevelopmentMultiBrowser-test.js

Lines changed: 12 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1974,6 +1974,7 @@ define(function (require, exports, module) {
19741974
if (LiveDevMultiBrowser.updateConfig) {
19751975
LiveDevMultiBrowser.updateConfig(JSON.stringify(LiveDevMultiBrowser.config));
19761976
}
1977+
await awaits(200);
19771978
}
19781979
}
19791980

@@ -1983,6 +1984,7 @@ define(function (require, exports, module) {
19831984
if (LiveDevMultiBrowser.updateConfig) {
19841985
LiveDevMultiBrowser.updateConfig(JSON.stringify(LiveDevMultiBrowser.config));
19851986
}
1987+
await awaits(200);
19861988
}
19871989
}
19881990

@@ -2285,12 +2287,7 @@ define(function (require, exports, module) {
22852287
`);
22862288

22872289
// Wait for edit mode to activate
2288-
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable')`, (result) => {
2289-
return result === true;
2290-
});
2291-
2292-
// Verify element is in edit mode (contenteditable)
2293-
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable')`, (result) => {
2290+
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable') && document.getElementById('testId').getAttribute('contenteditable') === 'true'`, (result) => {
22942291
return result === true;
22952292
});
22962293

@@ -2369,12 +2366,7 @@ define(function (require, exports, module) {
23692366
`);
23702367

23712368
// Wait for edit mode to activate
2372-
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable')`, (result) => {
2373-
return result === true;
2374-
});
2375-
2376-
// Verify element is in edit mode
2377-
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable')`, (result) => {
2369+
await forRemoteExec(`document.getElementById('testId').hasAttribute('contenteditable') && document.getElementById('testId').getAttribute('contenteditable') === 'true'`, (result) => {
23782370
return result === true;
23792371
});
23802372

@@ -2594,10 +2586,11 @@ define(function (require, exports, module) {
25942586

25952587
// Now perform undo operation using Ctrl+Z
25962588
await forRemoteExec(`
2589+
const isMac = ${brackets.platform === "mac"};
25972590
const event = new KeyboardEvent('keydown', {
25982591
key: 'z',
2599-
ctrlKey: true,
2600-
metaKey: false, // Use false for Windows/Linux, true for Mac
2592+
ctrlKey: !isMac,
2593+
metaKey: isMac,
26012594
bubbles: true,
26022595
cancelable: true
26032596
});
@@ -2684,10 +2677,11 @@ define(function (require, exports, module) {
26842677

26852678
// Now perform undo operation using Ctrl+Z
26862679
await forRemoteExec(`
2680+
const isMac = ${brackets.platform === "mac"};
26872681
const event = new KeyboardEvent('keydown', {
26882682
key: 'z',
2689-
ctrlKey: true,
2690-
metaKey: false, // Use false for Windows/Linux, true for Mac
2683+
ctrlKey: !isMac,
2684+
metaKey: isMac,
26912685
bubbles: true,
26922686
cancelable: true
26932687
});
@@ -2804,6 +2798,7 @@ define(function (require, exports, module) {
28042798

28052799
// Step 3: Click the preview (play icon) button in the toolbar
28062800
testWindow.$("#previewModeLivePreviewButton").click();
2801+
await awaits(200);
28072802

28082803
// Step 4: Verify boxes are hidden after clicking preview button
28092804
await waitForMoreOptionsBox(false);
@@ -2816,6 +2811,7 @@ define(function (require, exports, module) {
28162811

28172812
// Step 6: Click preview button again to toggle back to edit mode
28182813
testWindow.$("#previewModeLivePreviewButton").click();
2814+
await awaits(200);
28192815

28202816
// Step 7: Click element to verify boxes work again in edit mode
28212817
await forRemoteExec(`document.getElementById('testId').click()`);

0 commit comments

Comments
 (0)