Skip to content
Merged
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
3 changes: 1 addition & 2 deletions pt/web/firebird/tests/App.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ test.describe('pt loads', () => {
});

test('sidebar is visible', async ({ page }) => {
const sidebar = page.getByRole('complementary');
await expect(sidebar).toBeVisible;
Comment thread
eumalin marked this conversation as resolved.
await expect(page.locator('aside')).toBeVisible();
Comment thread
eumalin marked this conversation as resolved.
});

test('has main element', async ({ page }) => {
Expand Down
32 changes: 32 additions & 0 deletions pt/web/firebird/tests/ViewerToolbar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,4 +77,36 @@ test.describe('reader toolbar actions', () => {
await expect(page.getByRole('button', { name: 'Zoom In', exact: true })).toBeVisible();
await expect(page.getByLabel('Page scan 1').locator('details')).toBeVisible();
});

test.describe('zoom limits', () => {
test('zoom-in button is disabled at maximum zoom', async ({ page }) => {
const zoomIn = page.getByLabel('Zoom').getByRole('button', { name: 'Zoom In' });
for (let i = 0; i < 20; i++) {
if (await zoomIn.isDisabled()) break;
await zoomIn.click();
}
await expect(zoomIn).toBeDisabled();
});

test('zoom-out button is disabled at minimum zoom', async ({ page }) => {
const zoomOut = page.getByLabel('Zoom').getByRole('button', { name: 'Zoom Out' });
for (let i = 0; i < 20; i++) {
if (await zoomOut.isDisabled()) break;
await zoomOut.click();
}
await expect(zoomOut).toBeDisabled();
});

test('zoom-out re-enables after zooming back in from minimum', async ({ page }) => {
const zoomIn = page.getByLabel('Zoom').getByRole('button', { name: 'Zoom In' });
const zoomOut = page.getByLabel('Zoom').getByRole('button', { name: 'Zoom Out' });
for (let i = 0; i < 20; i++) {
if (await zoomOut.isDisabled()) break;
await zoomOut.click();
}
await expect(zoomOut).toBeDisabled();
await zoomIn.click();
await expect(zoomOut).toBeEnabled();
});
});
});
29 changes: 29 additions & 0 deletions pt/web/firebird/tests/sidebar.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,35 @@ test.describe('sidebar actions', () => {
await page.getByRole('button', { name: 'Save Changes' }).click();
});
});
test.describe('share panel', () => {
test.beforeEach(async ({ page }) => {
const shareButton = page.getByRole('button', { name: 'Share' });
await shareButton.click();
await expect(shareButton).toHaveAttribute('aria-expanded', 'true');
});

test('shows permanent link to item', async ({ page }) => {
await expect(page.getByLabel('Permanent link to this item')).toHaveValue(/hdl\.handle\.net\/2027\/test\.pd_open/);
});

test('shows link to current page scan', async ({ page }) => {
// getByRole needed because the nearby copy button's aria-label contains the same substring
await expect(page.getByRole('textbox', { name: 'Link to this page scan' })).toHaveValue(/hdl\.handle\.net\/2027\/test\.pd_open.*seq=1/);
});

test('page scan link updates when navigating to a different page', async ({ page }) => {
await page.getByRole('button', { name: 'Next Page' }).click();
await expect(page.getByRole('textbox', { name: 'Link to this page scan' })).toHaveValue(/seq=2/);
});

test('embed button opens modal with iframe code', async ({ page }) => {
await page.getByRole('button', { name: 'Embed this item' }).click();
await expect(page.getByRole('dialog')).toBeVisible();
await expect(page.getByLabel('Code Block')).toHaveValue(/iframe/);
await expect(page.getByLabel('Code Block')).toHaveValue(/test\.pd_open/);
});
});

// close and expand sidebar
test.describe('toggle sidebar visibility', () => {
test('close sidebar', async ({ page }) => {
Expand Down
Loading