-
Notifications
You must be signed in to change notification settings - Fork 3
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
test: e2e tests added for repo #88
Merged
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,3 +22,7 @@ dist-ssr | |
*.njsproj | ||
*.sln | ||
*.sw? | ||
|
||
# E2E tests | ||
screenshots | ||
videos |
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
const path = require('path'); | ||
const synpressPath = path.join(process.cwd(), '/node_modules/@agoric/synpress'); | ||
|
||
module.exports = { | ||
extends: `${synpressPath}/.eslintrc.js`, | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,231 @@ | ||
/* eslint-disable ui-testing/no-disabled-tests */ | ||
describe('Make Proposal Tests', () => { | ||
let startTime; | ||
context('PSM tests', () => { | ||
it('should setup two econ committee member wallets', () => { | ||
cy.setupWallet({ | ||
secretWords: | ||
'purse park grow equip size away dismiss used evolve live blouse scorpion enjoy crunch combine day second news off crowd broken crop zoo subject', | ||
walletName: 'gov1', | ||
}); | ||
cy.setupWallet({ | ||
secretWords: | ||
'tilt add stairs mandate extra wash choose fashion earth feature reopen until move lazy carbon pledge sure own comfort this nasty clap tower table', | ||
walletName: 'gov2', | ||
}); | ||
}); | ||
|
||
it('should connect to wallet', () => { | ||
cy.visit('/?agoricNet=local'); | ||
cy.acceptAccess(); | ||
}); | ||
|
||
it('should have value of 1000 on psm inter', () => { | ||
cy.origin('https://psm.inter.trade', () => { | ||
cy.visit('/'); | ||
// Switch to local network | ||
cy.get('button').contains('Agoric Mainnet').click(); | ||
cy.get('button').contains('Local Network').click(); | ||
|
||
// Click the connect button | ||
cy.get('button').contains('Connect Keplr').click(); | ||
cy.get('input[type="checkbox"]').click(); | ||
cy.get('button:enabled').contains('Proceed').click(); | ||
}); | ||
|
||
// Accept access and confirm | ||
cy.acceptAccess(); | ||
|
||
cy.origin('https://psm.inter.trade', () => { | ||
cy.get('button').contains('Keplr Connected').should('be.visible'); | ||
|
||
// Select asset and verify original value | ||
cy.get('button').contains('Select asset').click(); | ||
cy.get('button').contains('USDT_axl').click(); | ||
cy.get('div') | ||
.contains('IST Available') | ||
.children() | ||
.first() | ||
.should('have.text', '1000.00'); | ||
}); | ||
}); | ||
|
||
it('should allow gov1 to create a proposal', () => { | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// open PSM and select USDT_axl | ||
cy.get('button').contains('PSM').click(); | ||
cy.get('button').contains('AUSD').click(); | ||
cy.get('button').contains('USDT_axl').click(); | ||
|
||
// Change mint limit to 100 and proposal time to 1 min | ||
cy.get('label') | ||
.contains('Set Mint Limit') | ||
.parent() | ||
.within(() => { | ||
cy.get('input').clear().type(100); | ||
}); | ||
cy.get('label') | ||
.contains('Minutes until close of vote') | ||
.parent() | ||
.within(() => { | ||
cy.get('input').clear().type(1); | ||
}); | ||
cy.get('[value="Propose Parameter Change"]').click(); | ||
|
||
// Submit proposal and wait for confirmation | ||
cy.confirmTransaction(); | ||
cy.get('p') | ||
.contains('sent') | ||
.should('be.visible') | ||
.then(() => { | ||
startTime = Date.now(); | ||
}); | ||
}); | ||
|
||
it('should allow gov2 to vote on the proposal', () => { | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// Open vote, click on yes and submit | ||
cy.get('button').contains('Vote').click(); | ||
cy.get('p').contains('YES').click(); | ||
cy.get('input:enabled[value="Submit Vote"]').click(); | ||
|
||
// Wait for vote to confirm | ||
cy.confirmTransaction(); | ||
cy.get('p').contains('sent').should('be.visible'); | ||
}); | ||
|
||
it('should allow gov1 to vote on the proposal', () => { | ||
cy.switchWallet('gov1'); | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// Open vote, click on yes and submit | ||
cy.get('button').contains('Vote').click(); | ||
cy.get('p').contains('YES').click(); | ||
cy.get('input:enabled[value="Submit Vote"]').click(); | ||
|
||
// Wait for vote to confirm | ||
cy.confirmTransaction(); | ||
cy.get('p').contains('sent').should('be.visible'); | ||
}); | ||
|
||
it('should wait for proposal to pass', () => { | ||
// Wait for 1 minute to pass | ||
cy.wait(60000 - Date.now() + startTime); | ||
cy.visit('/?agoricNet=local'); | ||
|
||
cy.get('button').contains('History').click(); | ||
|
||
// Select the first element proposal containing USDT_axl and check | ||
// its status should be accepted | ||
cy.get('code') | ||
.contains('psm-IST-USDT_axl') | ||
.parent() | ||
.parent() | ||
.parent() | ||
.within(() => { | ||
cy.get('span').contains('Change Accepted').should('be.visible'); | ||
}); | ||
}); | ||
|
||
it('should update the value of 100 on psm inter', () => { | ||
cy.origin('https://psm.inter.trade', () => { | ||
cy.visit('/'); | ||
|
||
// Click the connect button | ||
cy.get('button').contains('Connect Keplr').click(); | ||
cy.get('button').contains('Keplr Connected').should('be.visible'); | ||
|
||
// Select asset and verify new value | ||
cy.get('button').contains('Select asset').click(); | ||
cy.get('button').contains('USDT_axl').click(); | ||
cy.get('div') | ||
.contains('IST Available') | ||
.children() | ||
.first() | ||
.should('have.text', '100.00'); | ||
}); | ||
}); | ||
}); | ||
context('Vaults tests', () => { | ||
it('should allow gov1 to create a proposal', () => { | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// open Values and select manager 0 | ||
cy.get('button').contains('Vaults').click(); | ||
cy.get('button').contains('Select Manager').click(); | ||
cy.get('button').contains('manager0').click(); | ||
|
||
// Change debt limit to 1.22M and proposal time to 1 min | ||
cy.get('label') | ||
.contains('DebtLimit') | ||
.parent() | ||
.within(() => { | ||
cy.get('input').clear().type('122,000,000'); | ||
}); | ||
cy.get('label') | ||
.contains('Minutes until close of vote') | ||
.parent() | ||
.within(() => { | ||
cy.get('input').clear().type(1); | ||
}); | ||
cy.get('[value="Propose Parameter Change"]').click(); | ||
|
||
// Submit proposal and wait for confirmation | ||
cy.confirmTransaction(); | ||
cy.get('p') | ||
.contains('sent') | ||
.should('be.visible') | ||
.then(() => { | ||
startTime = Date.now(); | ||
}); | ||
}); | ||
|
||
it('should allow gov1 to vote on the proposal', () => { | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// Open vote, click on yes and submit | ||
cy.get('button').contains('Vote').click(); | ||
cy.get('p').contains('YES').click(); | ||
cy.get('input:enabled[value="Submit Vote"]').click(); | ||
|
||
// Wait for vote to confirm | ||
cy.confirmTransaction(); | ||
cy.get('p').contains('sent').should('be.visible'); | ||
}); | ||
|
||
it('should allow gov2 to vote on the proposal', () => { | ||
cy.switchWallet('gov2'); | ||
cy.visit('/?agoricNet=local'); | ||
|
||
// Open vote, click on yes and submit | ||
cy.get('button').contains('Vote').click(); | ||
cy.get('p').contains('YES').click(); | ||
cy.get('input:enabled[value="Submit Vote"]').click(); | ||
|
||
// Wait for vote to confirm | ||
cy.confirmTransaction(); | ||
cy.get('p').contains('sent').should('be.visible'); | ||
}); | ||
|
||
it('should wait for proposal to pass', () => { | ||
// Wait for 1 minute to pass | ||
cy.wait(60000 - Date.now() + startTime); | ||
cy.visit('/?agoricNet=local'); | ||
|
||
cy.get('button').contains('History').click(); | ||
|
||
// Select the first element proposal containing ATOM and check | ||
// its status should be accepted | ||
cy.get('code') | ||
.contains('VaultFactory - ATOM') | ||
.parent() | ||
.parent() | ||
.parent() | ||
.within(() => { | ||
cy.get('span').contains('Change Accepted').should('be.visible'); | ||
}); | ||
}); | ||
}); | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@agoric/synpress/support/index'; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
const config = require('@agoric/synpress/synpress.config'); | ||
const { defineConfig } = require('cypress'); | ||
|
||
module.exports = defineConfig({ | ||
...config, | ||
e2e: { | ||
...config.e2e, | ||
baseUrl: 'http://localhost:5173', | ||
}, | ||
}); |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,13 @@ | ||
import { mergeConfig } from 'vite'; | ||
import { defineConfig } from 'vitest/config'; | ||
import { defineConfig, configDefaults } from 'vitest/config'; | ||
import viteConfig from './vite.config'; | ||
|
||
export default mergeConfig( | ||
viteConfig, | ||
defineConfig({ | ||
test: { | ||
setupFiles: ['src/installSesLockdown.ts'], | ||
exclude: [...configDefaults.exclude, 'tests/e2e/**'], | ||
}, | ||
}), | ||
); |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Not sure if it's good to depend on the live UI here since a service disruption could impede workflows. Although, even when using a local build of PSM and connecting to a local chain, the app will make a request to https://wallet.agoric.app/network-config. Maybe it's enough to just check that the history item shows up with the new value, below the check for 'Change Accepted', instead of looking at the PSM app.
cc @turadg
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.
Good point, @samsiegart . Could the e2e tests intercept https://wallet.agoric.app/network-config to provide a local result?
I don't see this as a blocking concern for having these tests in CI, but it should be addressed before required green to merge. (I.e. adding it to branch protection)
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.
sounds good. I'll remove the check from the external PSM URL