File tree Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Expand file tree Collapse file tree 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -200,6 +200,28 @@ describe('find* dom-testing-library commands', () => {
200
200
. findByText ( 'Button Text 1' )
201
201
. should ( 'exist' )
202
202
} )
203
+
204
+ it ( 'findByText should show as a parent command if it starts a chain' , ( ) => {
205
+ const assertLog = ( attrs , log ) => {
206
+ if ( log . get ( 'name' ) === 'findByText' ) {
207
+ expect ( log . get ( 'type' ) ) . to . equal ( 'parent' )
208
+ cy . off ( 'log:added' , assertLog )
209
+ }
210
+ }
211
+ cy . on ( 'log:added' , assertLog )
212
+ cy . findByText ( 'Button Text 1' )
213
+ } )
214
+
215
+ it ( 'findByText should show as a child command if it continues a chain' , ( ) => {
216
+ const assertLog = ( attrs , log ) => {
217
+ if ( log . get ( 'name' ) === 'findByText' ) {
218
+ expect ( log . get ( 'type' ) ) . to . equal ( 'child' )
219
+ cy . off ( 'log:added' , assertLog )
220
+ }
221
+ }
222
+ cy . on ( 'log:added' , assertLog )
223
+ cy . get ( 'body' ) . findByText ( 'Button Text 1' )
224
+ } )
203
225
} )
204
226
205
227
/* global cy */
Original file line number Diff line number Diff line change @@ -74,6 +74,7 @@ function createCommand(queryName, implementationName) {
74
74
75
75
if ( options . log ) {
76
76
options . _log = Cypress . log ( {
77
+ type : prevSubject ? 'child' : 'parent' ,
77
78
name : queryName ,
78
79
message : inputArr ,
79
80
consoleProps : ( ) => consoleProps ,
You can’t perform that action at this time.
0 commit comments