Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 29 additions & 0 deletions zeppelin-web-angular/e2e/tests/login/login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
*/

import { expect, test } from '@playwright/test';
import { DarkModePage } from '../../models/dark-mode-page';
import { LoginPage } from '../../models/login-page';
import { LoginTestUtil, TestCredentials } from '../../models/login-page.util';
import { addPageAnnotationBeforeEach, PAGES } from '../../utils';
Expand Down Expand Up @@ -127,4 +128,32 @@ test.describe('Login Page', () => {

await loginPage.waitForErrorMessage();
});

for (const theme of ['light', 'dark'] as const) {
test(`should fit a narrow viewport without horizontal overflow in ${theme} theme`, async ({ page }) => {
await test.step(`Given the ${theme} theme is active on a 375x812 viewport`, async () => {
const darkModePage = new DarkModePage(page);
await darkModePage.setThemeInLocalStorage(theme);
await page.setViewportSize({ width: 375, height: 812 });
await page.reload();
await expect(loginPage.formContainer).toBeVisible();
});

await test.step('Then the document should not overflow horizontally', async () => {
const overflow = await page.evaluate(
() => document.documentElement.scrollWidth - document.documentElement.clientWidth

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
() => document.documentElement.scrollWidth - document.documentElement.clientWidth
() => document.body.scrollWidth - document.documentElement.clientWidth

);
expect(overflow).toBe(0);
});

await test.step('Then the login controls should be fully visible and usable', async () => {
await expect(loginPage.userNameInput).toBeInViewport({ ratio: 1 });
await expect(loginPage.passwordInput).toBeInViewport({ ratio: 1 });
await expect(loginPage.loginButton).toBeInViewport({ ratio: 1 });

await loginPage.userNameInput.fill('narrow-viewport-user');
await expect(loginPage.userNameInput).toHaveValue('narrow-viewport-user');
});
});
}
});
28 changes: 20 additions & 8 deletions zeppelin-web-angular/src/app/pages/login/login.component.less
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,9 @@
}

.inner {
display: flex;
width: 800px;
max-width: calc(100% - 32px);
height: 300px;
position: absolute;
z-index: 1;
Expand All @@ -42,19 +44,14 @@
box-shadow: @box-shadow-base;

.form {
width: 500px;
position: absolute;
left: 0;
height: 100%;
flex: 1 1 auto;
min-width: 0;
background: @component-background;
padding: 36px;
}

.sidebar {
width: 300px;
position: absolute;
right: 0;
height: 100%;
flex: 0 0 300px;
background: @primary-color;
padding: 24px 36px;
color: @text-color-dark;
Expand All @@ -63,6 +60,21 @@
color: @heading-color-dark;
}
}

@media (max-width: @screen-sm-max) {
flex-direction: column;
height: auto;
max-height: calc(100% - 32px);
overflow-y: auto;

.form {
flex: none;
}

.sidebar {
flex: none;
}
}
}
}
});
Expand Down
Loading