Skip to content

Commit

Permalink
chore: update network tests
Browse files Browse the repository at this point in the history
  • Loading branch information
pete-watters committed Jan 18, 2024
1 parent 9d3259e commit ce4f693
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
1 change: 1 addition & 0 deletions tests/selectors/network.selectors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export enum NetworkSelectors {
NetworkKey = 'network-key',
BtnAddNetwork = 'btn-add-network',
ErrorText = 'error-text',
EmptyNameError = 'Enter a name',
EmptyStacksAddressError = 'Enter a valid Stacks API URL',
EmptyBitcoinURLError = 'Enter a valid Bitcoin API URL',
EmptyKeyError = 'Enter a unique key',
Expand Down
13 changes: 13 additions & 0 deletions tests/specs/network/add-network.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ test.describe('Networks tests', () => {
});

test('validation error when stacks api url is empty', async ({ networkPage }) => {
await networkPage.inputNetworkNameField('Test network');
await networkPage.inputNetworkStacksAddressField('');
await networkPage.inputNetworkBitcoinAddressField('https://mempool.space/testnet/api');
await networkPage.inputNetworkKeyField('test-network');
Expand All @@ -24,7 +25,16 @@ test.describe('Networks tests', () => {
test.expect(errorMessage).toEqual(NetworkSelectors.EmptyStacksAddressError);
});

test('validation error when name is empty', async ({ networkPage }) => {
await networkPage.clickAddNetwork();
await networkPage.waitForErrorMessage();

const errorMsgElement = await networkPage.getErrorMessage();
const errorMessage = await errorMsgElement.innerText();
test.expect(errorMessage).toEqual(NetworkSelectors.EmptyNameError);
});
test('validation error when key is empty', async ({ networkPage }) => {
await networkPage.inputNetworkNameField('Test network');
await networkPage.clickAddNetwork();
await networkPage.waitForErrorMessage();

Expand All @@ -34,6 +44,7 @@ test.describe('Networks tests', () => {
});

test('validation error when bitcoin api url is empty', async ({ networkPage }) => {
await networkPage.inputNetworkNameField('Test network');
await networkPage.inputNetworkBitcoinAddressField('');
await networkPage.inputNetworkKeyField('test-network');
await networkPage.clickAddNetwork();
Expand All @@ -45,6 +56,7 @@ test.describe('Networks tests', () => {
});

test('unable to fetch info from stacks node', async ({ networkPage }) => {
await networkPage.inputNetworkNameField('Test network');
await networkPage.inputNetworkStacksAddressField('https://www.google.com/');
await networkPage.inputNetworkKeyField('test-network');
await networkPage.clickAddNetwork();
Expand All @@ -56,6 +68,7 @@ test.describe('Networks tests', () => {
});

test('unable to fetch mempool from bitcoin node', async ({ networkPage }) => {
await networkPage.inputNetworkNameField('Test network');
await networkPage.inputNetworkBitcoinAddressField('https://www.google.com/');
await networkPage.inputNetworkKeyField('test-network');
await networkPage.clickAddNetwork();
Expand Down

0 comments on commit ce4f693

Please sign in to comment.