Skip to content

Commit

Permalink
Add a test for dynamic text spacing for launcher cards (jupyterlab#15146
Browse files Browse the repository at this point in the history
)

* added test for dynamic text spacing for launcher cards

* Changed launcher test to galata test folder

* added snapshot capability

* changes to get min-height value in css

* uncomment change

* removed min-height

* added loop to element.evaluate

* changed toBE to toContain

* took out loop and added toHaveCSS

* used parseFloat

* changed to parseInt

* made changes to compare recieved to expected value

* made some changes

* Converting value to string

* added px to show on expected value

* minor changes

* Minor changes

* added plus sign

* Mad minor changes

* changed location of px

* changes made to add px

* took out comment

* Update Playwright Snapshots

* Update Playwright Snapshots

* changes made to select launcher content instead of label

* Update Playwright Snapshots

* Update Playwright Snapshots

* changes made from feedback

* Update Playwright Snapshots

* Update Playwright Snapshots

---------

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
j264415 and github-actions[bot] authored Nov 2, 2023
1 parent c6e7a14 commit 453adc4
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 0 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
46 changes: 46 additions & 0 deletions galata/test/jupyterlab/launcher.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Copyright (c) Jupyter Development Team.
// Distributed under the terms of the Modified BSD License.

import { expect, galata, test } from '@jupyterlab/galata';

test.use({
autoGoto: false,
mockState: galata.DEFAULT_DOCUMENTATION_STATE,
viewport: { height: 720, width: 1280 }
});

test.describe('Dynamic Text Spacing', () => {
test('should Use Dynamic Text Spacing', async ({ page }) => {
await page.goto();
await page.waitForSelector('.jp-LauncherCard-label');

let element = page.locator('div.jp-LauncherCard-label');
for (let i = 0; i < (await element.count()); i++) {
let height = await element
.nth(i)
.evaluate(el =>
window.getComputedStyle(el).getPropertyValue('min-height')
);

let expectedValue =
2.462 *
parseFloat(
await element
.nth(i)
.evaluate(el =>
window
.getComputedStyle(el)
.getPropertyValue('font-size')
.toString()
)
);

expect(height).toEqual(expectedValue + 'px');
}

const imageName = 'launcher-card-label-height.png';
expect(
await page.locator('.jp-Launcher-content').screenshot()
).toMatchSnapshot(imageName.toLowerCase());
});
});
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 453adc4

Please sign in to comment.