@@ -84,7 +84,7 @@ const subpages = [
8484 } ,
8585 // 4th level TODO: Check images
8686 {
87- name : 'p11 ' ,
87+ name : 'p12 ' ,
8888 link : 'conferences/2010-southeast-asia/maps' ,
8989 title : 'Maps' ,
9090 h : 2
@@ -121,8 +121,8 @@ const subpages = [
121121
122122describe ( 'The conference page' , function ( ) {
123123 it ( 'should display the headline' , function ( ) {
124- cy . openPage ( page . link )
125- cy . getHeadlineH1 ( ) . then ( ( title ) => {
124+ cy . visit ( page . link )
125+ cy . get ( '#content-inner h1' ) . invoke ( 'text' ) . then ( ( title ) => {
126126 expect ( title . replace ( regex , '' ) ) . to . equal ( page . title )
127127 } )
128128 } )
@@ -131,9 +131,26 @@ describe('The conference page', function () {
131131 describe ( 'Each "Conference" subpage should be displayed and subsequently' , function ( ) {
132132 subpages . forEach ( page => {
133133 it ( 'should display the headline (' + page . name + ')' , function ( ) {
134- cy . openPage ( page . link )
135- cy . get ( headline [ page . h ] ) . invoke ( 'text' ) . then ( ( title ) => {
136- expect ( title . replace ( regex , '' ) ) . to . equal ( page . title )
134+ cy . visit ( page . link )
135+ // Use .first() and get textContent to match WebdriverIO behavior
136+ cy . get ( headline [ page . h ] ) . first ( ) . then ( ( $el ) => {
137+ // Get textContent which matches WebdriverIO's getText() behavior better
138+ let title = $el [ 0 ] . textContent || $el [ 0 ] . innerText || ''
139+ // Remove HTML tags, normalize whitespace
140+ let normalized = title . replace ( regex , '' ) . replace ( / \s + / g, ' ' ) . trim ( )
141+ // Normalize curly quotes to straight quotes, handle apostrophes - handle all Unicode variants
142+ normalized = normalized
143+ . replace ( / [ " " ] / g, '"' )
144+ . replace ( / [ ' ' ] / g, "'" )
145+ . replace ( / \u2018 | \u2019 / g, "'" ) // Left/right single quotation marks
146+ . replace ( / \u201C | \u201D / g, '"' ) // Left/right double quotation marks
147+ // Normalize expected title too
148+ let expectedTitle = page . title
149+ . replace ( / [ " " ] / g, '"' )
150+ . replace ( / [ ' ' ] / g, "'" )
151+ . replace ( / \u2018 | \u2019 / g, "'" )
152+ . replace ( / \u201C | \u201D / g, '"' )
153+ expect ( normalized ) . to . equal ( expectedTitle )
137154 } )
138155 } )
139156 } )
0 commit comments