Skip to content

Commit 587b0ef

Browse files
Sign In / Sign Up UI updates (#8562)
* feat: update login page UI * feat: update login and signup page UI * chore: font optimization * feat: update test cases for login * feat: address review comments * feat: remove playwright report file * fix: fix the failing login test --------- Co-authored-by: ahmadshaheer <ashaheerki@gmail.com>
1 parent bb6c366 commit 587b0ef

File tree

10 files changed

+608
-257
lines changed

10 files changed

+608
-257
lines changed
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
.login-form-container {
2+
display: flex;
3+
justify-content: center;
4+
width: 100%;
5+
align-items: flex-start;
6+
7+
.login-form-header {
8+
margin-bottom: 16px;
9+
}
10+
11+
.login-form-header-text {
12+
color: var(--text-vanilla-300);
13+
}
14+
15+
.next-btn {
16+
padding: 0px 16px;
17+
}
18+
19+
.login-form-input {
20+
height: 40px;
21+
}
22+
23+
.no-acccount {
24+
color: var(--text-vanilla-300);
25+
font-size: 12px;
26+
margin-top: 16px;
27+
}
28+
}
29+
30+
.lightMode {
31+
.login-form-container {
32+
.login-form-header {
33+
color: var(--text-ink-500);
34+
}
35+
36+
.login-form-header-text {
37+
color: var(--text-ink-500);
38+
}
39+
40+
.no-acccount {
41+
color: var(--text-ink-500);
42+
}
43+
}
44+
}

frontend/src/container/Login/__tests__/Login.test.tsx

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -15,98 +15,104 @@ describe('Login Flow', () => {
1515
test('Login form is rendered correctly', async () => {
1616
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="" />);
1717

18-
const headingElement = screen.getByRole('heading', {
19-
name: 'login_page_title',
20-
});
21-
expect(headingElement).toBeInTheDocument();
22-
23-
const textboxElement = screen.getByRole('textbox');
24-
expect(textboxElement).toBeInTheDocument();
25-
26-
const buttonElement = screen.getByRole('button', {
27-
name: 'button_initiate_login',
28-
});
29-
expect(buttonElement).toBeInTheDocument();
30-
31-
const noAccountPromptElement = screen.getByText('prompt_no_account');
32-
expect(noAccountPromptElement).toBeInTheDocument();
18+
// Check for the main description
19+
expect(
20+
screen.getByText(
21+
'Sign in to monitor, trace, and troubleshoot your applications effortlessly.',
22+
),
23+
).toBeInTheDocument();
24+
25+
// Email input
26+
const emailInput = screen.getByTestId('email');
27+
expect(emailInput).toBeInTheDocument();
28+
expect(emailInput).toHaveAttribute('type', 'email');
29+
30+
// Next button
31+
const nextButton = screen.getByRole('button', { name: /next/i });
32+
expect(nextButton).toBeInTheDocument();
33+
34+
// No account prompt (default: canSelfRegister is false)
35+
expect(
36+
screen.getByText(
37+
"Don't have an account? Contact your admin to send you an invite link.",
38+
),
39+
).toBeInTheDocument();
3340
});
3441

35-
test(`Display "invalid_email" if email is not provided`, async () => {
42+
test('Display error if email is not provided', async () => {
3643
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="" />);
3744

38-
const buttonElement = screen.getByText('button_initiate_login');
39-
fireEvent.click(buttonElement);
45+
const nextButton = screen.getByRole('button', { name: /next/i });
46+
fireEvent.click(nextButton);
4047

4148
await waitFor(() =>
4249
expect(errorNotification).toHaveBeenCalledWith({
43-
message: 'invalid_email',
50+
message: 'Please enter a valid email address',
4451
}),
4552
);
4653
});
4754

48-
test('Display invalid_config if invalid email is provided and next clicked', async () => {
55+
test('Display error if invalid email is provided and next clicked', async () => {
4956
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="" />);
5057

51-
const textboxElement = screen.getByRole('textbox');
52-
fireEvent.change(textboxElement, {
58+
const emailInput = screen.getByTestId('email');
59+
fireEvent.change(emailInput, {
5360
target: { value: 'failEmail@signoz.io' },
5461
});
5562

56-
const buttonElement = screen.getByRole('button', {
57-
name: 'button_initiate_login',
58-
});
59-
fireEvent.click(buttonElement);
63+
const nextButton = screen.getByRole('button', { name: /next/i });
64+
fireEvent.click(nextButton);
6065

6166
await waitFor(() =>
6267
expect(errorNotification).toHaveBeenCalledWith({
63-
message: 'invalid_config',
68+
message:
69+
'Invalid configuration detected, please contact your administrator',
6470
}),
6571
);
6672
});
6773

68-
test('providing shaheer@signoz.io as email and pressing next, should make the login_with_sso button visible', async () => {
74+
test('providing shaheer@signoz.io as email and pressing next, should make the Login with SSO button visible', async () => {
6975
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="" />);
7076
act(() => {
7177
fireEvent.change(screen.getByTestId('email'), {
7278
target: { value: 'shaheer@signoz.io' },
7379
});
74-
7580
fireEvent.click(screen.getByTestId('initiate_login'));
7681
});
7782

7883
await waitFor(() => {
79-
expect(screen.getByText('login_with_sso')).toBeInTheDocument();
84+
expect(screen.getByText(/login with sso/i)).toBeInTheDocument();
8085
});
8186
});
8287

8388
test('Display email, password, forgot password if password=Y', () => {
8489
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="Y" />);
8590

86-
const emailTextBox = screen.getByTestId('email');
87-
expect(emailTextBox).toBeInTheDocument();
91+
const emailInput = screen.getByTestId('email');
92+
expect(emailInput).toBeInTheDocument();
8893

89-
const passwordTextBox = screen.getByTestId('password');
90-
expect(passwordTextBox).toBeInTheDocument();
94+
const passwordInput = screen.getByTestId('password');
95+
expect(passwordInput).toBeInTheDocument();
9196

92-
const forgotPasswordLink = screen.getByText('forgot_password');
97+
const forgotPasswordLink = screen.getByText('Forgot password?');
9398
expect(forgotPasswordLink).toBeInTheDocument();
9499
});
95100

96-
test('Display tooltip with "prompt_forgot_password" if forgot password is clicked while password=Y', async () => {
101+
test('Display tooltip with correct message if forgot password is hovered while password=Y', async () => {
97102
render(<Login ssoerror="" jwt="" refreshjwt="" userId="" withPassword="Y" />);
98-
const forgotPasswordLink = screen.getByText('forgot_password');
103+
const forgotPasswordLink = screen.getByText('Forgot password?');
99104

100105
act(() => {
101106
fireEvent.mouseOver(forgotPasswordLink);
102107
});
103108

104109
await waitFor(() => {
105-
const forgotPasswordTooltip = screen.getByRole('tooltip', {
106-
name: 'prompt_forgot_password',
107-
});
108-
expect(forgotPasswordLink).toBeInTheDocument();
109-
expect(forgotPasswordTooltip).toBeInTheDocument();
110+
// Tooltip text is static in the new UI
111+
expect(
112+
screen.getByText(
113+
'Ask your admin to reset your password and send you a new invite link',
114+
),
115+
).toBeInTheDocument();
110116
});
111117
});
112118
});

0 commit comments

Comments
 (0)