|
| 1 | +/* eslint-disable ui-testing/no-disabled-tests */ |
| 2 | +describe('Liquidation Tests', () => { |
| 3 | + let startTime; |
| 4 | + context('Setting up accounts', () => { |
| 5 | + it('should set up wallets for two members of the econ committee.', () => { |
| 6 | + cy.setupWallet({ |
| 7 | + secretWords: |
| 8 | + 'purse park grow equip size away dismiss used evolve live blouse scorpion enjoy crunch combine day second news off crowd broken crop zoo subject', |
| 9 | + walletName: 'gov2', |
| 10 | + }); |
| 11 | + cy.setupWallet({ |
| 12 | + secretWords: |
| 13 | + 'tilt add stairs mandate extra wash choose fashion earth feature reopen until move lazy carbon pledge sure own comfort this nasty clap tower table', |
| 14 | + walletName: 'gov1', |
| 15 | + }); |
| 16 | + }); |
| 17 | + |
| 18 | + it('should connect with chain and wallet', () => { |
| 19 | + cy.visit('/?agoricNet=local'); |
| 20 | + cy.acceptAccess(); |
| 21 | + }); |
| 22 | + }); |
| 23 | + |
| 24 | + context('Adjusting Vault Params', () => { |
| 25 | + it('should allow gov1 to create a proposal', () => { |
| 26 | + cy.visit('/?agoricNet=local'); |
| 27 | + |
| 28 | + cy.get('button').contains('Vaults').click(); |
| 29 | + cy.get('button').contains('Select Manager').click(); |
| 30 | + cy.get('button').contains('manager0').click(); |
| 31 | + |
| 32 | + cy.get('label') |
| 33 | + .contains('LiquidationMargin') |
| 34 | + .parent() |
| 35 | + .within(() => { |
| 36 | + cy.get('input').clear().type('150'); |
| 37 | + }); |
| 38 | + |
| 39 | + cy.get('label') |
| 40 | + .contains('LiquidationPadding') |
| 41 | + .parent() |
| 42 | + .within(() => { |
| 43 | + cy.get('input').clear().type('25'); |
| 44 | + }); |
| 45 | + |
| 46 | + cy.get('label') |
| 47 | + .contains('LiquidationPenalty') |
| 48 | + .parent() |
| 49 | + .within(() => { |
| 50 | + cy.get('input').clear().type('1'); |
| 51 | + }); |
| 52 | + |
| 53 | + cy.get('label') |
| 54 | + .contains('StabilityFee') |
| 55 | + .parent() |
| 56 | + .within(() => { |
| 57 | + cy.get('input').clear().type('1'); |
| 58 | + }); |
| 59 | + |
| 60 | + cy.get('label') |
| 61 | + .contains('MintFee') |
| 62 | + .parent() |
| 63 | + .within(() => { |
| 64 | + cy.get('input').clear().type('0.5'); |
| 65 | + }); |
| 66 | + |
| 67 | + cy.get('label') |
| 68 | + .contains('Minutes until close of vote') |
| 69 | + .parent() |
| 70 | + .within(() => { |
| 71 | + cy.get('input').clear().type(1); |
| 72 | + }); |
| 73 | + cy.get('[value="Propose Parameter Change"]').click(); |
| 74 | + |
| 75 | + cy.confirmTransaction(); |
| 76 | + cy.get('p') |
| 77 | + .contains('sent') |
| 78 | + .should('be.visible') |
| 79 | + .then(() => { |
| 80 | + startTime = Date.now(); |
| 81 | + }); |
| 82 | + }); |
| 83 | + |
| 84 | + it('should allow gov1 to vote on the proposal', () => { |
| 85 | + cy.visit('/?agoricNet=local'); |
| 86 | + |
| 87 | + cy.get('button').contains('Vote').click(); |
| 88 | + cy.get('p').contains('YES').click(); |
| 89 | + cy.get('input:enabled[value="Submit Vote"]').click(); |
| 90 | + |
| 91 | + cy.confirmTransaction(); |
| 92 | + cy.get('p').contains('sent').should('be.visible'); |
| 93 | + }); |
| 94 | + |
| 95 | + it('should allow gov2 to vote on the proposal', () => { |
| 96 | + cy.switchWallet('gov2'); |
| 97 | + cy.visit('/?agoricNet=local'); |
| 98 | + |
| 99 | + cy.get('button').contains('Vote').click(); |
| 100 | + cy.get('p').contains('YES').click(); |
| 101 | + cy.get('input:enabled[value="Submit Vote"]').click(); |
| 102 | + |
| 103 | + cy.confirmTransaction(); |
| 104 | + cy.get('p').contains('sent').should('be.visible'); |
| 105 | + }); |
| 106 | + |
| 107 | + it('should wait for proposal to pass', () => { |
| 108 | + cy.wait(60000 - Date.now() + startTime); |
| 109 | + cy.visit('/?agoricNet=local'); |
| 110 | + |
| 111 | + cy.get('button').contains('History').click(); |
| 112 | + |
| 113 | + cy.get('code') |
| 114 | + .contains('VaultFactory - ATOM') |
| 115 | + .parent() |
| 116 | + .parent() |
| 117 | + .parent() |
| 118 | + .within(() => { |
| 119 | + cy.get('span').contains('Change Accepted').should('be.visible'); |
| 120 | + }); |
| 121 | + }); |
| 122 | + }); |
| 123 | +}); |
0 commit comments