Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Feature/create route from proxy response 139 (#185)
- Creating route from environment log (proxied and normal) #139 - Styling mock button - Writing tests for proxy mock and basic mock
- Loading branch information
1 parent
56741f6
commit bdecf7a
Showing
12 changed files
with
276 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -42,4 +42,9 @@ $logs-border: 1px solid lighten($gray-900, 1%); | |
} | ||
} | ||
} | ||
|
||
.btn-mock { | ||
padding: 0; | ||
margin: 0 10px 0 0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,107 @@ | ||
[ | ||
{ | ||
"uuid": "323a25c6-b196-4d27-baf8-8aeb83d87c76", | ||
"name": "FT env", | ||
"endpointPrefix": "", | ||
"latency": 0, | ||
"port": 3000, | ||
"routes": [ | ||
{ | ||
"uuid": "dd07b407-df1f-4393-83f2-7a832fdd6f99", | ||
"method": "get", | ||
"endpoint": "*/:var/a(b)?c/[0-9]{1,5}", | ||
"documentation": "Test documentation", | ||
"responses": [ | ||
{ | ||
"uuid": "505a77b1-34c7-4af8-adde-ed00b8dd29bf", | ||
"body": "{\"response\": \"{{urlParam 'var'}}\"}", | ||
"latency": 0, | ||
"statusCode": "200", | ||
"headers": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json" | ||
} | ||
], | ||
"filePath": "", | ||
"sendFileAsBody": false, | ||
"rules": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"uuid": "9745a08e-94c2-451e-bccc-b31dc608bb6d", | ||
"method": "get", | ||
"endpoint": "answer", | ||
"documentation": "", | ||
"responses": [ | ||
{ | ||
"uuid": "057ec98a-dd5d-4dd8-9af9-a99dd7a5c3f5", | ||
"body": "42", | ||
"latency": 0, | ||
"statusCode": "200", | ||
"headers": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "text/plain" | ||
} | ||
], | ||
"filePath": "", | ||
"sendFileAsBody": false, | ||
"rules": [] | ||
} | ||
] | ||
}, | ||
{ | ||
"uuid": "9eec44ab-48b1-454f-8cda-ddbc9aeaac0e", | ||
"method": "post", | ||
"endpoint": "dolphins", | ||
"documentation": "", | ||
"responses": [ | ||
{ | ||
"uuid": "6d3abb6f-6705-4588-8b09-337ddc4ae33c", | ||
"body": "{\n \"response\": \"So Long, and Thanks for All the Fish\"\n}", | ||
"latency": 0, | ||
"statusCode": "200", | ||
"headers": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json" | ||
} | ||
], | ||
"filePath": "", | ||
"sendFileAsBody": false, | ||
"rules": [] | ||
} | ||
] | ||
} | ||
], | ||
"proxyMode": false, | ||
"proxyHost": "", | ||
"https": false, | ||
"cors": true, | ||
"headers": [ | ||
{ | ||
"key": "", | ||
"value": "" | ||
} | ||
] | ||
}, { | ||
"uuid": "2cbdec80-f284-11e9-a28c-912bdc671019", | ||
"name": "Proxy", | ||
"endpointPrefix": "", | ||
"latency": 0, | ||
"port": 3001, | ||
"routes": [], | ||
"proxyMode": true, | ||
"proxyHost": "http://127.0.0.1:3000", | ||
"https": false, | ||
"cors": true, | ||
"headers": [ | ||
{ | ||
"key": "Content-Type", | ||
"value": "application/json" | ||
} | ||
] | ||
} | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
{ | ||
"welcomeShown": true, | ||
"analytics": true, | ||
"lastMigration": 6 | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
import { Tests } from './lib/tests'; | ||
import { HttpCall } from './lib/types'; | ||
|
||
const tests = new Tests('proxy'); | ||
|
||
const getAnswerCall: HttpCall = { | ||
description: 'Call GET answer', | ||
path: '/answer', | ||
method: 'GET', | ||
testedProperties: { | ||
body: '42', | ||
status: 200 | ||
} | ||
}; | ||
|
||
const environmentLogsItemSelector = '.environment-logs-column:nth-child(1) .menu-list .nav-item'; | ||
|
||
describe('Proxy', () => { | ||
tests.runHooks(); | ||
|
||
it('Start environments', async () => { | ||
await tests.helpers.startEnvironment(); | ||
await tests.helpers.selectEnvironment(2); | ||
await tests.helpers.startEnvironment(); | ||
}); | ||
|
||
it ('Call /anwser', async () => { | ||
await tests.helpers.httpCallAsserterWithPort(getAnswerCall, 3001); | ||
}); | ||
|
||
it('Environment logs have one entry', async () => { | ||
await tests.helpers.switchViewInHeader('ENV_LOGS'); | ||
await tests.helpers.countEnvironmentLogsEntries(1); | ||
}); | ||
|
||
it('First entry is GET /answer and was proxied by the application', async () => { | ||
await tests.spectron.client.getText(`${environmentLogsItemSelector}:nth-child(1) .nav-link .route`).should.eventually.equal('GET\n/answer'); | ||
await tests.spectron.client.waitForExist(`${environmentLogsItemSelector}:nth-child(1) .nav-link i[ngbTooltip="Request proxied"]`, 5000, false); | ||
}); | ||
|
||
it('Click on mock button ', async () => { | ||
await tests.spectron.client.element(`${environmentLogsItemSelector}:nth-child(1) .btn-mock`).click(); | ||
await tests.helpers.stopEnvironment(); | ||
await tests.helpers.startEnvironment(); | ||
}); | ||
|
||
it('Check route added', async () => { | ||
await tests.helpers.countRoutes(1); | ||
}); | ||
|
||
it('Test new mock', async () => { | ||
await tests.helpers.httpCallAsserterWithPort(getAnswerCall, 3001); | ||
await tests.helpers.switchViewInHeader('ENV_LOGS'); | ||
await tests.helpers.countEnvironmentLogsEntries(2); | ||
await tests.spectron.client.getText(`${environmentLogsItemSelector}:nth-child(1) .nav-link .route`).should.eventually.equal('GET\n/answer'); | ||
await tests.spectron.client.waitForExist(`${environmentLogsItemSelector}:nth-child(1) .nav-link i[ngbTooltip="Request proxied"]`, 5000, true); | ||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters