Skip to content
This repository has been archived by the owner on Apr 12, 2024. It is now read-only.

Viewport height and width setup, tests failing remotly #208

Closed
irubido opened this issue Dec 6, 2022 · 1 comment
Closed

Viewport height and width setup, tests failing remotly #208

irubido opened this issue Dec 6, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@irubido
Copy link
Contributor

irubido commented Dec 6, 2022


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:
ChainSafe/test-snaps#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 ChainSafe/test-snaps#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:

  • OS: [e.g. iOS]
  • OS version [e.g. 22]
  • NodeJs version [e.g v15.8.0]
  • dAppeteer version [e.g. 2.2.0]
  • testing framework [e.g jest]
  • testing framework version [e.g 26.0]

Additional context
Add any other context about the problem here.

@irubido irubido added the bug Something isn't working label Dec 6, 2022
@BeroBurny BeroBurny assigned BeroBurny and unassigned BeroBurny Dec 6, 2022
@danforbes danforbes added this to the M2: Integration Tests milestone Dec 7, 2022
@Lykhoyda Lykhoyda self-assigned this Dec 12, 2022
Lykhoyda added a commit that referenced this issue Dec 14, 2022
* Set viewport to most popular desktop resolution; fix for #208

Co-authored-by: Bernard Stojanović <[email protected]>
mpetrunic added a commit that referenced this issue Dec 15, 2022
* chore: update CI for unstable branch

* fix!: casing of MetaMask (#132)

Fix casing of MetaMask

Co-authored-by: Marin Petrunic <[email protected]>

* fix: update ganache, fix test depending on goerli (#144)

* fix: selector issues, useless timeouts, reorganise tests (#145)

* fix: update ganache, fix test depending on goerli

* fix: bugs in selectors, less timeout, reorganise structure

* update yarn

* chore: improve root hooks

* try to increase timeout

* better ci

* add screenshot uploading to ci

* fix screenshot name

* run screenshot on failed test

* fix lint

* change viewport

* fix tests

* fix#123124

* fix tests

* whyyyyyyyyyyyyyyyyyyyyyyyyy

* please

* fix testing dapp

* dunno anymore

* fix lint

* fix typo in selector

* update dapp loading

* refactor script fetching for `index.html`

* fix dam sing test

Co-authored-by: Bernard <[email protected]>

* fix: import token flaky (#149)

fix: import-token flakyness

* feat!: update recommended metamask version (#151)

* feat!: update recommended metamask version

* implement screenshot helper

* implement hide portfolio popup action

* implement close what's new modal action

* remove obsolete test

* fix dappeteer methods broken on update

* chore: fix lint

* update metamask version to `10.20.0`

* fix addToken.ts

* address issues

* fix lint

* fix tests

* fix #4

* fix non visible buttons

Co-authored-by: Bernard Stojanović <[email protected]>

* chore: change eslint config to chainsafe shared (#152)

* chore: change eslint to chainsafe config

* address PR comments

* address PR comments

* fix tests

* feat: add support for installing metamask flask (#153)

feat: add support for installing metamask flaask

* feat: ability to install snap (#154)

* feat: add support for installing metamask flaask

* feat: ability to install snaps

* fi lint

* fix starting a snap

* fix snap install

Co-authored-by: Bernard <[email protected]>

* fix: snap install faster, run all tests (#163)

* fix: run all tests, faster check for installed snap

* fix condition bug

* feat: Add invokeSnap method; update installSnap method parameter; (#159)

* Add invokeSnap method; update installSnap method parameter;

* adjust invokeSnap method after review

* Fix params type in invokeSnap method

* update invokeSnap Return type

* update invokeSnap with generic params

* update test expectation

* fix lint

* feat: add ability to accept dialogs (#138) (#164)

* feat:add ability to accept dialogs (#138)

* fix lint

* move installSnap, invokeSnap to dappeteer api; add bringToFront call to dialog methods

* pair improvements

* fix lint

* add methods snap

* exclude flask tests from global

* exclude flask tests from global

Co-authored-by: Bernard <[email protected]>

* feat!:  add playwright support (#167)

* feat!: add playwright support

* fix: lint

* fix: ci matrix

* don't run snap tests on non flask

* address PR comments

* feat: added notification snap to methods-snap #137 (#166)

* pair improvements

* fix lint

* feat: add notify Snap method

* Added getAllNotifications method

* go back after getting all notifications

* remove timeout

* fix post merge errors

Co-authored-by: Bernard <[email protected]>
Co-authored-by: Marin Petrunic <[email protected]>

* feat: method to bootstrap snap env (#180)

* feat: install snap from local files

* fix: installing and invokeing snaps

* disable addToken test

* disable fail fast

* replace binance smart chain

* chore: node engine requirements (#184)

set engines compatibility for 16 and above

* chore: remove metamask dir (#185)

* fix: remove page param from install snap (#188)

* feat!: replace outdated methods (#189)

* feat!: replaced addTokenMethod

* feat: remove add network method

* chore: Ci enhancement (#193)

* cache yarn and have lint and build as separate steps

* add back yarn.lock

* add jobs

* fix name

* feat: allow signing typed data (#191)

* add test to sign typed data

* add a check to see if the sign button is actually disabled

* clean up

* fix and clean

* remove flackyness

* lint

* fix playwright

* add hidden option for pupeteer types waitForSelector

* remove reload between tests

* fix: fix prompt clicking flakiness, fix multiple snap key permissions (#194)

* add retries when confirming prompts with lower timeout

* better snap error handling, ability to accept multiple key permissions

* bail on first fail

* add context to screenshots

* remove various random timeouts, add wait for overlay, more retrys

* fix lint

* increase timeout for loading network and token details

* address PR comments

* increase timeout

* add retry to profile dropdown

* feat: snap notifications 137 (#187)

* chore: node engine requirements (#184) (#186)

set engines compatibility for 16 and above

Co-authored-by: Bernard Stojanović <[email protected]>

* pair improvements

* fix lint

* feat: add notify Snap method

* go back after getting all notifications

* remove timeout

* wip

* Add notification observe method

* update test

* remove unused code

* wip notifiction observer

* wip observer based notifications

* wip observer based notifications

* remove unused dependency

* cleanup

* fixes after merge

* revert method names

* clean waitForNotification method

* emitter solution - FP

* emitter solution - ClassBased

* Cleanup class based emitter

* fix lint

* fixes after merge

* remove p-event library

* remove eslint comment

* update test configuration

* return NotificationList from waitForNotification

* add getNotificationEmitter method

* remove back button

Co-authored-by: Marin Petrunić <[email protected]>
Co-authored-by: Bernard Stojanović <[email protected]>
Co-authored-by: Marin Petrunic <[email protected]>

* chore: Deprecate button clicks for tests (#195)

* sharedConst and signature check

* without sharedConst :)

* request accounts

* request accounts

* long typed data

* short typed data

* add token reject/accept

* add network accept/reject

* actually verify the lock/unlock

* contract interactions

* address comment

* web3-utils 1.3.4

* addToken and addNetwork use boolean

* remove useless wait

* chore: Update documentation and Readme (#202)

* docs

* change to metaMask accross the board and use bootstrap in our test

* MetaMMMMMMask

* snaps methods in API.md

* snaps usage in Readme.md

* Update README.md

Co-authored-by: Marin Petrunić <[email protected]>

* address comment

* add forgotten menu item for initSnapEnv

* removing jsdoc

Co-authored-by: Marin Petrunić <[email protected]>

* chore: Remove local server for dapp (#203)

* docs

* change to metaMask accross the board and use bootstrap in our test

* MetaMMMMMMask

* snaps methods in API.md

* snaps usage in Readme.md

* init

* lint

* add dev deps for ganache/console.log to make build pass

* Update README.md

Co-authored-by: Marin Petrunić <[email protected]>

* address comment

* add forgotten menu item for initSnapEnv

* removing jsdoc

Co-authored-by: Marin Petrunić <[email protected]>

* feat: Simplify `installSnap` and `initSnapEnv` apis (#206)

* simplify api

* remove stray comments

* fix undefined opts

* double question mark back :)

* Update src/snap/utils.ts

* 2s for my use case

* test perf

* elegant race with bad name

* chore: update web3 (#217)

chore: upgrade web3.js

* chore: update metamask version (#209)

* update recommended version

* chore: fix timeout for accept dialog (#218)

increase timeout for accept and reject dialog

* fix: increase viewport size (#219)

* Set viewport to most popular desktop resolution; fix for #208

Co-authored-by: Bernard Stojanović <[email protected]>

* fix: viewport typo (#220)

fix viewport typo

Co-authored-by: Maarten Zuidhoorn <[email protected]>
Co-authored-by: Bernard <[email protected]>
Co-authored-by: Anton Lykhoyda <[email protected]>
Co-authored-by: Thibaut Sardan <[email protected]>
@Lykhoyda Lykhoyda moved this to New Issues in Dappeteer Dec 15, 2022
@Lykhoyda Lykhoyda moved this from New Issues to In Progress in Dappeteer Dec 15, 2022
mpetrunic pushed a commit that referenced this issue Dec 15, 2022
* Set viewport to most popular desktop resolution; fix for #208

Co-authored-by: Bernard Stojanović <[email protected]>
mpetrunic added a commit that referenced this issue Dec 15, 2022
* chore: update web3 (#217)

chore: upgrade web3.js

* chore: update metamask version (#209)

* update recommended version

* chore: fix timeout for accept dialog (#218)

increase timeout for accept and reject dialog

* fix: increase viewport size (#219)

* Set viewport to most popular desktop resolution; fix for #208

Co-authored-by: Bernard Stojanović <[email protected]>

* fix: viewport typo (#220)

fix viewport typo

Co-authored-by: Anton Lykhoyda <[email protected]>
Co-authored-by: Bernard Stojanović <[email protected]>
@Lykhoyda
Copy link
Contributor

@irubido we probably could close this issue as we increased the viewport size during the installation step. cb6abfc

@irubido irubido closed this as completed Jan 13, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done/Closed in Dappeteer Jan 13, 2023
venuswhispers added a commit to venuswhispers/My_dAppeteer that referenced this issue Feb 19, 2024
* chore: update CI for unstable branch

* fix!: casing of MetaMask (#132)

Fix casing of MetaMask

Co-authored-by: Marin Petrunic <[email protected]>

* fix: update ganache, fix test depending on goerli (#144)

* fix: selector issues, useless timeouts, reorganise tests (#145)

* fix: update ganache, fix test depending on goerli

* fix: bugs in selectors, less timeout, reorganise structure

* update yarn

* chore: improve root hooks

* try to increase timeout

* better ci

* add screenshot uploading to ci

* fix screenshot name

* run screenshot on failed test

* fix lint

* change viewport

* fix tests

* fix#123124

* fix tests

* whyyyyyyyyyyyyyyyyyyyyyyyyy

* please

* fix testing dapp

* dunno anymore

* fix lint

* fix typo in selector

* update dapp loading

* refactor script fetching for `index.html`

* fix dam sing test

Co-authored-by: Bernard <[email protected]>

* fix: import token flaky (#149)

fix: import-token flakyness

* feat!: update recommended metamask version (#151)

* feat!: update recommended metamask version

* implement screenshot helper

* implement hide portfolio popup action

* implement close what's new modal action

* remove obsolete test

* fix dappeteer methods broken on update

* chore: fix lint

* update metamask version to `10.20.0`

* fix addToken.ts

* address issues

* fix lint

* fix tests

* fix #4

* fix non visible buttons

Co-authored-by: Bernard Stojanović <[email protected]>

* chore: change eslint config to chainsafe shared (#152)

* chore: change eslint to chainsafe config

* address PR comments

* address PR comments

* fix tests

* feat: add support for installing metamask flask (#153)

feat: add support for installing metamask flaask

* feat: ability to install snap (#154)

* feat: add support for installing metamask flaask

* feat: ability to install snaps

* fi lint

* fix starting a snap

* fix snap install

Co-authored-by: Bernard <[email protected]>

* fix: snap install faster, run all tests (#163)

* fix: run all tests, faster check for installed snap

* fix condition bug

* feat: Add invokeSnap method; update installSnap method parameter; (#159)

* Add invokeSnap method; update installSnap method parameter;

* adjust invokeSnap method after review

* Fix params type in invokeSnap method

* update invokeSnap Return type

* update invokeSnap with generic params

* update test expectation

* fix lint

* feat: add ability to accept dialogs (#138) (#164)

* feat:add ability to accept dialogs (#138)

* fix lint

* move installSnap, invokeSnap to dappeteer api; add bringToFront call to dialog methods

* pair improvements

* fix lint

* add methods snap

* exclude flask tests from global

* exclude flask tests from global

Co-authored-by: Bernard <[email protected]>

* feat!:  add playwright support (#167)

* feat!: add playwright support

* fix: lint

* fix: ci matrix

* don't run snap tests on non flask

* address PR comments

* feat: added notification snap to methods-snap #137 (#166)

* pair improvements

* fix lint

* feat: add notify Snap method

* Added getAllNotifications method

* go back after getting all notifications

* remove timeout

* fix post merge errors

Co-authored-by: Bernard <[email protected]>
Co-authored-by: Marin Petrunic <[email protected]>

* feat: method to bootstrap snap env (#180)

* feat: install snap from local files

* fix: installing and invokeing snaps

* disable addToken test

* disable fail fast

* replace binance smart chain

* chore: node engine requirements (#184)

set engines compatibility for 16 and above

* chore: remove metamask dir (#185)

* fix: remove page param from install snap (#188)

* feat!: replace outdated methods (#189)

* feat!: replaced addTokenMethod

* feat: remove add network method

* chore: Ci enhancement (#193)

* cache yarn and have lint and build as separate steps

* add back yarn.lock

* add jobs

* fix name

* feat: allow signing typed data (#191)

* add test to sign typed data

* add a check to see if the sign button is actually disabled

* clean up

* fix and clean

* remove flackyness

* lint

* fix playwright

* add hidden option for pupeteer types waitForSelector

* remove reload between tests

* fix: fix prompt clicking flakiness, fix multiple snap key permissions (#194)

* add retries when confirming prompts with lower timeout

* better snap error handling, ability to accept multiple key permissions

* bail on first fail

* add context to screenshots

* remove various random timeouts, add wait for overlay, more retrys

* fix lint

* increase timeout for loading network and token details

* address PR comments

* increase timeout

* add retry to profile dropdown

* feat: snap notifications 137 (#187)

* chore: node engine requirements (#184) (#186)

set engines compatibility for 16 and above

Co-authored-by: Bernard Stojanović <[email protected]>

* pair improvements

* fix lint

* feat: add notify Snap method

* go back after getting all notifications

* remove timeout

* wip

* Add notification observe method

* update test

* remove unused code

* wip notifiction observer

* wip observer based notifications

* wip observer based notifications

* remove unused dependency

* cleanup

* fixes after merge

* revert method names

* clean waitForNotification method

* emitter solution - FP

* emitter solution - ClassBased

* Cleanup class based emitter

* fix lint

* fixes after merge

* remove p-event library

* remove eslint comment

* update test configuration

* return NotificationList from waitForNotification

* add getNotificationEmitter method

* remove back button

Co-authored-by: Marin Petrunić <[email protected]>
Co-authored-by: Bernard Stojanović <[email protected]>
Co-authored-by: Marin Petrunic <[email protected]>

* chore: Deprecate button clicks for tests (#195)

* sharedConst and signature check

* without sharedConst :)

* request accounts

* request accounts

* long typed data

* short typed data

* add token reject/accept

* add network accept/reject

* actually verify the lock/unlock

* contract interactions

* address comment

* web3-utils 1.3.4

* addToken and addNetwork use boolean

* remove useless wait

* chore: Update documentation and Readme (#202)

* docs

* change to metaMask accross the board and use bootstrap in our test

* MetaMMMMMMask

* snaps methods in API.md

* snaps usage in Readme.md

* Update README.md

Co-authored-by: Marin Petrunić <[email protected]>

* address comment

* add forgotten menu item for initSnapEnv

* removing jsdoc

Co-authored-by: Marin Petrunić <[email protected]>

* chore: Remove local server for dapp (#203)

* docs

* change to metaMask accross the board and use bootstrap in our test

* MetaMMMMMMask

* snaps methods in API.md

* snaps usage in Readme.md

* init

* lint

* add dev deps for ganache/console.log to make build pass

* Update README.md

Co-authored-by: Marin Petrunić <[email protected]>

* address comment

* add forgotten menu item for initSnapEnv

* removing jsdoc

Co-authored-by: Marin Petrunić <[email protected]>

* feat: Simplify `installSnap` and `initSnapEnv` apis (#206)

* simplify api

* remove stray comments

* fix undefined opts

* double question mark back :)

* Update src/snap/utils.ts

* 2s for my use case

* test perf

* elegant race with bad name

* chore: update web3 (#217)

chore: upgrade web3.js

* chore: update metamask version (#209)

* update recommended version

* chore: fix timeout for accept dialog (#218)

increase timeout for accept and reject dialog

* fix: increase viewport size (#219)

* Set viewport to most popular desktop resolution; fix for ChainSafe/dappeteer#208

Co-authored-by: Bernard Stojanović <[email protected]>

* fix: viewport typo (#220)

fix viewport typo

Co-authored-by: Maarten Zuidhoorn <[email protected]>
Co-authored-by: Bernard <[email protected]>
Co-authored-by: Anton Lykhoyda <[email protected]>
Co-authored-by: Thibaut Sardan <[email protected]>
venuswhispers added a commit to venuswhispers/My_dAppeteer that referenced this issue Feb 19, 2024
* chore: update web3 (#217)

chore: upgrade web3.js

* chore: update metamask version (#209)

* update recommended version

* chore: fix timeout for accept dialog (#218)

increase timeout for accept and reject dialog

* fix: increase viewport size (#219)

* Set viewport to most popular desktop resolution; fix for ChainSafe/dappeteer#208

Co-authored-by: Bernard Stojanović <[email protected]>

* fix: viewport typo (#220)

fix viewport typo

Co-authored-by: Anton Lykhoyda <[email protected]>
Co-authored-by: Bernard Stojanović <[email protected]>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
Status: Done/Closed
Development

No branches or pull requests

4 participants