@@ -145,6 +145,167 @@ jobs:
145145 targets : wasm32-unknown-unknown
146146 - run : cd ${{ github.workspace }}/examples/wasm-yew/${{ matrix.example }} && cargo build --target wasm32-unknown-unknown
147147
148+ test_static_export_chrome :
149+ name : Test Static Export with Chrome (Windows)
150+ runs-on : windows-latest
151+ timeout-minutes : 30
152+ steps :
153+ - uses : actions/checkout@v4
154+
155+ - name : Setup Chrome and chromedriver
156+ id : setup-chrome
157+ uses : browser-actions/setup-chrome@v1
158+ with :
159+ chrome-version : ' latest'
160+ install-chromedriver : true
161+
162+ - uses : dtolnay/rust-toolchain@stable
163+
164+ - name : Debug - Show setup-chrome outputs
165+ run : |
166+ Write-Host "=== Setup Chrome Action Outputs ==="
167+ Write-Host "chrome-version: ${{ steps.setup-chrome.outputs.chrome-version }}"
168+ Write-Host "chrome-path: ${{ steps.setup-chrome.outputs.chrome-path }}"
169+ Write-Host "chromedriver-version: ${{ steps.setup-chrome.outputs.chromedriver-version }}"
170+ Write-Host "chromedriver-path: ${{ steps.setup-chrome.outputs.chromedriver-path }}"
171+ Write-Host "================================"
172+
173+ - name : Debug - System information
174+ run : |
175+ Write-Host "=== System Information ==="
176+ Write-Host "OS Version: $(Get-ComputerInfo | Select-Object -ExpandProperty WindowsProductName)"
177+ Write-Host "Architecture: $(Get-ComputerInfo | Select-Object -ExpandProperty OsArchitecture)"
178+ Write-Host "Available memory: $((Get-CimInstance Win32_OperatingSystem).FreePhysicalMemory / 1MB) MB"
179+ Write-Host "=========================="
180+
181+ - name : Debug - Check Chrome and chromedriver installation
182+ run : |
183+ Write-Host "=== Chrome and Chromedriver Check ==="
184+
185+ # Check if Chrome is in PATH
186+ try {
187+ $chromeVersion = & chrome.exe --version 2>$null
188+ Write-Host "Chrome in PATH: $chromeVersion"
189+ } catch {
190+ Write-Host "Chrome not found in PATH"
191+ }
192+
193+ # Check if chromedriver is in PATH
194+ try {
195+ $chromedriverVersion = & chromedriver.exe --version 2>$null
196+ Write-Host "Chromedriver in PATH: $chromedriverVersion"
197+ } catch {
198+ Write-Host "Chromedriver not found in PATH"
199+ }
200+
201+ # Check specific paths from action outputs
202+ $chromePath = "${{ steps.setup-chrome.outputs.chrome-path }}"
203+ $chromedriverPath = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
204+
205+ Write-Host "Chrome path from action: $chromePath"
206+ Write-Host "Chromedriver path from action: $chromedriverPath"
207+
208+ if (Test-Path $chromePath) {
209+ Write-Host "Chrome file exists: $(Get-Item $chromePath | Select-Object -ExpandProperty FullName)"
210+ Write-Host "Chrome file size: $((Get-Item $chromePath).Length) bytes"
211+ } else {
212+ Write-Host "Chrome file does not exist at specified path"
213+ }
214+
215+ if (Test-Path $chromedriverPath) {
216+ Write-Host "Chromedriver file exists: $(Get-Item $chromedriverPath | Select-Object -ExpandProperty FullName)"
217+ Write-Host "Chromedriver file size: $((Get-Item $chromedriverPath).Length) bytes"
218+ } else {
219+ Write-Host "Chromedriver file does not exist at specified path"
220+ }
221+
222+ Write-Host "================================"
223+
224+ - name : Debug - Check Rust toolchain and dependencies
225+ run : |
226+ Write-Host "=== Rust Toolchain Check ==="
227+ rustc --version
228+ cargo --version
229+ Write-Host "Current directory: $(Get-Location)"
230+ Write-Host "Workspace contents:"
231+ Get-ChildItem -Name | Sort-Object
232+ Write-Host "=========================="
233+
234+ - name : Debug - Check plotly_static package
235+ run : |
236+ Write-Host "=== Plotly Static Package Check ==="
237+ cd plotly_static
238+ Write-Host "Package contents:"
239+ Get-ChildItem -Name | Sort-Object
240+ Write-Host "Cargo.toml contents:"
241+ Get-Content Cargo.toml
242+ Write-Host "================================"
243+
244+ - name : Run PNG export test with Chrome
245+ run : |
246+ Write-Host "=== Starting PNG Export Test ==="
247+
248+ # Set environment variables
249+ $env:WEBDRIVER_PATH = "${{ steps.setup-chrome.outputs.chromedriver-path }}"
250+ $env:CHROME_PATH = "${{ steps.setup-chrome.outputs.chrome-path }}"
251+ $env:RUST_LOG = "debug"
252+ $env:RUST_BACKTRACE = "1"
253+
254+ Write-Host "Environment variables set:"
255+ Write-Host "WEBDRIVER_PATH: $env:WEBDRIVER_PATH"
256+ Write-Host "CHROME_PATH: $env:CHROME_PATH"
257+ Write-Host "RUST_LOG: $env:RUST_LOG"
258+ Write-Host "RUST_BACKTRACE: $env:RUST_BACKTRACE"
259+
260+ # Verify the paths exist
261+ if (-not (Test-Path $env:WEBDRIVER_PATH)) {
262+ Write-Error "Chromedriver not found at: $env:WEBDRIVER_PATH"
263+ exit 1
264+ }
265+ if (-not (Test-Path $env:CHROME_PATH)) {
266+ Write-Error "Chrome not found at: $env:CHROME_PATH"
267+ exit 1
268+ }
269+
270+ Write-Host "All paths verified, starting cargo test..."
271+
272+ # Run with verbose output and timeout
273+ $timeout = 600 # 10 minutes
274+ $job = Start-Job -ScriptBlock {
275+ param($webdriverPath, $chromePath)
276+ $env:WEBDRIVER_PATH = $webdriverPath
277+ $env:CHROME_PATH = $chromePath
278+ $env:RUST_LOG = "debug"
279+ $env:RUST_BACKTRACE = "1"
280+ Set-Location $PWD
281+ cargo test --package plotly_static --features chromedriver,webdriver_download tests::save_png -- --nocapture
282+ } -ArgumentList $env:WEBDRIVER_PATH, $env:CHROME_PATH
283+
284+ try {
285+ Wait-Job $job -Timeout $timeout
286+ $result = Receive-Job $job
287+ Write-Host $result
288+ if ($job.State -eq "Completed") {
289+ Write-Host "Test completed successfully"
290+ } else {
291+ Write-Host "Test timed out or failed"
292+ Stop-Job $job
293+ Remove-Job $job
294+ exit 1
295+ }
296+ } catch {
297+ Write-Host "Exception occurred: $_"
298+ Stop-Job $job
299+ Remove-Job $job
300+ exit 1
301+ } finally {
302+ if ($job) {
303+ Remove-Job $job -Force -ErrorAction SilentlyContinue
304+ }
305+ }
306+
307+ Write-Host "=== PNG Export Test Completed ==="
308+
148309 build_book :
149310 name : Build Book
150311 runs-on : ubuntu-latest
0 commit comments