Skip to content

Commit f246133

Browse files
committed
refactor: login desktop and browser tests common code
1 parent 6a69b0d commit f246133

File tree

3 files changed

+53
-106
lines changed

3 files changed

+53
-106
lines changed

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

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -292,59 +292,6 @@ define(function (require, exports, module) {
292292

293293
LoginShared.setupSharedTests();
294294

295-
it("should show correct popup states", async function () {
296-
// Setup basic user mock
297-
setupProUserMock(false);
298-
299-
const $profileButton = testWindow.$("#user-profile-button");
300-
301-
// Test initial state - should show signin popup
302-
$profileButton.trigger('click');
303-
await popupToAppear(SIGNIN_POPUP);
304-
305-
let popupContent = testWindow.$('.profile-popup');
306-
const signInButton = popupContent.find('#phoenix-signin-btn');
307-
const signOutButton = popupContent.find('#phoenix-signout-btn');
308-
309-
expect(signInButton.length).toBe(1);
310-
expect(signOutButton.length).toBe(0);
311-
312-
// Close popup
313-
$profileButton.trigger('click');
314-
315-
// Perform login
316-
await performFullLoginFlow();
317-
318-
// Test logged in state - should show profile popup
319-
$profileButton.trigger('click');
320-
await popupToAppear(PROFILE_POPUP);
321-
322-
popupContent = testWindow.$('.profile-popup');
323-
const newSignInButton = popupContent.find('#phoenix-signin-btn');
324-
const newSignOutButton = popupContent.find('#phoenix-signout-btn');
325-
326-
expect(newSignInButton.length).toBe(0);
327-
expect(newSignOutButton.length).toBe(1);
328-
329-
// Close popup and logout for cleanup
330-
$profileButton.trigger('click');
331-
await performFullLogoutFlow();
332-
333-
// Test final state - should be back to signin popup
334-
$profileButton.trigger('click');
335-
await popupToAppear(SIGNIN_POPUP);
336-
337-
popupContent = testWindow.$('.profile-popup');
338-
const finalSignInButton = popupContent.find('#phoenix-signin-btn');
339-
const finalSignOutButton = popupContent.find('#phoenix-signout-btn');
340-
341-
expect(finalSignInButton.length).toBe(1);
342-
expect(finalSignOutButton.length).toBe(0);
343-
344-
// Close popup
345-
$profileButton.trigger('click');
346-
});
347-
348295
it("should show pro branding for user with pro subscription (expired trial)", async function () {
349296
console.log("llgT: Starting browser pro user with expired trial test");
350297

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

Lines changed: 0 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -352,59 +352,6 @@ define(function (require, exports, module) {
352352
expect(capturedBrowserURL).toContain('test-session-123');
353353
});
354354

355-
it("should show correct popup states", async function () {
356-
// Setup basic user mock
357-
setupProUserMock(false);
358-
359-
const $profileButton = testWindow.$("#user-profile-button");
360-
361-
// Test initial state - should show signin popup
362-
$profileButton.trigger('click');
363-
await popupToAppear(SIGNIN_POPUP);
364-
365-
let popupContent = testWindow.$('.profile-popup');
366-
const signInButton = popupContent.find('#phoenix-signin-btn');
367-
const signOutButton = popupContent.find('#phoenix-signout-btn');
368-
369-
expect(signInButton.length).toBe(1);
370-
expect(signOutButton.length).toBe(0);
371-
372-
// Close popup
373-
$profileButton.trigger('click');
374-
375-
// Perform login
376-
await performFullLoginFlow();
377-
378-
// Test logged in state - should show profile popup
379-
$profileButton.trigger('click');
380-
await popupToAppear(PROFILE_POPUP);
381-
382-
popupContent = testWindow.$('.profile-popup');
383-
const newSignInButton = popupContent.find('#phoenix-signin-btn');
384-
const newSignOutButton = popupContent.find('#phoenix-signout-btn');
385-
386-
expect(newSignInButton.length).toBe(0);
387-
expect(newSignOutButton.length).toBe(1);
388-
389-
// Close popup and logout for cleanup
390-
$profileButton.trigger('click');
391-
await performFullLogoutFlow();
392-
393-
// Test final state - should be back to signin popup
394-
$profileButton.trigger('click');
395-
await popupToAppear(SIGNIN_POPUP);
396-
397-
popupContent = testWindow.$('.profile-popup');
398-
const finalSignInButton = popupContent.find('#phoenix-signin-btn');
399-
const finalSignOutButton = popupContent.find('#phoenix-signout-btn');
400-
401-
expect(finalSignInButton.length).toBe(1);
402-
expect(finalSignOutButton.length).toBe(0);
403-
404-
// Close popup
405-
$profileButton.trigger('click');
406-
});
407-
408355
it("should show pro branding for user with pro subscription (expired trial)", async function () {
409356
console.log("llgT: Starting desktop pro user with expired trial test");
410357

test/spec/login-shared.js

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,59 @@ define(function (require, exports, module) {
222222
// Logout for cleanup
223223
await performFullLogoutFlow();
224224
});
225+
226+
it("should show correct popup states", async function () {
227+
// Setup basic user mock
228+
setupProUserMock(false);
229+
230+
const $profileButton = testWindow.$("#user-profile-button");
231+
232+
// Test initial state - should show signin popup
233+
$profileButton.trigger('click');
234+
await popupToAppear(SIGNIN_POPUP);
235+
236+
let popupContent = testWindow.$('.profile-popup');
237+
const signInButton = popupContent.find('#phoenix-signin-btn');
238+
const signOutButton = popupContent.find('#phoenix-signout-btn');
239+
240+
expect(signInButton.length).toBe(1);
241+
expect(signOutButton.length).toBe(0);
242+
243+
// Close popup
244+
$profileButton.trigger('click');
245+
246+
// Perform login
247+
await performFullLoginFlow();
248+
249+
// Test logged in state - should show profile popup
250+
$profileButton.trigger('click');
251+
await popupToAppear(PROFILE_POPUP);
252+
253+
popupContent = testWindow.$('.profile-popup');
254+
const newSignInButton = popupContent.find('#phoenix-signin-btn');
255+
const newSignOutButton = popupContent.find('#phoenix-signout-btn');
256+
257+
expect(newSignInButton.length).toBe(0);
258+
expect(newSignOutButton.length).toBe(1);
259+
260+
// Close popup and logout for cleanup
261+
$profileButton.trigger('click');
262+
await performFullLogoutFlow();
263+
264+
// Test final state - should be back to signin popup
265+
$profileButton.trigger('click');
266+
await popupToAppear(SIGNIN_POPUP);
267+
268+
popupContent = testWindow.$('.profile-popup');
269+
const finalSignInButton = popupContent.find('#phoenix-signin-btn');
270+
const finalSignOutButton = popupContent.find('#phoenix-signout-btn');
271+
272+
expect(finalSignInButton.length).toBe(1);
273+
expect(finalSignOutButton.length).toBe(0);
274+
275+
// Close popup
276+
$profileButton.trigger('click');
277+
});
225278
}
226279

227280
exports.setup = setup;

0 commit comments

Comments
 (0)