File tree Expand file tree Collapse file tree 4 files changed +32
-3
lines changed
PuppeteerSharp.Nunit/TestExpectations Expand file tree Collapse file tree 4 files changed +32
-3
lines changed Original file line number Diff line number Diff line change 6969 "parameters" : [" firefox" , " headful" ],
7070 "expectations" : [" FAIL" ]
7171 },
72+ {
73+ "comment" : " This is flaky on CI/CD" ,
74+ "testIdPattern" : " [oopif.spec] OOPIF should provide access to elements" ,
75+ "platforms" : [" win32" ],
76+ "parameters" : [" chrome" ],
77+ "expectations" : [" FAIL" ]
78+ },
7279 {
7380 "comment" : " " ,
7481 "testIdPattern" : " [puppeteer-sharp] *" ,
Original file line number Diff line number Diff line change @@ -52,7 +52,7 @@ public async Task ShouldWorkWithBothDomcontentloadedAndLoad()
5252 }
5353 } ) . ContinueWith ( _ => bothFired = true ) ;
5454
55- await waitForRequestTask . WithTimeout ( ) ;
55+ await waitForRequestTask . WithTimeout ( 5_000 ) ;
5656 await domContentLoadedTask . WithTimeout ( ) ;
5757 Assert . That ( bothFired , Is . False ) ;
5858 responseCompleted . SetResult ( true ) ;
Original file line number Diff line number Diff line change @@ -143,5 +143,27 @@ public void PdfOptionsShouldBeSerializable()
143143 var newPdfOptions = JsonSerializer . Deserialize < PdfOptions > ( serialized ) ;
144144 Assert . That ( newPdfOptions , Is . EqualTo ( pdfOptions ) ) ;
145145 }
146+
147+ [ Test ]
148+ public void PdfOptionsShouldWorkWithMarginWithNoUnits ( )
149+ {
150+ var pdfOptions = new PdfOptions
151+ {
152+ Format = PaperFormat . A4 ,
153+ DisplayHeaderFooter = true ,
154+ MarginOptions = new MarginOptions
155+ {
156+ Top = "0" ,
157+ Right = "0" ,
158+ Bottom = "0" ,
159+ Left = "0"
160+ } ,
161+ FooterTemplate = "<div id=\" footer-template\" style=\" font-size:10px !important; color:#808080; padding-left:10px\" >- <span class=\" pageNumber\" ></span> - </div>"
162+ } ;
163+
164+ var serialized = JsonSerializer . Serialize ( pdfOptions ) ;
165+ var newPdfOptions = JsonSerializer . Deserialize < PdfOptions > ( serialized ) ;
166+ Assert . That ( newPdfOptions , Is . EqualTo ( pdfOptions ) ) ;
167+ }
146168 }
147169}
Original file line number Diff line number Diff line change @@ -1221,14 +1221,14 @@ private decimal ConvertPrintParameterToInches(object parameter)
12211221 }
12221222
12231223 decimal pixels ;
1224- if ( parameter is decimal || parameter is int )
1224+ if ( parameter is decimal or int )
12251225 {
12261226 pixels = Convert . ToDecimal ( parameter , CultureInfo . CurrentCulture ) ;
12271227 }
12281228 else
12291229 {
12301230 var text = parameter . ToString ( ) ;
1231- var unit = text . Substring ( text . Length - 2 ) . ToLower ( CultureInfo . CurrentCulture ) ;
1231+ var unit = text . Length > 2 ? text . Substring ( text . Length - 2 ) . ToLower ( CultureInfo . CurrentCulture ) : string . Empty ;
12321232 string valueText ;
12331233 if ( _unitToPixels . ContainsKey ( unit ) )
12341234 {
You can’t perform that action at this time.
0 commit comments