test(e2e): fix e2e tests
This commit is contained in:
parent
1c529ccaec
commit
2fb5d2683d
|
@ -6,7 +6,7 @@ const app = getApp();
|
|||
beforeAll(async () => {
|
||||
await app.start();
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Console', 120000);
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Console');
|
||||
});
|
||||
afterAll(() => app.stop());
|
||||
|
||||
|
@ -14,12 +14,10 @@ describe('Console', () => {
|
|||
test('should load "Console Page"', async () => {
|
||||
await app.client.element('#sidebar a:nth-child(6)').click();
|
||||
|
||||
expect(app.client.getText('#header p:first-child')).resolves.toEqual(
|
||||
'Console',
|
||||
);
|
||||
expect(app.client.getText('#header p:first-child')).resolves.toEqual('Console');
|
||||
|
||||
expect(
|
||||
app.client.element('#console-wrapper img').getAttribute('src'),
|
||||
).resolves.toEqual(expect.stringContaining('/assets/console_zcash.png'));
|
||||
expect(app.client.element('#console-wrapper img').getAttribute('src')).resolves.toEqual(
|
||||
expect.stringContaining('/assets/console_zcash.png'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -3,37 +3,35 @@ import { getApp } from '../setup/utils';
|
|||
|
||||
const app = getApp();
|
||||
|
||||
beforeAll(async () => {
|
||||
beforeEach(async () => {
|
||||
await app.start();
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Send', 120000);
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Send');
|
||||
await app.client.element('#sidebar a:nth-child(2)').click();
|
||||
});
|
||||
afterAll(() => app.stop());
|
||||
afterEach(() => app.stop());
|
||||
|
||||
describe('Send', () => {
|
||||
test('should load "Send Page"', async () => {
|
||||
expect(app.client.element('#send-wrapper').isVisible()).resolves.toEqual(
|
||||
expect(app.client.element('#send-wrapper').isVisible()).resolves.toEqual(true);
|
||||
});
|
||||
|
||||
test('should show Additional Options click', async () => {
|
||||
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
|
||||
false,
|
||||
);
|
||||
|
||||
await app.client.element('#send-show-additional-options-button').click();
|
||||
|
||||
expect(app.client.element('#send-wrapper #send-fee-wrapper').isVisible()).resolves.toEqual(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('should show Additional Options click', async () => {
|
||||
expect(
|
||||
app.client.element('#send-wrapper #send-fee-wrapper').isVisible(),
|
||||
).resolves.toEqual(false);
|
||||
|
||||
await app.client.element('#send-show-additional-options-button').click();
|
||||
|
||||
expect(
|
||||
app.client.element('#send-wrapper #send-fee-wrapper').isVisible(),
|
||||
).resolves.toEqual(true);
|
||||
});
|
||||
|
||||
test('should disable send button if required fields are empty', async () => {
|
||||
expect(
|
||||
app.client.element('#send-submit-button').getAttribute('disabled'),
|
||||
).resolves.toEqual(true);
|
||||
expect(app.client.element('#send-submit-button').getAttribute('disabled')).resolves.toEqual(
|
||||
true,
|
||||
);
|
||||
});
|
||||
|
||||
test('should enable send button if required fields are filled', async () => {
|
||||
|
@ -41,110 +39,119 @@ describe('Send', () => {
|
|||
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',
|
||||
)
|
||||
.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=amount]').setValue('0.484');
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=to]')
|
||||
.setValue('t14oHp2v54vfmdgQ3v3SNuQga8JKHTNi2a1');
|
||||
|
||||
expect(
|
||||
expect(
|
||||
app.client.element('#send-submit-button').getAttribute('disabled'),
|
||||
).resolves.toEqual(false),
|
||||
expect(app.client.element('#send-submit-button').getAttribute('disabled')).resolves.toEqual(
|
||||
false,
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('should show an error in invalid transaction', async () => {
|
||||
expect(app.client.element('#send-error-text').isVisible()).resolves.toEqual(
|
||||
false,
|
||||
);
|
||||
|
||||
test('should show confirm transaction modal', 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();
|
||||
await app.client
|
||||
.element(
|
||||
'#send-wrapper #select-component #t3Pnbg7XjP7FGPBUuz75H65aczphHgkpoJW',
|
||||
)
|
||||
.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=amount]').setValue('0.484');
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=to]')
|
||||
.setValue('InvalidTOAddress');
|
||||
.setValue('tmMEBdrnRRRMKSUUC9SWdSova7V8NmHBqET');
|
||||
|
||||
await app.client.element('#send-submit-button').click();
|
||||
|
||||
expect(app.client.element('#send-error-text').isVisible()).resolves.toEqual(
|
||||
expect(app.client.element('#send-confirm-transaction-modal').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);
|
||||
test('should display a load indicator while the transaction is processed', 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();
|
||||
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('tmMEBdrnRRRMKSUUC9SWdSova7V8NmHBqET');
|
||||
|
||||
await app.client.element('#send-submit-button').click();
|
||||
await app.client.element('#confirm-modal-button').click();
|
||||
expect(app.client.getAttribute('#send-confirm-transaction-modal img', 'src')).resolves.toEqual(
|
||||
expect.stringContaining('/assets/sync_icon.png'),
|
||||
);
|
||||
expect(app.client.getText('#send-confirm-transaction-modal p')).resolves.toEqual(
|
||||
'Processing transaction...',
|
||||
);
|
||||
expect(app.client.element('#confirm-modal-button').isVisible()).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',
|
||||
)
|
||||
.element('#send-wrapper #select-component #t3Pnbg7XjP7FGPBUuz75H65aczphHgkpoJW')
|
||||
.click();
|
||||
await app.client.element('#send-wrapper input[name=amount]').setValue('-500');
|
||||
await app.client
|
||||
.element('#send-wrapper input[name=amount]')
|
||||
.setValue('0.484');
|
||||
.element('#send-wrapper input[name=to]')
|
||||
.setValue('tmMEBdrnRRRMKSUUC9SWdSova7V8NmHBqET');
|
||||
|
||||
await app.client.element('#send-submit-button').click();
|
||||
await app.client.element('#confirm-modal-button').click();
|
||||
|
||||
expect(
|
||||
app.client
|
||||
.element('#send-error-message')
|
||||
.waitForVisible()
|
||||
.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();
|
||||
await app.client.element('#confirm-modal-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
|
||||
.waitForVisible('#send-success-wrapper')
|
||||
.element('#send-confirm-transaction-modal button')
|
||||
.click();
|
||||
await app.client.element('#sidebar a:nth-child(1)').click();
|
||||
|
||||
await app.client.waitUntilTextExists(
|
||||
'#transaction-item-operation-id-1',
|
||||
'Send',
|
||||
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')
|
||||
.isVisible(),
|
||||
).toEqual(true);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
|
||||
.element('#transaction-item-operation-id-1 img')
|
||||
.getAttribute('src'),
|
||||
await app.client.element('#transaction-item-operation-id-1 img').getAttribute('src'),
|
||||
).toEndWith('/assets/transaction_sent_icon.svg');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,7 +7,7 @@ const app = getApp();
|
|||
beforeAll(async () => {
|
||||
await app.start();
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Dashboard', 120000);
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Dashboard');
|
||||
});
|
||||
afterAll(() => app.stop());
|
||||
|
||||
|
@ -17,15 +17,13 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(1)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Dashboard'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(1)').getHTML()).toEqual(
|
||||
expect.stringContaining('Dashboard'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(1) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/dashboard_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(1) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/dashboard_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
|
||||
test('should see the active send route', async () => {
|
||||
|
@ -33,15 +31,13 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/send');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(2)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Send'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(2)').getHTML()).toEqual(
|
||||
expect.stringContaining('Send'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(2) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/send_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(2) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/send_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
|
||||
test('should see the active receive route', async () => {
|
||||
|
@ -49,15 +45,13 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/receive');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(3)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Receive'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(3)').getHTML()).toEqual(
|
||||
expect.stringContaining('Receive'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(3) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/receive_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(3) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/receive_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
|
||||
test('should see the active transactions route', async () => {
|
||||
|
@ -65,15 +59,13 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/transactions');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(4)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Transactions'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(4)').getHTML()).toEqual(
|
||||
expect.stringContaining('Transactions'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(4) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/transactions_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(4) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/transactions_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
|
||||
test('should see the active settings route', async () => {
|
||||
|
@ -81,15 +73,13 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/settings');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(5)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Settings'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(5)').getHTML()).toEqual(
|
||||
expect.stringContaining('Settings'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(5) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/settings_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(5) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/settings_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
|
||||
test('should see the active console route', async () => {
|
||||
|
@ -97,14 +87,12 @@ describe('Sidebar', () => {
|
|||
|
||||
expect(await app.client.getUrl()).toEndWith('/console');
|
||||
|
||||
expect(
|
||||
await app.client.element('#sidebar a:nth-child(6)').getHTML(),
|
||||
).toEqual(expect.stringContaining('Console'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(6)').getHTML()).toEqual(
|
||||
expect.stringContaining('Console'),
|
||||
);
|
||||
|
||||
expect(
|
||||
await app.client
|
||||
.element('#sidebar a:nth-child(6) img')
|
||||
.getAttribute('src'),
|
||||
).toEqual(expect.stringContaining('/assets/console_icon_active.svg'));
|
||||
expect(await app.client.element('#sidebar a:nth-child(6) img').getAttribute('src')).toEqual(
|
||||
expect.stringContaining('/assets/console_icon_active.svg'),
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,25 +11,21 @@ beforeAll(async () => {
|
|||
afterAll(() => app.stop());
|
||||
|
||||
describe('Startup', () => {
|
||||
test('should open the window', async () => expect(await app.client.getWindowCount()).toEqual(1));
|
||||
test('should open the window', () => expect(app.client.getWindowCount()).resolves.toEqual(1));
|
||||
|
||||
test('should have the right title', async () => {
|
||||
expect(await app.client.getTitle()).toEqual('ZEC Wallet');
|
||||
test('should have the right title', () => {
|
||||
expect(app.client.getTitle()).resolves.toEqual('ZEC Wallet');
|
||||
});
|
||||
|
||||
test('should show the text "ZEC Wallet Starting" in loading screen', async () => {
|
||||
expect(await app.client.getText('#loading-screen p')).toEqual(
|
||||
'ZEC Wallet Starting',
|
||||
);
|
||||
});
|
||||
test('should show the text "ZEC Wallet Starting" in loading screen', async () => expect(app.client.element('#loading-screen:first-child p').getHTML()).resolves.toEqual(
|
||||
expect.stringContaining('ZEC Wallet Starting'),
|
||||
));
|
||||
|
||||
test('should show the zcash logo in loading screen', async () => expect(await app.client.getAttribute('#loading-screen img', 'src')).toEqual(
|
||||
test('should show the zcash logo in loading screen', () => expect(app.client.getAttribute('#loading-screen:first-child img', 'src')).resolves.toEqual(
|
||||
expect.stringContaining('/assets/zcash-simple-icon.svg'),
|
||||
));
|
||||
|
||||
test('should show the loading circle in loading screen', async () => {
|
||||
expect(
|
||||
await app.client.element('#loading-screen svg').isExisting(),
|
||||
).toEqual(true);
|
||||
test('should show the loading circle in loading screen', () => {
|
||||
expect(app.client.element('#loading-screen svg').isExisting()).resolves.toEqual(true);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,15 +6,13 @@ const app = getApp();
|
|||
beforeAll(async () => {
|
||||
await app.start();
|
||||
await app.client.waitUntilWindowLoaded();
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Dashboard', 120000);
|
||||
await app.client.waitUntilTextExists('#sidebar', 'Dashboard');
|
||||
});
|
||||
|
||||
afterAll(() => app.stop());
|
||||
|
||||
describe('Status Pill', () => {
|
||||
test('should show status pill in the header', async () => expect(
|
||||
app.client
|
||||
.waitUntilTextExists('#status-pill', '50.00%')
|
||||
.getText('#status-pill'),
|
||||
app.client.waitUntilTextExists('#status-pill', '50.00%').getText('#status-pill'),
|
||||
).resolves.toEqual(expect.stringContaining('50.00%')));
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue