Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Playwright config and Wallet Connection Test #507

Merged
merged 2 commits into from
Sep 22, 2022

Conversation

SudoPumpkin
Copy link
Contributor

@SudoPumpkin SudoPumpkin commented Sep 21, 2022

Description

Playwright has been installed in this PR with 2 tests.
One test confirms navigation to the Fractal app via http://localhost:3000.
The second test navigates to http://localhost:3000, confirms local wallet is present, and connects to the wallet.

A GitHub Actions yml has not been included as of yet.

Notes

The user will need to run a local version of hardhat(blockchain node), start the fractal-interface app, then run the playwright tests.

Issue (if applicable)

Testing

  1. Clone repo
  2. Open a terminal(A)
  3. Install dependencies: npm i npx playwright install
  4. Add a .env.local file to the root of the project with the following information:
    Comment these out when not trying to run these tests
REACT_APP_LOCAL_CHAIN_ID="31337"
REACT_APP_LOCAL_PROVIDER_URL="http://127.0.0.1:8545"
  1. Open another terminal(B)
  2. Start local hardhat node: npx hardhat node
  3. Open a third terminal(C)
  4. Start fractal-interface app: npm start
  5. Run Playwright tests: npx playwright test in terminal 'A'
  6. (2) Tests should run and pass

To test individual tests use the following:

  • npx playwright test tests/nameOfTest

Example:
npx playwright test tests/ConfirmWalletConnect.spec.ts

To view the tests in a browser(Headful) append the following to your command line:

  • --headed

Example:
npx playwright test tests/ConfirmWalletConnect.spec.ts --headed

To use particular browser types append the following to your command line:

  • --project=browserName

Example:
npx playwright test tests/ConfirmWalletConnect.spec.ts --headed --project=chromium

Screenshots (if applicable)

@netlify
Copy link

netlify bot commented Sep 21, 2022

Deploy Preview for fractal-framework-interface-dev ready!

Name Link
🔨 Latest commit 94aa257
🔍 Latest deploy log https://app.netlify.com/sites/fractal-framework-interface-dev/deploys/632b67eca288710009537d58
😎 Deploy Preview https://deploy-preview-507--fractal-framework-interface-dev.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

Copy link
Contributor

@Da-Colon Da-Colon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. 2 notes and 2 changes

Removed tests-examples from tsconfig.json/.gitignore
@Da-Colon Da-Colon marked this pull request as ready for review September 22, 2022 02:22
Copy link
Contributor

@Da-Colon Da-Colon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@herbig
Copy link
Contributor

herbig commented Sep 22, 2022

Hey @SudoPumpkin ! This is looking great!

First thing I encountered, the tests failed because the browsers weren't installed. I was able to fix this with npx playwright install between steps 3/4, though it seems like npm i should have covered this? I'm not really sure.

Screen Shot 2022-09-22 at 11 11 37 AM

After that, I was able to get the first three tests to pass, NavigateToFractal, but ConfirmWalletConnect tests fail, and it seems like it gets hung up on the wallet connect QR:

84cc575de84edeb083587000e254b8f1f8720e57.webm

Could @Da-Colon or @mudrila try running this locally as well (using the Testing steps above), and see if you encounter the same issues?

@Da-Colon
Copy link
Contributor

@herbig Are you running a local hardhat node when running the tests?

There is one step here that is missing.

Adding to .env.local

REACT_APP_LOCAL_CHAIN_ID="31337"
REACT_APP_LOCAL_PROVIDER_URL="http://127.0.0.1:8545"

I would comment these out when not trying to run these tests but these are needed currently for the tests to run

@Da-Colon
Copy link
Contributor

@herbig

In the future this will all run in a dockerized container and there will be no need to set these here

@herbig
Copy link
Contributor

herbig commented Sep 22, 2022

.env.local

dammit, cool will do that.

Yeah I realize this will be dockerized, just wanted to make sure it's working locally just as a spot check

@herbig
Copy link
Contributor

herbig commented Sep 22, 2022

@herbig Are you running a local hardhat node when running the tests?

There is one step here that is missing.

Adding to .env.local

REACT_APP_LOCAL_CHAIN_ID="31337"
REACT_APP_LOCAL_PROVIDER_URL="http://127.0.0.1:8545"

I would comment these out when not trying to run these tests but these are needed currently for the tests to run

@Da-Colon I added these to .env.local and that test still fails.

Screen Shot 2022-09-22 at 12 29 14 PM

Is it working locally for you?

@herbig herbig self-requested a review September 22, 2022 17:02
Copy link
Contributor

@herbig herbig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Got it working and tests passed!

Base automatically changed from web3Provider-update/local-node-signer to develop September 22, 2022 17:05
@Da-Colon Da-Colon merged commit 31e97a1 into develop Sep 22, 2022
@Da-Colon Da-Colon deleted the pumpkin/add-playwright branch September 22, 2022 17:10
@adamgall
Copy link
Member

I was able to fix this with npx playwright install between steps 3/4, though it seems like npm i should have covered this? I'm not really sure.

@herbig I ran into the same thing. I see that @SudoPumpkin added this step into the instructions in this PR, but I agree that running npx playwright install after doing a basic npm install seems weird. I was able to "fix" this by adding playwright to the package.json file as an additional devDependency.

@Da-Colon
Copy link
Contributor

Da-Colon commented Sep 22, 2022

o weird I didn't have to do npx playwright install just a normal npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants