From 210ae8a57316f721a5ad28af2612c3bf4c8627ab Mon Sep 17 00:00:00 2001 From: rabi-siddique Date: Fri, 19 Apr 2024 21:02:31 +0500 Subject: [PATCH] feat: bash script for viewing bids from CLI --- test/e2e/specs/test.spec.js | 28 ++++++++++++++++++++++- test/e2e/test-scripts/common.sh | 8 +++---- test/e2e/test-scripts/set-oracle-price.sh | 4 ++-- test/e2e/test-scripts/view-bids.sh | 6 +++++ 4 files changed, 38 insertions(+), 8 deletions(-) create mode 100644 test/e2e/test-scripts/view-bids.sh diff --git a/test/e2e/specs/test.spec.js b/test/e2e/specs/test.spec.js index 46d2454a..80010032 100644 --- a/test/e2e/specs/test.spec.js +++ b/test/e2e/specs/test.spec.js @@ -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/'); @@ -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'); @@ -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'); + }); + }); }); }); diff --git a/test/e2e/test-scripts/common.sh b/test/e2e/test-scripts/common.sh index a488961a..d96727f0 100644 --- a/test/e2e/test-scripts/common.sh +++ b/test/e2e/test-scripts/common.sh @@ -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 diff --git a/test/e2e/test-scripts/set-oracle-price.sh b/test/e2e/test-scripts/set-oracle-price.sh index 9f96394e..bcf94b33 100644 --- a/test/e2e/test-scripts/set-oracle-price.sh +++ b/test/e2e/test-scripts/set-oracle-price.sh @@ -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) diff --git a/test/e2e/test-scripts/view-bids.sh b/test/e2e/test-scripts/view-bids.sh new file mode 100644 index 00000000..0185c7bb --- /dev/null +++ b/test/e2e/test-scripts/view-bids.sh @@ -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 \ No newline at end of file