Skip to content

Commit f3daff3

Browse files
committed
fix: linux/mac integ test failures due to login dialog capturing key event handler
1 parent 5eda223 commit f3daff3

File tree

1 file changed

+15
-45
lines changed

1 file changed

+15
-45
lines changed

test/spec/login-desktop-integ-test.js

Lines changed: 15 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ define(function (require, exports, module) {
7171
await awaitsFor(
7272
function () {
7373
return testWindow._test_login_service_exports &&
74-
testWindow._test_login_desktop_exports;
74+
testWindow._test_login_desktop_exports;
7575
},
7676
"Test exports to be available",
7777
5000
@@ -244,10 +244,14 @@ define(function (require, exports, module) {
244244

245245
async function performFullLoginFlow() {
246246
// Mock desktop app functions for login flow
247+
let capturedBrowserURL = null;
247248
testWindow.Phoenix.app.openURLInDefaultBrowser = function(url) {
249+
capturedBrowserURL = url;
248250
return true;
249251
};
252+
let capturedClipboardText = null;
250253
testWindow.Phoenix.app.copyToClipboard = function(text) {
254+
capturedClipboardText = text;
251255
return true;
252256
};
253257

@@ -263,6 +267,16 @@ define(function (require, exports, module) {
263267

264268
// Wait for desktop login dialog
265269
await testWindow.__PR.waitForModalDialog(".modal");
270+
const copyButton = testWindow.$('.modal').find('[data-button-id="copy"]');
271+
copyButton.trigger('click');
272+
expect(capturedClipboardText).toBe("123456");
273+
274+
// Test open browser functionality
275+
const openBrowserButton = testWindow.$('.modal').find('[data-button-id="open"]');
276+
openBrowserButton.trigger('click');
277+
expect(capturedBrowserURL).toBeDefined();
278+
expect(capturedBrowserURL).toContain('authorizeApp');
279+
expect(capturedBrowserURL).toContain('test-session-123');
266280

267281
// Click refresh button to verify login
268282
const refreshButton = testWindow.$('.modal').find('[data-button-id="refresh"]');
@@ -306,50 +320,6 @@ define(function (require, exports, module) {
306320
await cleanupTrialState();
307321
});
308322

309-
it("should open browser and copy validation code", async function () {
310-
// Setup basic user mock
311-
setupProUserMock(false);
312-
313-
// Mock desktop app functions
314-
let capturedBrowserURL = null;
315-
let capturedClipboardText = null;
316-
317-
if (testWindow.Phoenix && testWindow.Phoenix.app) {
318-
testWindow.Phoenix.app.openURLInDefaultBrowser = function(url) {
319-
capturedBrowserURL = url;
320-
return true;
321-
};
322-
testWindow.Phoenix.app.copyToClipboard = function(text) {
323-
capturedClipboardText = text;
324-
return true;
325-
};
326-
}
327-
328-
// Click profile button and sign in
329-
const $profileButton = testWindow.$("#user-profile-button");
330-
$profileButton.trigger('click');
331-
await popupToAppear(SIGNIN_POPUP);
332-
333-
const popupContent = testWindow.$('.profile-popup');
334-
const signInButton = popupContent.find('#phoenix-signin-btn');
335-
signInButton.trigger('click');
336-
337-
// Wait for desktop login dialog
338-
await testWindow.__PR.waitForModalDialog(".modal");
339-
340-
// Test copy functionality
341-
const copyButton = testWindow.$('.modal').find('[data-button-id="copy"]');
342-
copyButton.trigger('click');
343-
expect(capturedClipboardText).toBe("123456");
344-
345-
// Test open browser functionality
346-
const openBrowserButton = testWindow.$('.modal').find('[data-button-id="open"]');
347-
openBrowserButton.trigger('click');
348-
expect(capturedBrowserURL).toBeDefined();
349-
expect(capturedBrowserURL).toContain('authorizeApp');
350-
expect(capturedBrowserURL).toContain('test-session-123');
351-
});
352-
353323
LoginShared.setupSharedTests();
354324
});
355325
});

0 commit comments

Comments
 (0)