Skip to content

Commit

Permalink
add todos to improve screenshots
Browse files Browse the repository at this point in the history
  • Loading branch information
codyzu committed Feb 11, 2024
1 parent 6d3d86a commit b36e8e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 64 deletions.
3 changes: 3 additions & 0 deletions src/pages/upload.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ test('can upload and view presentation', async ({page, loginPage}) => {
await presentation.getByRole('button', {name: 'view'}).click();
const page1 = page.getByAltText(/slide page 1/i);
await expect(page1).toBeVisible();
// TODO: instead match just the slide image
await expect(page1).toHaveScreenshot('page-1.png');

await page.getByRole('button', {name: /next/i}).click();
const page2 = page.getByAltText(/slide page 2/i);
await expect(page2).toBeVisible();
// TODO: instead match just the slide image
await expect(page2).toHaveScreenshot('page-2.png');

await page.getByRole('button', {name: /next/i}).click();
const page3 = page.getByAltText(/slide page 3/i);
await expect(page3).toBeVisible();
// TODO: instead match just the slide image
await expect(page3).toHaveScreenshot('page-3.png');
});
69 changes: 5 additions & 64 deletions src/pages/viewer.e2e.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,27 @@ test('navigate the presentation', async ({page}) => {
await page.goto(`/v/${presentationId}`);

await expect(page.getByRole('img', {name: 'Slide page 1'})).toBeVisible();
// TODO: instead match just the slide image
await expect(page).toHaveScreenshot('slide-1.png');

await page.getByRole('button', {name: 'next'}).click();
await expect(page.getByRole('img', {name: 'Slide page 2'})).toBeVisible();
// TODO: instead match just the slide image
await expect(page).toHaveScreenshot('slide-2.png');

await page.getByRole('button', {name: 'previous'}).click();
await expect(page.getByRole('img', {name: 'Slide page 1'})).toBeVisible();
// TODO: instead match just the slide image
await expect(page).toHaveScreenshot('slide-1.png');

await page.getByRole('button', {name: 'end'}).click();
await expect(page.getByRole('img', {name: 'Slide page 3'})).toBeVisible();
// TODO: instead match just the slide image
await expect(page).toHaveScreenshot('slide-3.png');

await page.getByRole('button', {name: 'start', exact: true}).click();
await expect(page.getByRole('img', {name: 'Slide page 1'})).toBeVisible();
// TODO: instead match just the slide image
await expect(page).toHaveScreenshot('slide-1.png');
});

Expand Down Expand Up @@ -80,67 +85,3 @@ test('can share with share buttons', async ({page}) => {
`https://slidr.app/v/${presentationId}?slide=2`,
);
});

//
//
// test('upload button appears after signing in', async ({
// page,
// loginPage,
// }) => {
// test.setTimeout(30_000);

// await page.goto('/v/viewer-1');
// const slide = await screen.findByRole('img', {name: 'Slide page 1'});
// expect(slide).toHaveAttribute('src', 'img1.jpg');

// await expect(page.getByRole('button', {name: /upload/i})).not.toBeVisible();

// await loginPage.goto();
// await loginPage.signIn();
// await loginPage.signInComplete();
// await page.goto('/');
// await expect(page.getByRole('button', {name: /upload/i})).toBeVisible({
// timeout: 15_000,
// });
// });

// test('can upload and view presentation', async ({page, loginPage}) => {
// test.setTimeout(60_000);

// await loginPage.goto();
// await loginPage.signIn();
// await loginPage.signInComplete();

// const presentationName = `e2e test - ${generateId()}`;
// await page.goto('/');
// await page.getByRole('button', {name: /upload/i}).click();
// await page
// .getByRole('button', {
// name: /drag 'n' drop/i,
// })
// .locator('input')
// .setInputFiles('./src/test/pdf/test.pdf');
// await expect(page.getByText(/done/i)).toBeVisible({timeout: 20_000});
// await page.getByLabel(/title/i).fill(presentationName);
// await expect(page.getByText(/saving/i)).toBeVisible();
// await expect(page.getByText(/saving/i)).not.toBeVisible();
// await page.getByRole('button', {name: /slidr/i}).click();

// const presentation = page.getByText(presentationName);
// await expect(presentation).toBeVisible();

// await presentation.click();
// const page1 = page.getByAltText(/slide page 1/i);
// await expect(page1).toBeVisible();
// await expect(page1).toHaveScreenshot('page-1.png');

// await page.getByRole('button', {name: /next/i}).click();
// const page2 = page.getByAltText(/slide page 2/i);
// await expect(page2).toBeVisible();
// await expect(page2).toHaveScreenshot('page-2.png');

// await page.getByRole('button', {name: /next/i}).click();
// const page3 = page.getByAltText(/slide page 3/i);
// await expect(page3).toBeVisible();
// await expect(page3).toHaveScreenshot('page-3.png');
// });

0 comments on commit b36e8e3

Please sign in to comment.