Compare commits

...
Author SHA1 Message Date
Joe 1267713a87 test: base for transaction tests 2023-09-15 09:43:51 +01:00
4 changed files with 131 additions and 0 deletions
@@ -0,0 +1,24 @@
{
"transaction": {
"block": "10277448",
"index": 13,
"hash": "C79AE0040AE7CFE3EACD715E569B043B214D8451405CB40C06EAA1C38F453A85",
"submitter": "86ff2c3b45be7c43202d1dc370779d070faaba1029094c46174857f1b445673f",
"type": "Cancel Order",
"code": 0,
"cursor": "10277448.13",
"command": {
"nonce": "18292162483463539777",
"blockHeight": "10277444",
"orderCancellation": {
"orderId": "",
"marketId": ""
}
},
"signature": {
"value": "22a24614c3b19b5c6a7a979738dbda5cdeea39f61aabb937fb795f975ddc56a9e4823659024c29f1b9400939a502c4cf7fa10b946400d2b4f18caed6ac9f7d07",
"algo": "vega/ed25519",
"version": 1
}
}
}
@@ -0,0 +1,30 @@
{
"transaction": {
"block": "9319120",
"index": 0,
"hash": "28B2C9082E853F83958E91E9CA12343034CE7268DAF05EB987E6DB236C240208",
"submitter": "a80cc31c783829674a0f340a765e401f089349c706cc6c99401962aa3f663471",
"type": "Amend Order",
"code": 70,
"cursor": "9319120.0",
"command": {
"nonce": "13856472833343542396",
"blockHeight": "9319118",
"orderAmendment": {
"orderId": "a4a385ef2e8d8d508d129c91680fdd771374a21bd6fc49628a7e79cf53af1fbb",
"marketId": "e6561f69c2a76858866aab2896eeb529b46040614566e0665602d67bc682c31f",
"price": "13984",
"sizeDelta": "0",
"timeInForce": "TIME_IN_FORCE_GTC",
"peggedOffset": "",
"peggedReference": "PEGGED_REFERENCE_UNSPECIFIED"
}
},
"signature": {
"value": "43d6f047c7c11f96b15ccd18acaf2889ec902bcdc816b029ddd103576e303abca71e4ef06c41e9072f7623230586d7d85425784f935857c3838f1b9828be1a01",
"algo": "vega/ed25519",
"version": 1
},
"error": "couldn't insert order in book"
}
}
@@ -0,0 +1,64 @@
context('Transaction ID page', { tags: '@smoke' }, function () {
describe('Verify elements on transaction page', function () {
it.only('Able to view order cancelation', function () {
const txId =
'C79AE0040AE7CFE3EACD715E569B043B214D8451405CB40C06EAA1C38F453A85';
cy.intercept('GET', `/rest/transactions/${txId}`, {
fixture: '/mocks/cancel_order_transaction.json',
});
cy.visit(`/txs/${txId}`);
cy.validate_transaction_fields(0, 'Type', 'Cancel Order');
cy.validate_transaction_fields(
1,
'Hash',
'c79ae0040ae7cfe3eacd715e569b043b214d8451405cb40c06eaa1c38f453a85'
);
cy.validate_transaction_fields(
2,
'Submitter',
'86ff2c3b45be7c43202d1dc370779d070faaba1029094c46174857f1b445673f',
'/parties/86ff2c3b45be7c43202d1dc370779d070faaba1029094c46174857f1b445673f'
);
cy.validate_transaction_fields(
3,
'Block',
'10277448',
'/blocks/10277448'
);
cy.validate_transaction_fields(5, 'Response code', 'Success');
cy.contains('Show raw transaction').click();
cy.get('textarea').should(
'have.text',
'{\n "nonce": "18292162483463539777",\n "blockHeight": "10277444",\n "orderCancellation": {\n "orderId": "",\n "marketId": ""\n }\n}'
);
});
it('Able to view order amendment', function () {
const txId =
'0x28B2C9082E853F83958E91E9CA12343034CE7268DAF05EB987E6DB236C240208';
cy.intercept('GET', `/rest/transactions/${txId}`, {
fixture: '/mocks/order_amendment_transaction.json',
});
cy.visit(`/txs/${txId}`);
cy.validate_transaction_fields(0, 'Type', 'Amend Order');
cy.validate_transaction_fields(
4,
'Response code',
"couldn't insert order in book"
);
cy.validate_transaction_fields(
7,
'Order',
'a4a385ef2e8d8d508d129c91680fdd771374a21bd6fc49628a7e79cf53af1fbb'
);
cy.validate_transaction_fields(
8,
'Market',
'ETHBTC Quarterly (Jul 2023)',
'/markets/e6561f69c2a76858866aab2896eeb529b46040614566e0665602d67bc682c31f'
);
});
});
});
@@ -134,3 +134,16 @@ Cypress.Commands.add(
cy.contains(tableRowName).siblings().should('have.text', changeType);
}
);
Cypress.Commands.add(
'validate_transaction_fields',
(rowNum, rowName, rowValue, hrefUrl = null) => {
cy.get('tr')
.eq(rowNum)
.within(() => {
cy.get('td').eq(0).should('have.text', rowName);
cy.get('td').eq(1).should('have.text', rowValue);
if (hrefUrl) cy.get('a').should('have.attr', 'href', hrefUrl);
});
}
);