ChainSafe / dappeteer

[DEPRECATED]🏌🏼‍E2E testing for dApps using Puppeteer + MetaMask
Other
491 stars 152 forks source link

Viewport height and width setup, tests failing remotly #208

Closed irubido closed 1 year ago

irubido commented 1 year ago

Locally initSnapEnv installs snap properly, remotly on github actions it fails. It's impossible to scroll to see button in viewport even locally, but button can still be found ("Approve & install") and test work locally.

dappeteer.page.setViewport({height: 1500, width: 600}) in beforeAll() sets viewport to late

To Reproduce Steps to reproduce the behavior: https://github.com/ChainSafe/test-snaps/pull/2

node_modules/@chainsafe/dappeteer/dist/snap/install.js

    if (opts.hasPermissions) {
        await page.waitForSelector('button');
//ADD THIS TIMEOUT, LINE BELOW
        await new Promise((res) => setTimeout(res, 20000));
        await (0, helpers_1.clickOnButton)(page, "Approve & install");

stretch screen manually to se "Approve & install" button, scroll doesn't work

Github action logs https://github.com/ChainSafe/test-snaps/pull/2 Logs

➤ YN0000: [@metamask/test-snap-confirm]:     TimeoutError: page.waitForSelector: Timeout 20000ms exceeded.
➤ YN0000: [@metamask/test-snap-confirm]:     =========================== logs ===========================
➤ YN0000: [@metamask/test-snap-confirm]:     waiting for locator('xpath=//button[contains(text(), \'Approve & install\')]') to be visible
➤ YN0000: [@metamask/test-snap-confirm]:     ============================================================page.waitForSelector: Timeout 20000ms exceeded.
➤ YN0000: [@metamask/test-snap-confirm]:     =========================== logs ===========================
➤ YN0000: [@metamask/test-snap-confirm]:     waiting for locator('xpath=//button[contains(text(), \'Approve & install\')]') to be visible
➤ YN0000: [@metamask/test-snap-confirm]:     ============================================================
➤ YN0000: [@metamask/test-snap-confirm]: 
➤ YN0000: [@metamask/test-snap-confirm]:       15 |
➤ YN0000: [@metamask/test-snap-confirm]:       16 |   beforeAll(async function () {
➤ YN0000: [@metamask/test-snap-confirm]:     > [17](https://github.com/ChainSafe/test-snaps/actions/runs/3621333956/jobs/6104663928#step:5:18) |     ({ dappeteer, snapId, browser } = await initSnapEnv({ 

Expected behavior initSnapEnv could have viewport in opts: DappeteerLaunchOptions to force height, maybe then tests wouldn't fail remotly

Screenshots default Screenshot 2022-12-06 at 14 02 03

stretched manually Screenshot 2022-12-06 at 14 02 07

System:

Additional context Add any other context about the problem here.

Lykhoyda commented 1 year ago

@irubido we probably could close this issue as we increased the viewport size during the installation step. https://github.com/ChainSafe/dappeteer/commit/cb6abfc4bf751addd2e3f1746db3c4183f495c10