-
Notifications
You must be signed in to change notification settings - Fork 5
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
Updates to CI/CD to use Agoric chain and Offer up DApp #4
Conversation
512bce6
to
9609826
Compare
Can you not add Offer Up code here and instead add it's original repo as a submodule? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are we many .github/workflows.. disabling the workflows?
- synpress | ||
container_name: agoric_chain | ||
image: frazarshad/offerup-test-chain:1.0.0 | ||
platform: linux/amd64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just wanted to know that is frazarshad/offerup-test-chain:1.0.0
intended to be a permanent image for our deployments, or can we expect to switch to another image provided by the company?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no this a temporary solution until we have a better place to keep this image.
the idea is to use the Offer up app as a base to create a separate keplr test dapp similar to how metamask has its own test dapp https://metamask.github.io/test-dapp/ We can plan to move it to a separate repo in a new PR. creating a separate directory for the UI/ and contract/ for now to make the code cleaner |
@toliaqat most of those workflows are the same, they run the same test suite just with different parameters (headless / headed ). + other workflows for verifying styling, release cycle which we don't need in our code base. so I've put them in the disabled folder for now |
@frazarshad Are these tests failing now? I don't understand why we want them disabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few comments.
And I am still not sure why we are disabling existing workflows.
@@ -0,0 +1,2 @@ | |||
packages: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the purpose of this new file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its for managing workspaces in pnpm. it allows us to define the different packages in our monorepo and install dependencies of both packages in a node_modules folder
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left few more commants.
You can break this PR into 2 PRs. One is for adding contract code, and second about CI/CD.
@toliaqat these github actions dont currently work and will require some rework. so ive disabled them for now since they are the same as the |
334bc62
to
cbcff03
Compare
@@ -8,11 +8,7 @@ RUN apt update && apt install -y nginx | |||
|
|||
COPY nginx.conf /etc/nginx/sites-available/default | |||
|
|||
COPY package.json ./ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why you needed to make this change?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
COPY . .
will do the same. no need to do it twice
entrypoint: [] | ||
working_dir: /app | ||
volumes: | ||
- ./docker/videos:/app/tests/e2e/videos | ||
- ./docker/screenshots:/app/tests/e2e/screenshots | ||
command: > | ||
bash -c 'echo -n "======> local noVNC URL: http://localhost:8080/vnc.html?autoconnect=true " && pnpm wait-on http://display:8080 && echo -n "======> remote noVNC URL: " && curl -s ngrok:4040/api/tunnels | jq -r .tunnels[0].public_url && nginx && pnpm test:e2e:anvil' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what is anvil used for? Is this change going to disable metamask tests?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes the file is currently only running our keplr tests. anvil is a tool used in the metamask tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@frazarshad , Please add an issue in https://github.com/agoric-labs/synpress/issues to support metamask tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
created the issue
ui/src/App.tsx
Outdated
|
||
const connectWallet = async () => { | ||
await suggestChain(`http://localhost:3004/${RUN_ENV}`); | ||
const wallet = await makeAgoricWalletConnection(watcher, ENDPOINTS.RPC); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not add this URL as an env variable? Is this the only change we making in UI-related code?
If this is the only change we're making then we can use a conditional to decide with what param suggestChain
is called. The conditional can be decided based on the value of some env variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is what the current implementation does as well
ui/src/App.tsx
Outdated
const RUN_ENV = import.meta.env.VITE_RUN_ENV || 'localhost'; | ||
if (!['localhost', 'agoric_chain'].includes(RUN_ENV)) | ||
throw new Error("VITE_RUN_ENV can only be 'agoric_chain' or 'localhost'"); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
NIT:
const VALID_RUN_ENVIRONMENTS = ['localhost', 'agoric_chain'];
const DEFAULT_RUN_ENVIRONMENT = 'localhost';
const RUN_ENV = import.meta.env.VITE_RUN_ENV || DEFAULT_RUN_ENVIRONMENT;
if (!VALID_RUN_ENVIRONMENTS.includes(RUN_ENV)) {
throw new Error(`Whatever Message`)
}
package.json
Outdated
"start:contract": "cd contract && pnpm start", | ||
"start:ui": "cd ui && pnpm dev", | ||
"start:contract": "cd tools/contract && pnpm start", | ||
"start:ui": "cd tools/ui && pnpm dev", | ||
"start:json-server": "json-server json-server-db.json --port 3004", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we use dapp
as the folder name instead of tools
?
dapp
is more intention revealing what the folder contents would be.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the folder contains multiple things including the dapp. so it needed a more generic naming
* Remove leftover TODOs * Remove text based locators * Add `Known problems with MetaMask` section * Remove Promise wrap from `cy.setupMetamask()` (Synthetixio#927) * Fix localized Chrome's extension id (Synthetixio#928) * Fix localized Chrome's extension id * Improve id handling --------- Co-authored-by: Piotr Frankowski <[email protected]> * Lint * Feature/revoke permission to all (Synthetixio#932) * Fix typo in Permission word * Add permission revoking actions * Add tests for permission revoking actions * Regenerate synpress commands file * Add `switchNetwork` option to `acceptAccess` function * Add new release section to README * Use `goerli` for testing (Synthetixio#1082) * Use `goerli` for testing * Trigger tests * Add `shouldWaitForPopupClosure` option to approvals and txs (Synthetixio#1081) * feature: intial setup for integration of keplr * chore: use Error object for throwing an error related to invalid extension name * Adding Keplr Interaction for Importing Wallet using Private Key (#2) * feature: adding keplr interaction for creating an account using private key * feature: keplr interaction for importing an existing wallet and creating a new wallet * fix: fixed implementation of waitAndClickByText to perform exact matching --------- Co-authored-by: Fraz Arshad <[email protected]> * Disconnect Wallet Interaction (#7) * chore: removing call to acceptAccess function * feature: adding intereaction for disconnecting with wallet * remve the default arg * Added Interaction to handle rejection of wallet connection (#8) * feat: added code to handle reject wallet access * feat: added test case for reject wallet access + modified test structure * Include code for Offer up Dapp (#10) * feat(ci): Included ui/ and contract/ from offer-up-dapp (with changes) * refactor: moved ui/ and contract/ to tools/ folder * Updates to CI/CD to use Agoric chain and Offer up DApp (#4) * feat(ci): Included ui/ and contract/ from offer-up-dapp (with changes) * feat(ci): Updated CI to use agoric chain + offer up dapp * fix(ci): updated scripts in package.json * refactor(ci): Moved ui/ and contract/ to tools/ * refactor: moved json-server-db.json to tools folder * Single Screen Interaction, Approve Button Fix and Code Cleanup (#9) * chore: organize code in playwright.keplr.js and remove not used states * chore: resolve merge conflicts with dev branch * chore: using a consistent and more intention revealing name for a helper function * chore: adding a test case for validating the switchToExtensionWindow function * chore: change selector for Approve button on connecting with wallet UI * chore: addressing PR comments * Interaction for transaction rejection (#12) * feat: added logic for transaction rejection * feat: added test for transaction rejection * fix: typo in test name * chore:remove call to switchToKeplrWindow in metamask.js (#16) * Abstracting Calls to Switching Extension in Keplr Helper Methods (#13) * chore: abstracting calls to switching to keplr window in keplr helper functions * chore: removing unnecessary awaits with sync function * Enable setup of the keplr extension in the beforeAll hook for cypress (#14) * fix: added code to handle setup of keplr wallet beforehand * chore: lint fixes * Add command to switch to another wallet (#18) * feat: interaction to switch wallet * chore: fixes for await async * Getting Wallet Address (#17) * feat: initial working setup for retrieving wallet address * chore:code cleanup * feat: interaction to switch wallet * chore: simplifying switching screens in import wallet flow * chore format code with prettier * chore: moving get wallet address test case in the main context * chore: fixes for await async * chore: address PR comments --------- Co-authored-by: Fraz Arshad <[email protected]> * Added Interaction to get the value of a certain token (#19) * feat: added command to get tokens * chore: await/async fixes * Updates to CI/CD flow (#20) * ci: new docker ci file for keplr * ci: using docker workflow instead of debug workflow temporarily * ci: updated config to have not retires in ci * Adding Selecting Chain Interaction And Flow Improvements (#21) * chore: changing the flow of test cases; starting by creating a new wallet rather than importing * feature: adding behavior in import wallet flow to select a chain when importing/creating wallet * feature: adding helper methods to click elements in a reliable way * chore: using helper methods inside keplr.js * chore: handling edge case for grabbing token values when values are large numbers containing commas * chore: updating selector for getting wallet address and adding test cases to validate the behavior * chore: addressing PR comments * chore: addressing PR comments * chore: replacing Agoric local with Agoric localhost * feat: included settings to setup npm (#22) * refactor: changed args for setupWallet (#24) * Added automatic linting to the repository (#23) * style:changing settings for linting * style: fixes to lint + styling throughout repo * Enabled CI Pipeline for NPM deployment (#25) * feat: release workflow enabled * feat: added CI cache folders to .npmignore * chore: revert back to master after testing --------- Co-authored-by: duckception <[email protected]> Co-authored-by: Peter F <[email protected]> Co-authored-by: Piotr Frankowski <[email protected]> Co-authored-by: Rafał Majchrzak <[email protected]> Co-authored-by: rabi-siddique <[email protected]> Co-authored-by: Rabi Siddique <[email protected]>
* Remove leftover TODOs * Remove text based locators * Add `Known problems with MetaMask` section * Remove Promise wrap from `cy.setupMetamask()` (Synthetixio#927) * Fix localized Chrome's extension id (Synthetixio#928) * Fix localized Chrome's extension id * Improve id handling --------- Co-authored-by: Piotr Frankowski <[email protected]> * Lint * Feature/revoke permission to all (Synthetixio#932) * Fix typo in Permission word * Add permission revoking actions * Add tests for permission revoking actions * Regenerate synpress commands file * Add `switchNetwork` option to `acceptAccess` function * Add new release section to README * Use `goerli` for testing (Synthetixio#1082) * Use `goerli` for testing * Trigger tests * Add `shouldWaitForPopupClosure` option to approvals and txs (Synthetixio#1081) * feature: intial setup for integration of keplr * chore: use Error object for throwing an error related to invalid extension name * Adding Keplr Interaction for Importing Wallet using Private Key (#2) * feature: adding keplr interaction for creating an account using private key * feature: keplr interaction for importing an existing wallet and creating a new wallet * fix: fixed implementation of waitAndClickByText to perform exact matching --------- Co-authored-by: Fraz Arshad <[email protected]> * Disconnect Wallet Interaction (#7) * chore: removing call to acceptAccess function * feature: adding intereaction for disconnecting with wallet * remve the default arg * Added Interaction to handle rejection of wallet connection (#8) * feat: added code to handle reject wallet access * feat: added test case for reject wallet access + modified test structure * Include code for Offer up Dapp (#10) * feat(ci): Included ui/ and contract/ from offer-up-dapp (with changes) * refactor: moved ui/ and contract/ to tools/ folder * Updates to CI/CD to use Agoric chain and Offer up DApp (#4) * feat(ci): Included ui/ and contract/ from offer-up-dapp (with changes) * feat(ci): Updated CI to use agoric chain + offer up dapp * fix(ci): updated scripts in package.json * refactor(ci): Moved ui/ and contract/ to tools/ * refactor: moved json-server-db.json to tools folder * Single Screen Interaction, Approve Button Fix and Code Cleanup (#9) * chore: organize code in playwright.keplr.js and remove not used states * chore: resolve merge conflicts with dev branch * chore: using a consistent and more intention revealing name for a helper function * chore: adding a test case for validating the switchToExtensionWindow function * chore: change selector for Approve button on connecting with wallet UI * chore: addressing PR comments * Interaction for transaction rejection (#12) * feat: added logic for transaction rejection * feat: added test for transaction rejection * fix: typo in test name * chore:remove call to switchToKeplrWindow in metamask.js (#16) * Abstracting Calls to Switching Extension in Keplr Helper Methods (#13) * chore: abstracting calls to switching to keplr window in keplr helper functions * chore: removing unnecessary awaits with sync function * Enable setup of the keplr extension in the beforeAll hook for cypress (#14) * fix: added code to handle setup of keplr wallet beforehand * chore: lint fixes * Add command to switch to another wallet (#18) * feat: interaction to switch wallet * chore: fixes for await async * Getting Wallet Address (#17) * feat: initial working setup for retrieving wallet address * chore:code cleanup * feat: interaction to switch wallet * chore: simplifying switching screens in import wallet flow * chore format code with prettier * chore: moving get wallet address test case in the main context * chore: fixes for await async * chore: address PR comments --------- Co-authored-by: Fraz Arshad <[email protected]> * Added Interaction to get the value of a certain token (#19) * feat: added command to get tokens * chore: await/async fixes * Updates to CI/CD flow (#20) * ci: new docker ci file for keplr * ci: using docker workflow instead of debug workflow temporarily * ci: updated config to have not retires in ci * Adding Selecting Chain Interaction And Flow Improvements (#21) * chore: changing the flow of test cases; starting by creating a new wallet rather than importing * feature: adding behavior in import wallet flow to select a chain when importing/creating wallet * feature: adding helper methods to click elements in a reliable way * chore: using helper methods inside keplr.js * chore: handling edge case for grabbing token values when values are large numbers containing commas * chore: updating selector for getting wallet address and adding test cases to validate the behavior * chore: addressing PR comments * chore: addressing PR comments * chore: replacing Agoric local with Agoric localhost * feat: included settings to setup npm (#22) * refactor: changed args for setupWallet (#24) * Added automatic linting to the repository (#23) * style:changing settings for linting * style: fixes to lint + styling throughout repo * Enabled CI Pipeline for NPM deployment (#25) * feat: release workflow enabled * feat: added CI cache folders to .npmignore * chore: revert back to master after testing * Fix for switching between keplr windows with same url (#27) * fix: checking added for window instance * test: test added for edge case * fix: added click after timeout to resolve flakiness (#28) * Updated README.md (#29) * docs: updated README.md * docs: added env section to readme * docs: 24 words memonics --------- Co-authored-by: duckception <[email protected]> Co-authored-by: Peter F <[email protected]> Co-authored-by: Piotr Frankowski <[email protected]> Co-authored-by: Rafał Majchrzak <[email protected]> Co-authored-by: rabi-siddique <[email protected]> Co-authored-by: Rabi Siddique <[email protected]>
Motivation and context
This PR does the following:
Test can be performed using the following command:
pnpm test:e2e:keplr
./start_tests.sh