-
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
test: e2e tests added for psm UI #125
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
4a546ed
test: boilerplate added for e2e tests
frazarshad 6bf2f2c
test: spec file created
frazarshad bc2f500
fix: swapping 1.25 tokens instead of 10
frazarshad b1d5f41
test: updated tests to verify change in IST value
frazarshad 71ecad7
fix: swapping 1 tokens instead of 1.25
frazarshad fff09f5
fix: excluding tests/e2e from vitest
frazarshad 79bb310
chore: fix for prettier
frazarshad 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
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,99 @@ | ||
/* eslint-disable ui-testing/no-disabled-tests */ | ||
describe('Swap Tokens Tests', () => { | ||
it(`should connect with Agoric Chain on https;//wallet.agoric.app`, () => { | ||
cy.origin('https://wallet.agoric.app/', () => { | ||
cy.visit('/'); | ||
}); | ||
cy.acceptAccess().then(taskCompleted => { | ||
expect(taskCompleted).to.be.true; | ||
}); | ||
|
||
cy.origin('https://wallet.agoric.app/', () => { | ||
cy.visit('/wallet/'); | ||
|
||
cy.get('input.PrivateSwitchBase-input').click(); | ||
cy.contains('Proceed').click(); | ||
|
||
cy.get('button[aria-label="Settings"]').click(); | ||
|
||
cy.get('#demo-simple-select').click(); | ||
cy.get('li[data-value="local"]').click(); | ||
cy.contains('button', 'Connect').click(); | ||
}); | ||
|
||
cy.acceptAccess().then(taskCompleted => { | ||
expect(taskCompleted).to.be.true; | ||
}); | ||
}); | ||
|
||
it('should connect with wallet', () => { | ||
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.get('button').contains('Keplr Connected').should('be.visible'); | ||
}); | ||
|
||
it('should swap tokens from IST to stable', () => { | ||
let ISTbalance; | ||
|
||
// Connect wallet | ||
cy.visit('/'); | ||
cy.get('button').contains('Connect Keplr').click(); | ||
|
||
cy.addNewTokensFound(); | ||
cy.getTokenAmount('IST').then(amount => (ISTbalance = amount)); | ||
|
||
// Select asset and swap positions | ||
cy.get('button').contains('Select asset').click(); | ||
cy.get('button').contains('USDC_axl').click(); | ||
cy.get('svg.transform.rotate-90').click(); | ||
|
||
// Swap 1 IST | ||
cy.get('input[type="number"]').first().type(1); | ||
cy.get('button').contains('Swap').click(); | ||
|
||
// Confirm transactions | ||
cy.confirmTransaction(); | ||
cy.get('div').contains('Swap Completed').should('be.visible'); | ||
|
||
cy.getTokenAmount('IST').then(amount => | ||
expect(amount).to.equal(ISTbalance - 1) | ||
); | ||
}); | ||
|
||
it('should swap tokens from stable to IST', () => { | ||
let ISTbalance; | ||
|
||
// Connect wallet | ||
cy.visit('/'); | ||
cy.get('button').contains('Connect Keplr').click(); | ||
|
||
cy.getTokenAmount('IST').then(amount => (ISTbalance = amount)); | ||
|
||
// Select asset | ||
cy.get('button').contains('Select asset').click(); | ||
cy.get('button').contains('USDC_axl').click(); | ||
|
||
// Swap 1 USDC_axl | ||
cy.get('input[type="number"]').first().type(1); | ||
cy.get('button').contains('Swap').click(); | ||
|
||
// Confirm transactions | ||
cy.confirmTransaction(); | ||
cy.get('div').contains('Swap Completed').should('be.visible'); | ||
|
||
cy.getTokenAmount('IST').then(amount => | ||
expect(amount).to.equal(ISTbalance + 1) | ||
); | ||
}); | ||
}); |
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
Oops, something went wrong.
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.
our style is camel case