if (FALSE) {
# Basic visual regression test
test_that("login page renders correctly", {
skip_if_no_odiff()
expect_images_match(
"screenshots/login_current.png",
"screenshots/login_baseline.png"
)
})
# With tolerance for minor differences
test_that("chart renders correctly", {
skip_if_no_odiff()
expect_images_match(
"actual_chart.png",
"expected_chart.png",
threshold = 0.2,
antialiasing = TRUE,
ignore_regions = list(
ignore_region(0, 0, 100, 30) # Ignore timestamp
)
)
})
# Assert images are different
test_that("button changes on hover", {
skip_if_no_odiff()
expect_images_differ(
"button_normal.png",
"button_hover.png"
)
})
}
Run the code above in your browser using DataLab