-
Notifications
You must be signed in to change notification settings - Fork 212
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add isolation error http request and resource monitoring
- Loading branch information
Showing
3 changed files
with
168 additions
and
3 deletions.
There are no files selected for viewing
4 changes: 1 addition & 3 deletions
4
...hole-process/isolation-monitoring.spec.js → ...lation-monitoring/isolation-error.spec.js
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
100 changes: 100 additions & 0 deletions
100
cypress/integration/2-isolation-monitoring/isolation-http-request.spec.js
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,100 @@ | ||
/// <reference types="cypress" /> | ||
import { findMultiAndMatch } from '../common'; | ||
|
||
describe('monitoring the isolation', () => { | ||
beforeEach(() => { | ||
Cypress.env({ | ||
garfishRunConfig: { | ||
basename: '/garfish-app', | ||
}, | ||
}); | ||
cy.visit('http://localhost:2333/garfish-app/react/monitoring'); | ||
cy.intercept('POST', '/monitor_browser/collect/batch/', {}).as('post'); | ||
}); | ||
|
||
const MonitoringTitle = 'React sub App Monitoring'; | ||
|
||
const httpRequest = (msg) => { | ||
return { | ||
payload: { | ||
request: { | ||
url: msg, | ||
}, | ||
}, | ||
}; | ||
}; | ||
|
||
const httpPatch = { | ||
ev_type: 'http', | ||
}; | ||
const httpMessageMap = { | ||
mainAppXhrRequest: 'http://localhost:2333/mainApp', | ||
mainAppFetchRequest: 'http://localhost:2333/fetch/mainApp', | ||
subAppXhrRequest: 'http://localhost:2444/subApp', | ||
subAppFetchRequest: 'http://localhost:2444/fetch/subApp', | ||
}; | ||
|
||
it('subApp xhr http request isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=click-fetch]').click(); | ||
|
||
findMultiAndMatch( | ||
1, | ||
httpPatch, | ||
httpRequest(httpMessageMap.subAppXhrRequest), | ||
{ | ||
'payload.request.url': httpMessageMap.subAppXhrRequest, | ||
}, | ||
); | ||
}); | ||
}); | ||
|
||
it('subApp fetch http request isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=click-fetch]').click(); | ||
|
||
findMultiAndMatch( | ||
1, | ||
httpPatch, | ||
httpRequest(httpMessageMap.subAppFetchRequest), | ||
{ | ||
'payload.request.url': httpMessageMap.subAppFetchRequest, | ||
}, | ||
); | ||
}); | ||
}); | ||
|
||
it('mainApp xhr http request isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=main-click-fetch]').click(); | ||
|
||
findMultiAndMatch( | ||
0, | ||
httpPatch, | ||
httpRequest(httpMessageMap.mainAppXhrRequest), | ||
{ | ||
'payload.request.url': httpMessageMap.mainAppXhrRequest, | ||
}, | ||
); | ||
}); | ||
}); | ||
|
||
it('mainApp fetch http request isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=main-click-fetch]').click(); | ||
|
||
findMultiAndMatch( | ||
0, | ||
httpPatch, | ||
httpRequest(httpMessageMap.mainAppFetchRequest), | ||
{ | ||
'payload.request.url': httpMessageMap.mainAppFetchRequest, | ||
}, | ||
); | ||
}); | ||
}); | ||
}); |
67 changes: 67 additions & 0 deletions
67
cypress/integration/2-isolation-monitoring/isolation-resource.spec.js
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,67 @@ | ||
/// <reference types="cypress" /> | ||
import { findMultiAndMatch } from '../common'; | ||
|
||
describe('monitoring the isolation', () => { | ||
beforeEach(() => { | ||
Cypress.env({ | ||
garfishRunConfig: { | ||
basename: '/garfish-app', | ||
}, | ||
}); | ||
cy.visit('http://localhost:2333/garfish-app/react/monitoring'); | ||
cy.intercept('POST', '/monitor_browser/collect/batch/', {}).as('post'); | ||
}); | ||
|
||
const MonitoringTitle = 'React sub App Monitoring'; | ||
|
||
const resourceRequest = (msg) => { | ||
return { | ||
payload: { | ||
name: msg, | ||
}, | ||
}; | ||
}; | ||
|
||
const resourcePatch = { | ||
ev_type: 'resource', | ||
}; | ||
|
||
const resourceMessageMap = { | ||
mainJsResource: 'http://localhost:2333/monitoring/dynamicScript.js', | ||
mainAppFetchRequest: 'http://localhost:2333/fetch/mainApp', | ||
subAppJsResource: 'http://localhost:2444/monitoring/dynamicScript.js', | ||
subAppFetchRequest: 'http://localhost:2444/fetch/subApp', | ||
}; | ||
|
||
it('subApp resource isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=click-dynamic-resource]').click(); | ||
|
||
findMultiAndMatch( | ||
1, | ||
resourcePatch, | ||
resourceRequest(resourceMessageMap.subAppJsResource), | ||
{ | ||
'payload.name': resourceMessageMap.subAppJsResource, | ||
}, | ||
); | ||
}); | ||
}); | ||
|
||
it('mainApp resource isolation', () => { | ||
cy.window().then((win) => { | ||
cy.contains('[data-test=title]', MonitoringTitle); | ||
cy.get('[data-test=main-click-dynamic-resource]').click(); | ||
|
||
findMultiAndMatch( | ||
0, | ||
resourcePatch, | ||
resourceRequest(resourceMessageMap.mainJsResource), | ||
{ | ||
'payload.name': resourceMessageMap.mainJsResource, | ||
}, | ||
); | ||
}); | ||
}); | ||
}); |