Skip to content

Commit

Permalink
fix: Simplified e2e since they weren't working across all platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
svalvaro committed Nov 12, 2024
1 parent f7d6f37 commit 3970b53
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 23 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
Binary file not shown.
63 changes: 40 additions & 23 deletions inst/examples/shiny/tests/testthat/test-shinytest2.R
Original file line number Diff line number Diff line change
@@ -1,27 +1,44 @@
library(shinytest2)
test_that("{shinytest2} recording: shiny-e2e", {
app <- AppDriver$new(variant = platform_variant(os_name = FALSE), name = "shiny-e2e", height = 812,
width = 1139, app_dir = system.file("examples/shiny", package = "quill"))
test_that("{shinytest2} recording: shiny", {
app <- AppDriver$new(variant = platform_variant(os_name = FALSE), name = "shiny", seed = 1, height = 992,
width = 1619, app_dir = system.file("examples/shiny", package = "quill"))
app$expect_screenshot()
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"hello there !\"},{\"insert\":\"\\n\"},{\"attributes\":{\"bold\":true},\"insert\":\"This is an E\"},{\"attributes\":{\"bold\":true,\"script\":\"super\"},\"insert\":\"2\"},{\"attributes\":{\"bold\":true},\"insert\":\"E (\"},{\"attributes\":{\"size\":\"large\",\"bold\":true},\"insert\":\"END TO END)\"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"bold\":true,\"code\":true},\"insert\":\"test \"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"color\":\"#9933ff\",\"bold\":true},\"insert\":\"to check that the Editor Works as expected\"},{\"insert\":\"\\n\\nX = RANDOM / FORMULA\\n\\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"insert\":\"\\n\"}]}",
"hello there !\nThis is an E2E (END TO END) test to check that the Editor Works as expected\n\nX = RANDOM / FORMULA\n\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\n\n",
"<p><span style=\"color: rgb(0, 102, 204);\">hello there !</span></p><p><strong>This is an E</strong><sup><strong>2</strong></sup><strong>E (</strong><strong class=\"ql-size-large\">END TO END)</strong><strong> </strong><code><strong>test </strong></code><strong> </strong><strong style=\"color: rgb(153, 51, 255);\">to check that the Editor Works as expected</strong></p><p><br></p><p>X = RANDOM / FORMULA</p><p><br></p><blockquote>If you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.</blockquote><p><br></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"hello there !\"},{\"insert\":\"\\n\"},{\"attributes\":{\"bold\":true},\"insert\":\"This is an E\"},{\"attributes\":{\"bold\":true,\"script\":\"super\"},\"insert\":\"2\"},{\"attributes\":{\"bold\":true},\"insert\":\"E (\"},{\"attributes\":{\"size\":\"large\",\"bold\":true},\"insert\":\"END TO END)\"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"bold\":true,\"code\":true},\"insert\":\"test \"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"color\":\"#9933ff\",\"bold\":true},\"insert\":\"to check that the Editor Works as expected\"},{\"insert\":\"\\n\\nX = RANDOM / FORMULA\\n\\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"attributes\":{\"color\":\"#008a00\"},\"insert\":\"b\"},{\"insert\":\"\\n\"}]}",
"hello there !\nThis is an E2E (END TO END) test to check that the Editor Works as expected\n\nX = RANDOM / FORMULA\n\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\nb\n",
"<p><span style=\"color: rgb(0, 102, 204);\">hello there !</span></p><p><strong>This is an E</strong><sup><strong>2</strong></sup><strong>E (</strong><strong class=\"ql-size-large\">END TO END)</strong><strong> </strong><code><strong>test </strong></code><strong> </strong><strong style=\"color: rgb(153, 51, 255);\">to check that the Editor Works as expected</strong></p><p><br></p><p>X = RANDOM / FORMULA</p><p><br></p><blockquote>If you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.</blockquote><p><span style=\"color: rgb(0, 138, 0);\">b</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"hello there !\"},{\"insert\":\"\\n\"},{\"attributes\":{\"bold\":true},\"insert\":\"This is an E\"},{\"attributes\":{\"bold\":true,\"script\":\"super\"},\"insert\":\"2\"},{\"attributes\":{\"bold\":true},\"insert\":\"E (\"},{\"attributes\":{\"size\":\"large\",\"bold\":true},\"insert\":\"END TO END)\"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"bold\":true,\"code\":true},\"insert\":\"test \"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"color\":\"#9933ff\",\"bold\":true},\"insert\":\"to check that the Editor Works as expected\"},{\"insert\":\"\\n\\nX = RANDOM / FORMULA\\n\\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"attributes\":{\"color\":\"#008a00\"},\"insert\":\"by\"},{\"insert\":\"\\n\"}]}",
"hello there !\nThis is an E2E (END TO END) test to check that the Editor Works as expected\n\nX = RANDOM / FORMULA\n\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\nby\n",
"<p><span style=\"color: rgb(0, 102, 204);\">hello there !</span></p><p><strong>This is an E</strong><sup><strong>2</strong></sup><strong>E (</strong><strong class=\"ql-size-large\">END TO END)</strong><strong> </strong><code><strong>test </strong></code><strong> </strong><strong style=\"color: rgb(153, 51, 255);\">to check that the Editor Works as expected</strong></p><p><br></p><p>X = RANDOM / FORMULA</p><p><br></p><blockquote>If you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.</blockquote><p><span style=\"color: rgb(0, 138, 0);\">by</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"hello there !\"},{\"insert\":\"\\n\"},{\"attributes\":{\"bold\":true},\"insert\":\"This is an E\"},{\"attributes\":{\"bold\":true,\"script\":\"super\"},\"insert\":\"2\"},{\"attributes\":{\"bold\":true},\"insert\":\"E (\"},{\"attributes\":{\"size\":\"large\",\"bold\":true},\"insert\":\"END TO END)\"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"bold\":true,\"code\":true},\"insert\":\"test \"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"color\":\"#9933ff\",\"bold\":true},\"insert\":\"to check that the Editor Works as expected\"},{\"insert\":\"\\n\\nX = RANDOM / FORMULA\\n\\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"attributes\":{\"color\":\"#008a00\"},\"insert\":\"bye\"},{\"insert\":\"\\n\"}]}",
"hello there !\nThis is an E2E (END TO END) test to check that the Editor Works as expected\n\nX = RANDOM / FORMULA\n\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\nbye\n",
"<p><span style=\"color: rgb(0, 102, 204);\">hello there !</span></p><p><strong>This is an E</strong><sup><strong>2</strong></sup><strong>E (</strong><strong class=\"ql-size-large\">END TO END)</strong><strong> </strong><code><strong>test </strong></code><strong> </strong><strong style=\"color: rgb(153, 51, 255);\">to check that the Editor Works as expected</strong></p><p><br></p><p>X = RANDOM / FORMULA</p><p><br></p><blockquote>If you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.</blockquote><p><span style=\"color: rgb(0, 138, 0);\">bye</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"hello there !\"},{\"insert\":\"\\n\"},{\"attributes\":{\"bold\":true},\"insert\":\"This is an E\"},{\"attributes\":{\"bold\":true,\"script\":\"super\"},\"insert\":\"2\"},{\"attributes\":{\"bold\":true},\"insert\":\"E (\"},{\"attributes\":{\"size\":\"large\",\"bold\":true},\"insert\":\"END TO END)\"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"bold\":true,\"code\":true},\"insert\":\"test \"},{\"attributes\":{\"bold\":true},\"insert\":\" \"},{\"attributes\":{\"color\":\"#9933ff\",\"bold\":true},\"insert\":\"to check that the Editor Works as expected\"},{\"insert\":\"\\n\\nX = RANDOM / FORMULA\\n\\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\"},{\"attributes\":{\"blockquote\":true},\"insert\":\"\\n\"},{\"attributes\":{\"color\":\"#008a00\"},\"insert\":\"bye!\"},{\"insert\":\"\\n\"}]}",
"hello there !\nThis is an E2E (END TO END) test to check that the Editor Works as expected\n\nX = RANDOM / FORMULA\n\nIf you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.\nbye!\n",
"<p><span style=\"color: rgb(0, 102, 204);\">hello there !</span></p><p><strong>This is an E</strong><sup><strong>2</strong></sup><strong>E (</strong><strong class=\"ql-size-large\">END TO END)</strong><strong> </strong><code><strong>test </strong></code><strong> </strong><strong style=\"color: rgb(153, 51, 255);\">to check that the Editor Works as expected</strong></p><p><br></p><p>X = RANDOM / FORMULA</p><p><br></p><blockquote>If you open the .png, the editor will be empty and you can only read the rendered part below. The editor will be empty since the testing framework, shinytest2, doesn't register those bindings.</blockquote><p><span style=\"color: rgb(0, 138, 0);\">bye!</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"h\"},{\"insert\":\"\\n\"}]}",
"h\n", "<p><span style=\"color: rgb(230, 0, 0);\">h</span></p>"), allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"he\"},{\"insert\":\"\\n\"}]}",
"he\n", "<p><span style=\"color: rgb(230, 0, 0);\">he</span></p>"), allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hel\"},{\"insert\":\"\\n\"}]}",
"hel\n", "<p><span style=\"color: rgb(230, 0, 0);\">hel</span></p>"), allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hell\"},{\"insert\":\"\\n\"}]}",
"hell\n", "<p><span style=\"color: rgb(230, 0, 0);\">hell</span></p>"), allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello\"},{\"insert\":\"\\n\"}]}",
"hello\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello</span></p>"), allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"insert\":\"\\n\"}]}",
"hello \n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"code\":true},\"insert\":\"w\"},{\"insert\":\"\\n\"}]}",
"hello w\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><code>w</code></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"insert\":\"\\n\"}]}",
"hello \n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"w\"},{\"insert\":\"\\n\"}]}",
"hello w\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">w</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"wo\"},{\"insert\":\"\\n\"}]}",
"hello wo\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">wo</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"wor\"},{\"insert\":\"\\n\"}]}",
"hello wor\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">wor</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"worl\"},{\"insert\":\"\\n\"}]}",
"hello worl\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">worl</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"world\"},{\"insert\":\"\\n\"}]}",
"hello world\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">world</span></p>"),
allow_no_input_binding_ = TRUE)
app$set_inputs(editor_1 = c("{\"ops\":[{\"attributes\":{\"color\":\"#e60000\"},\"insert\":\"hello \"},{\"attributes\":{\"color\":\"#0066cc\"},\"insert\":\"world!\"},{\"insert\":\"\\n\"}]}",
"hello world!\n", "<p><span style=\"color: rgb(230, 0, 0);\">hello </span><span style=\"color: rgb(0, 102, 204);\">world!</span></p>"),
allow_no_input_binding_ = TRUE)
app$expect_screenshot()
})

0 comments on commit 3970b53

Please sign in to comment.