Skip to content

Commit

Permalink
feat: bash script for viewing bids from CLI
Browse files Browse the repository at this point in the history
  • Loading branch information
rabi-siddique committed Apr 19, 2024
1 parent 75e3f06 commit 210ae8a
Show file tree
Hide file tree
Showing 4 changed files with 38 additions and 8 deletions.
28 changes: 27 additions & 1 deletion test/e2e/specs/test.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,15 @@ describe('Wallet App Test Cases', () => {
});
});

it('should view the bid from CLI', () => {
cy.exec('bash ./test/e2e/test-scripts/view-bids.sh', {
failOnNonZeroExit: false,
}).then((result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('"give":{"Bid":"2.00 IST"}');
expect(result.stdout).to.contain('Your bid has been accepted');
});
});
it('should see an offer placed in the previous test case', () => {
cy.visit('/wallet/');

Expand Down Expand Up @@ -96,7 +105,15 @@ describe('Wallet App Test Cases', () => {
);
});
});

it('should view the bid from CLI', () => {
cy.exec('bash ./test/e2e/test-scripts/view-bids.sh', {
failOnNonZeroExit: false,
}).then((result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('"give":{"Bid":"1.00 IST"}');
expect(result.stdout).to.contain('Your bid has been accepted');
});
});
it('should see an offer placed in the previous test case', () => {
cy.visit('/wallet/');
cy.contains('Offer').should('be.visible');
Expand Down Expand Up @@ -130,5 +147,14 @@ describe('Wallet App Test Cases', () => {
expect(result.stdout).to.contain('All required fields are present');
});
});

it('should set ATOM price to 12.34', () => {
cy.exec('bash ./test/e2e/test-scripts/set-oracle-price.sh 12.34', {
failOnNonZeroExit: false,
}).then((result) => {
expect(result.stderr).to.contain('');
expect(result.stdout).to.contain('Success: Price set to 12.34');
});
});
});
});
8 changes: 3 additions & 5 deletions test/e2e/test-scripts/common.sh
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
#!/bin/bash

# Common variables
export AGORIC_NET=emerynet
export network=https://emerynet.rpc.agoric.net:443
export accountName="rabi-dev"

export mnemonicGov1="such field health riot cost kitten silly tube flash wrap festival portion imitate this make question host bitter puppy wait area glide soldier knee"
export mnemonicGov2="physical immune cargo feel crawl style fox require inhale law local glory cheese bring swear royal spy buyer diesel field when task spin alley"
export mnemonicUser1="tackle hen gap lady bike explain erode midnight marriage wide upset culture model select dial trial swim wood step scan intact what card symptom"
export mnemonicUser2="orbit bench unit task food shock brand bracket domain regular warfare company announce wheel grape trust sphere boy doctor half guard ritual three ecology"
export gov1AccountAddress=agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q
export gov2AccountAddress=agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277
export gov1Address=agoric1ee9hr0jyrxhy999y755mp862ljgycmwyp4pl7q
export gov2Address=agoric1wrfh296eu2z34p6pah7q04jjuyj3mxu9v98277
export user1Address=agoric1ydzxwh6f893jvpaslmaz6l8j2ulup9a7x8qvvq
export user2Address=agoric1p2aqakv3ulz4qfy2nut86j9gx0dx0yw09h96md

Expand Down
4 changes: 2 additions & 2 deletions test/e2e/test-scripts/set-oracle-price.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ fi
source ./test/e2e/test-scripts/common.sh


addKeyAndCheck "gov1" "$mnemonicGov1" "$gov1AccountAddress"
addKeyAndCheck "gov2" "$mnemonicGov2" "$gov2AccountAddress"
addKeyAndCheck "gov1" "$mnemonicGov1" "$gov1Address"
addKeyAndCheck "gov2" "$mnemonicGov2" "$gov2Address"
addKeyAndCheck "user1" "$mnemonicUser1" "$user1Address"

output=$(agops oracle setPrice --keys gov1,gov2 --pair ATOM.USD --price $1 --keyring-backend test)
Expand Down
6 changes: 6 additions & 0 deletions test/e2e/test-scripts/view-bids.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash

source ./test/e2e/test-scripts/common.sh

agops inter bid list --from $user2Address --keyring-backend=test 2>&1
wait

0 comments on commit 210ae8a

Please sign in to comment.