1+ import path from "path" ;
12import { setupPage } from './setupPage'
23
34describe ( 'toClick' , ( ) => {
@@ -71,17 +72,18 @@ describe('toClick', () => {
7172 } )
7273
7374 it ( 'should return an error if element is not found' , async ( ) => {
74- expect . assertions ( 2 )
75+ expect . assertions ( 3 )
7576
7677 try {
7778 await expect ( page ) . toClick ( 'a' , { text : 'Nop' } )
7879 } catch ( error ) {
7980 expect ( error . message ) . toMatch ( 'Element a (text: "Nop") not found' )
81+ expect ( error . stack ) . toMatch ( path . resolve ( __filename ) )
8082 }
8183 } )
8284
8385 it ( 'should return an error if element is not found with xpath selector' , async ( ) => {
84- expect . assertions ( 2 )
86+ expect . assertions ( 3 )
8587
8688 try {
8789 await expect ( page ) . toClick (
@@ -90,16 +92,18 @@ describe('toClick', () => {
9092 )
9193 } catch ( error ) {
9294 expect ( error . message ) . toMatch ( 'Element //a (text: "Nop") not found' )
95+ expect ( error . stack ) . toMatch ( path . resolve ( __filename ) )
9396 }
9497 } )
9598
9699 it ( 'should return an error if element is not found with css selector as object' , async ( ) => {
97- expect . assertions ( 2 )
100+ expect . assertions ( 3 )
98101
99102 try {
100103 await expect ( page ) . toClick ( { value : 'a' , type : 'css' } , { text : 'Nop' } )
101104 } catch ( error ) {
102105 expect ( error . message ) . toMatch ( 'Element a (text: "Nop") not found' )
106+ expect ( error . stack ) . toMatch ( path . resolve ( __filename ) )
103107 }
104108 } )
105109 } )
@@ -134,12 +138,13 @@ describe('toClick', () => {
134138
135139 it ( 'should return an error if element is not found' , async ( ) => {
136140 const body = await page . $ ( 'body' )
137- expect . assertions ( 2 )
141+ expect . assertions ( 3 )
138142
139143 try {
140144 await expect ( body ) . toClick ( 'a' , { text : 'Nop' } )
141145 } catch ( error ) {
142146 expect ( error . message ) . toMatch ( 'Element a (text: "Nop") not found' )
147+ expect ( error . stack ) . toMatch ( path . resolve ( __filename ) )
143148 }
144149 } )
145150 } )
0 commit comments