Skip to content

Commit

Permalink
Fix errors when testing selenium
Browse files Browse the repository at this point in the history
  • Loading branch information
ashbythorpe committed Nov 6, 2023
1 parent e486c00 commit 2c8fa0a
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 27 deletions.
2 changes: 0 additions & 2 deletions R/lazy_list.R
Original file line number Diff line number Diff line change
Expand Up @@ -527,9 +527,7 @@ element_in_eager <- function(x, l, .f) {
}

length.lazy_list <- function(x) {
print(x$current_value$get())
result <- length(coro::collect(x$instance$get())) + x$current_value$get()
print(result)
x$current_value$set(result)
result
}
Expand Down
3 changes: 1 addition & 2 deletions R/print.R
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ outer_html <- function(x, session, driver) {
execute_js_fn_on(
"x => x.outerHTML",
x,
session = x$session,
session = session,
driver = driver
)
}
Expand All @@ -151,4 +151,3 @@ encode_with_width <- function(x, width) {
x[truncate_encoded] <- paste(substr(x[truncate_encoded], 1L, width - 3L), "...")
x
}

27 changes: 5 additions & 22 deletions tests/testthat/_snaps/print.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,11 @@
---

Code
print(ss("*"), width = 80)
print(elem_children(s(".actions-test")), width = 80, n = 3)
Output
{ selenider_elements (107) }
[1] <html lang="en"><head>\n<meta http-equiv="Content-Type" content="text/html; c ...
[2] <head>\n<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">\n ...
[3] <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
[4] <meta charset="utf-8">
[5] <meta http-equiv="X-UA-Compatible" content="IE=edge">
[6] <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to ...
[7] <meta name="description" content="selenider">
[8] <title>test-site • selenider</title>
[9] <script src="../deps/jquery-3.6.0/jquery-3.6.0.min.js"></script>
[10] <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to ...
[11] <link href="../deps/bootstrap-5.2.2/bootstrap.min.css" rel="stylesheet">
[12] <script src="../deps/bootstrap-5.2.2/bootstrap.bundle.min.js"></script>
[13] <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awes ...
[14] <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awes ...
[15] <script src="https://cdn.jsdelivr.net/gh/afeld/[email protected]/dist/boot ...
[16] <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/headroom. ...
[17] <script src="https://cdnjs.cloudflare.com/ajax/libs/headroom/0.11.0/jQuery.he ...
[18] <script src="https://cdnjs.cloudflare.com/ajax/libs/clipboard.js/2.0.6/clipbo ...
[19] <script src="https://cdnjs.cloudflare.com/ajax/libs/fuse.js/6.4.6/fuse.js" in ...
[20] <script src="https://cdnjs.cloudflare.com/ajax/libs/autocomplete.js/0.38.0/au ...
{ selenider_elements (5) }
[1] <button type="button" class="actions-button">Test button</button>
[2] <p id="button-output"></p>
[3] <input type="text" class="actions-input">
...

2 changes: 1 addition & 1 deletion tests/testthat/test-print.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@ test_that("Printing elements works", {

expect_snapshot(print(elem_children(s(".actions-test")), width = 80))

expect_snapshot(print(ss("*"), width = 80))
expect_snapshot(print(elem_children(s(".actions-test")), width = 80, n = 3))
})

0 comments on commit 2c8fa0a

Please sign in to comment.