Last active
July 10, 2022 10:28
-
-
Save ryanrosello-og/1ee8d47f792224ecd951eb74528acb7f to your computer and use it in GitHub Desktop.
validate a complex pdf using Playwright
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {test, expect} from '@playwright/test'; | |
test('validate a complex pdf II, all pages', async ({page}) => { | |
const numberOfPages = 2; | |
for (let i = 1; i < numberOfPages + 1; i += 1) { | |
let pdfResource = | |
'https://oedtrngbj.wpengine.com/wp-content/uploads/Powerwall_2_AC_Datasheet_EN_NA.pdf'; | |
let iframe = `<iframe src="${pdfResource}#zoom=60&page=${i}" style="width: 100%;height:100%;border: none;"></iframe>`; | |
await page.setContent(iframe); | |
await page.waitForTimeout(5000); | |
expect(await page.locator('iframe').screenshot()).toMatchSnapshot({ | |
name: `pdf_validation_page_${i}.png`, | |
}); | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment