This commit resolves an issue causing horizontal UI layout shift when a script is selected for the first time, and when all selected scripts are deselected. This issue was only observed on Chromium-based browsers on Linux environment when using macOS and Windows script collections. The underlying cause was identified as the use of percentage-based values for CSS margin and padding. To resolve this issue, these values were updated to absolute measurements. This adjustment maintains layout consistency across user interactions without compromising the responsiveness. The underlying cause was identified as the use of percentage-based values for CSS margin and padding within certain elements. To resolve this issue, these values were updated to absolute measurements. This adjustment maintains layout consistency across user interactions without compromising the responsiveness of the application. Additionally, an end-to-end (E2E) test has been introduced to monitor for future regressions of this layout shift bug, ensuring that the fix remains effective over subsequent updates.
66 lines
2.0 KiB
TypeScript
66 lines
2.0 KiB
TypeScript
import { ViewportTestScenarios } from './support/scenarios/viewport-test-scenarios';
|
|
import { openCard } from './support/interactions/card';
|
|
import { selectAllScripts, unselectAllScripts } from './support/interactions/script-selection';
|
|
import { assertLayoutStability } from './support/assert/layout-stability';
|
|
|
|
describe('Layout stability', () => {
|
|
ViewportTestScenarios.forEach(({ // some shifts are observed only on extra small or large screens
|
|
name, width, height,
|
|
}) => {
|
|
// Regression test for a bug where opening a modal caused layout shift
|
|
describe('Modal interaction', () => {
|
|
it(name, () => {
|
|
// arrange
|
|
cy.viewport(width, height);
|
|
cy.visit('/');
|
|
// act & assert
|
|
assertLayoutStability('body', () => {
|
|
cy
|
|
.contains('button', 'Privacy')
|
|
.click();
|
|
cy
|
|
.get('.modal-content')
|
|
.should('be.visible');
|
|
});
|
|
});
|
|
});
|
|
|
|
// Regression test for a bug where selecting a script with an open card caused layout shift
|
|
describe('Initial script selection', () => {
|
|
it(name, () => {
|
|
// arrange
|
|
cy.viewport(width, height);
|
|
cy.visit('/');
|
|
cy.contains('span', 'Windows')
|
|
.click();
|
|
// act & assert
|
|
assertLayoutStability('#app', () => {
|
|
openCard({
|
|
cardIndex: 0,
|
|
});
|
|
selectAllScripts();
|
|
});
|
|
});
|
|
});
|
|
|
|
// Regression test for a bug where unselecting selected with an open card caused layout shift
|
|
describe('Deselection script selection', () => {
|
|
it(name, () => {
|
|
// arrange
|
|
cy.viewport(width, height);
|
|
cy.visit('/');
|
|
cy.contains('span', 'Windows')
|
|
.click();
|
|
openCard({
|
|
cardIndex: 0,
|
|
});
|
|
selectAllScripts();
|
|
// act & assert
|
|
assertLayoutStability('#app', () => {
|
|
unselectAllScripts();
|
|
});
|
|
});
|
|
});
|
|
});
|
|
});
|