Skip to content

Commit 6a69b0d

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

File tree

3 files changed

+31
-52
lines changed

3 files changed

+31
-52
lines changed

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

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

293293
LoginShared.setupSharedTests();
294294

295-
it("should update profile icon after login", async function () {
296-
// Setup basic user mock
297-
setupProUserMock(false);
298-
299-
// Verify initial state
300-
verifyProfileIconBlanked();
301-
302-
// Perform login
303-
await performFullLoginFlow();
304-
305-
// Verify profile icon updated with user initials
306-
const $profileIcon = testWindow.$("#user-profile-button");
307-
const updatedContent = $profileIcon.html();
308-
expect(updatedContent).toContain('svg');
309-
expect(updatedContent).toContain('TU');
310-
311-
// Logout for cleanup
312-
await performFullLogoutFlow();
313-
});
314-
315295
it("should show correct popup states", async function () {
316296
// Setup basic user mock
317297
setupProUserMock(false);

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

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

355-
it("should update profile icon after login", async function () {
356-
// Setup basic user mock
357-
setupProUserMock(false);
358-
359-
// Verify initial state
360-
const $profileIcon = testWindow.$("#user-profile-button");
361-
const initialContent = $profileIcon.html();
362-
expect(initialContent).not.toContain('TU');
363-
364-
// Perform login
365-
await performFullLoginFlow();
366-
367-
// Wait for profile icon to update
368-
await awaitsFor(
369-
function () {
370-
const $profileIcon = testWindow.$("#user-profile-button");
371-
const profileIconContent = $profileIcon.html();
372-
return profileIconContent && profileIconContent.includes('TU');
373-
},
374-
"profile icon to contain user initials",
375-
5000
376-
);
377-
378-
// Verify profile icon updated with user initials
379-
const updatedContent = $profileIcon.html();
380-
expect(updatedContent).toContain('svg');
381-
expect(updatedContent).toContain('TU');
382-
383-
// Logout for cleanup
384-
await performFullLogoutFlow();
385-
});
386-
387355
it("should show correct popup states", async function () {
388356
// Setup basic user mock
389357
setupProUserMock(false);

test/spec/login-shared.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,37 @@ define(function (require, exports, module) {
191191
expect(LoginServiceExports.LoginService.isLoggedIn()).toBe(false);
192192
verifyProfileIconBlanked();
193193
});
194+
195+
it("should update profile icon after login", async function () {
196+
// Setup basic user mock
197+
setupProUserMock(false);
198+
199+
// Verify initial state
200+
verifyProfileIconBlanked();
201+
202+
// Perform login
203+
await performFullLoginFlow();
204+
205+
// Wait for profile icon to update
206+
await awaitsFor(
207+
function () {
208+
const $profileIcon = testWindow.$("#user-profile-button");
209+
const profileIconContent = $profileIcon.html();
210+
return profileIconContent && profileIconContent.includes('TU');
211+
},
212+
"profile icon to contain user initials",
213+
5000
214+
);
215+
216+
// Verify profile icon updated with user initials
217+
const $profileIcon = testWindow.$("#user-profile-button");
218+
const updatedContent = $profileIcon.html();
219+
expect(updatedContent).toContain('svg');
220+
expect(updatedContent).toContain('TU');
221+
222+
// Logout for cleanup
223+
await performFullLogoutFlow();
224+
});
194225
}
195226

196227
exports.setup = setup;

0 commit comments

Comments
 (0)