test(send): add send success tests
This commit is contained in:
parent
172f26d842
commit
495bcd7548
|
@ -12,13 +12,13 @@ beforeAll(async () => {
|
|||
afterAll(() => app.stop());
|
||||
|
||||
describe('Send', () => {
|
||||
it('should load "Send Page"', async () => {
|
||||
test('should load "Send Page"', async () => {
|
||||
expect(app.client.element('#send-wrapper').isVisible()).resolves.toEqual(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
it('should show Additional Options click', async () => {
|
||||
test('should show Additional Options click', async () => {
|
||||
expect(
|
||||
app.client.element('#send-wrapper #send-fee-wrapper').isVisible(),
|
||||
).resolves.toEqual(false);
|
||||
|
@ -30,13 +30,13 @@ describe('Send', () => {
|
|||
).resolves.toEqual(true);
|
||||
});
|
||||
|
||||
it('disabled send button if required fields are empty', async () => {
|
||||
test('should disable send button if required fields are empty', async () => {
|
||||
expect(
|
||||
app.client.element('#send-submit-button').getAttribute('disabled'),
|
||||
).resolves.toEqual(true);
|
||||
});
|
||||
|
||||
it('enable send button if required fields are filled', async () => {
|
||||
test('should enable send button if required fields are filled', async () => {
|
||||
await app.client.element('#sidebar a:nth-child(1)').click();
|
||||
await app.client.element('#sidebar a:nth-child(2)').click();
|
||||
await app.client.element('#send-wrapper #select-component').click();
|
||||
|
@ -58,4 +58,93 @@ describe('Send', () => {
|
|||
).resolves.toEqual(false),
|
||||
);
|
||||
});
|
||||
|
||||
test('should show an error in invalid transaction', async () => {
|
||||
expect(app.client.element('#send-error-text').isVisible()).resolves.toEqual(
|
||||
false,
|
||||
);
|
||||
|
||||
await app.client.element('#sidebar a:nth-child(1)').click();
|
||||
await app.client.element('#sidebar a:nth-child(2)').click();
|
||||
await app.client.element('#send-wrapper #select-component').click();
|
||||
await app.client
|
||||
.element(
|
||||
'#send-wrapper #select-component #t3Pnbg7XjP7FGPBUuz75H65aczphHgkpoJW',
|
||||
)
|
||||
.click();
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=amount]')
|
||||
.setValue('0.484');
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=to]')
|
||||
.setValue('InvalidTOAddress');
|
||||
|
||||
await app.client.element('#send-submit-button').click();
|
||||
|
||||
expect(app.client.element('#send-error-text').isVisible()).resolves.toEqual(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('should show a success screen after transaction and show a transaction item', async () => {
|
||||
expect(
|
||||
app.client.element('#send-success-wrapper').isVisible(),
|
||||
).resolves.toEqual(false);
|
||||
|
||||
await app.client.element('#sidebar a:nth-child(1)').click();
|
||||
await app.client.element('#sidebar a:nth-child(2)').click();
|
||||
await app.client.element('#send-wrapper #select-component').click();
|
||||
await app.client
|
||||
.element(
|
||||
'#send-wrapper #select-component #t3Pnbg7XjP7FGPBUuz75H65aczphHgkpoJW',
|
||||
)
|
||||
.click();
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=amount]')
|
||||
.setValue('0.484');
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=to]')
|
||||
.setValue('t3Pnbg7XjP7FGasduz75HadsdzphHgkadW');
|
||||
|
||||
await app.client.element('#send-submit-button').click();
|
||||
|
||||
expect(
|
||||
app.client.element('#send-success-wrapper').isVisible(),
|
||||
).resolves.toEqual(true);
|
||||
|
||||
const successComponents = await app.client
|
||||
.elements('#send-success-wrapper p')
|
||||
.getText();
|
||||
|
||||
expect(successComponents[0]).toEqual(
|
||||
'Processing operation: operation-id-1',
|
||||
);
|
||||
expect(successComponents[1]).toEqual('Amount: 0.484');
|
||||
expect(successComponents[2]).toEqual(
|
||||
'From: t3Pnbg7XjP7FGPBUuz75H65aczphHgkpoJW',
|
||||
);
|
||||
expect(successComponents[3]).toEqual(
|
||||
'To: t3Pnbg7XjP7FGasduz75HadsdzphHgkadW',
|
||||
);
|
||||
|
||||
await app.client.element('#sidebar a:nth-child(1)').click();
|
||||
|
||||
await app.client.waitUntilTextExists(
|
||||
'#transaction-item-operation-id-1',
|
||||
'Send',
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#transaction-item-operation-id-1 img')
|
||||
.isVisible(),
|
||||
).toEqual(true);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
|
||||
.element('#transaction-item-operation-id-1 img')
|
||||
.getAttribute('src'),
|
||||
).toEndWith('/assets/transaction_sent_icon.svg');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue