-
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
Changes from 6 commits
4a546ed
6bf2f2c
bc2f500
b1d5f41
71ecad7
fff09f5
79bb310
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
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`, | ||
}; |
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) | ||
); | ||
}); | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
import '@agoric/synpress/support/index'; |
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', | ||
}, | ||
}); |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { mergeConfig } from 'vite'; | ||
import { defineConfig } from 'vitest/config'; | ||
import { defineConfig, configDefaults } from 'vitest/config'; | ||
import viteConfig from './vite.config'; | ||
|
||
export default mergeConfig( | ||
|
@@ -8,6 +8,10 @@ export default mergeConfig( | |
test: { | ||
setupFiles: ['src/installSesLockdown.ts'], | ||
environment: 'happy-dom', | ||
exclude: [ | ||
...configDefaults.exclude, | ||
'tests/e2e/**' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. alternately we could consider There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. if our goal is to simply config then just a head up: changing this path will require updating the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thanks for the heads up, I think we can consider separating the directories but not a blocker |
||
] | ||
}, | ||
}) | ||
); |
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