File tree 2 files changed +15
-11
lines changed
fixtures/packages/react/src 2 files changed +15
-11
lines changed Original file line number Diff line number Diff line change 2
2
Feature : Component lifecycle spans
3
3
Scenario : Component lifecycle spans are automatically instrumented
4
4
Given I navigate to the test URL "/docs/react"
5
- And I click the element "update-component"
6
- Then I click the element "unmount-component"
7
- Then I click the element "end-page-load"
8
5
When I wait to receive 1 trace
9
6
Then a span name equals "[ViewLoad/Component]Component"
10
7
And a span name equals "[ViewLoadPhase/Mount]Component"
11
8
And a span name equals "[ViewLoadPhase/Update]Component"
12
9
And a span name equals "[ViewLoadPhase/Unmount]Component"
13
10
# [ViewLoadPhase/Update]Component attributes
14
- And the trace payload field "resourceSpans.0.scopeSpans.0.spans.1 " string array attribute "bugsnag.component.update.props" equals the array:
11
+ And the trace payload field "resourceSpans.0.scopeSpans.0.spans.2 " string array attribute "bugsnag.component.update.props" equals the array:
15
12
| count |
16
13
17
14
@skip
Original file line number Diff line number Diff line change @@ -43,18 +43,25 @@ const KeepAlive = () => {
43
43
}
44
44
45
45
const Root = ( ) => {
46
- const [ show , setShow ] = React . useState ( true )
46
+ const [ show , setShow ] = React . useState ( false )
47
47
const [ count , setCount ] = React . useState ( 0 )
48
48
49
+ useEffect ( ( ) => {
50
+ ( async ( ) => {
51
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) )
52
+ setShow ( true )
53
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) )
54
+ setCount ( n => n + 1 )
55
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) )
56
+ setShow ( false )
57
+ await new Promise ( resolve => setTimeout ( resolve , 100 ) )
58
+ document . getElementById ( "end-page-load" ) . click ( )
59
+ } ) ( )
60
+ } , [ ] )
61
+
49
62
return (
50
63
< div >
51
64
< KeepAlive />
52
- < button id = "update-component" onClick = { ( ) => setCount ( prevCount => prevCount + 1 ) } >
53
- Increment
54
- </ button >
55
- < button id = "unmount-component" onClick = { ( ) => { setShow ( false ) } } >
56
- Unmount Component
57
- </ button >
58
65
{ show && < WrappedComponent count = { count } /> }
59
66
</ div >
60
67
)
You can’t perform that action at this time.
0 commit comments