-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
631 additions
and
549 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,12 @@ Type: Package | |
Title: 'Webdriver'/'Selenium' Binary Manager | ||
Version: 0.2.6 | ||
Authors@R: c( | ||
person("John", "Harrison", , "[email protected]", | ||
role = "aut", comment = "original author"), | ||
person("Ju Yeong", "Kim", , "[email protected]", | ||
role = "cre", comment = "rOpenSci maintainer")) | ||
person("John", "Harrison", , "[email protected]", role = "aut", | ||
comment = "original author"), | ||
person("Ju Yeong", "Kim", , "[email protected]", role = "aut", | ||
comment = "rOpenSci maintainer"), | ||
person("Jonathan", "Völkle", , "[email protected]", role = "cre") | ||
) | ||
Description: There are a number of binary files associated with the | ||
'Webdriver'/'Selenium' project. This package provides functions to download | ||
these binaries and to manage processes involving them. | ||
|
@@ -15,10 +17,11 @@ Encoding: UTF-8 | |
Depends: | ||
R (>= 3.2) | ||
Suggests: | ||
testthat, | ||
testthat (>= 3.1.7), | ||
covr, | ||
knitr, | ||
rmarkdown | ||
rmarkdown, | ||
R6 | ||
Imports: | ||
binman, | ||
assertthat, | ||
|
@@ -31,3 +34,4 @@ URLNote: https://github.com/ropensci/wdman | |
BugReports: https://github.com/ropensci/wdman/issues | ||
RoxygenNote: 7.2.3 | ||
VignetteBuilder: knitr | ||
Config/testthat/edition: 3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
library(testthat) | ||
library(wdman) | ||
|
||
# if (identical(tolower(Sys.getenv("NOT_CRAN")), "true")) { | ||
# test_check("wdman") | ||
# } | ||
if (identical(tolower(Sys.getenv("NOT_CRAN")), "true")) { | ||
test_check("wdman") | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,96 +1,117 @@ | ||
context("chrome") | ||
|
||
normalizePath <- function(...) base::normalizePath(...) | ||
list.files <- function(...) base::list.files(...) | ||
|
||
test_that("canCallChrome", { | ||
with_mock( | ||
`binman::process_yaml` = binman_process_yaml, | ||
`binman::list_versions` = mock_binman_list_versions_chrome, | ||
`binman::app_dir` = mock_binman_app_dir, | ||
local_mocked_bindings( | ||
process_yaml = binman_process_yaml, | ||
list_versions = mock_binman_list_versions_chrome, | ||
app_dir = mock_binman_app_dir, | ||
) | ||
local_mocked_bindings( | ||
normalizePath = mock_base_normalizePath, | ||
list.files = mock_base_list.files, | ||
`subprocess::spawn_process` = mock_subprocess_spawn_process, | ||
`subprocess::process_return_code` = | ||
mock_subprocess_process_return_code, | ||
`subprocess::process_kill` = mock_subprocess_process_kill, | ||
`wdman:::generic_start_log` = mock_generic_start_log, | ||
`wdman:::infun_read` = function(...) { | ||
.package = "base", | ||
) | ||
local_mocked_bindings( | ||
check_bindings = function(...) {}, | ||
.package = "testthat" | ||
) | ||
local_mocked_bindings( | ||
process = mock_processx_process, | ||
.package = "processx" | ||
) | ||
local_mocked_bindings( | ||
generic_start_log = mock_generic_start_log, | ||
infun_read = function(...) { | ||
"infun" | ||
}, | ||
{ | ||
cDrv <- chrome() | ||
retCommand <- chrome(retcommand = TRUE) | ||
expect_identical(cDrv$output(), "infun") | ||
expect_identical(cDrv$error(), "infun") | ||
logOut <- cDrv$log()[["stdout"]] | ||
logErr <- cDrv$log()[["stderr"]] | ||
expect_identical(logOut, "super duper") | ||
expect_identical(logErr, "no error here") | ||
expect_identical(cDrv$stop(), "stopped") | ||
} | ||
) | ||
expect_identical(cDrv$process, "hello") | ||
kill_process = mock_subprocess_process_kill, | ||
) | ||
|
||
cDrv <- chrome() | ||
retCommand <- chrome(retcommand = TRUE) | ||
expect_identical(cDrv$output(), "infun") | ||
expect_identical(cDrv$error(), "infun") | ||
logOut <- cDrv$log()[["stdout"]] | ||
logErr <- cDrv$log()[["stderr"]] | ||
expect_identical(logOut, "super duper") | ||
expect_identical(logErr, "no error here") | ||
expect_identical(cDrv$stop(), "stopped") | ||
expect_identical(cDrv$process$test, "hello") | ||
expect_identical( | ||
retCommand, | ||
"some.path --port=4567 --url-base=wd/hub --verbose" | ||
) | ||
}) | ||
|
||
test_that("chrome_verErrorWorks", { | ||
with_mock( | ||
`binman::list_versions` = mock_binman_list_versions_chrome, | ||
expect_error( | ||
wdman:::chrome_ver("linux64", "noversion"), | ||
"doesnt match versions" | ||
) | ||
local_mocked_bindings( | ||
list_versions = mock_binman_list_versions_chrome, | ||
) | ||
|
||
expect_error( | ||
wdman:::chrome_ver("linux64", "noversion"), | ||
"doesnt match versions" | ||
) | ||
}) | ||
|
||
test_that("pickUpErrorFromReturnCode", { | ||
with_mock( | ||
`binman::process_yaml` = function(...) {}, | ||
`binman::list_versions` = mock_binman_list_versions_chrome, | ||
`binman::app_dir` = mock_binman_app_dir, | ||
local_mocked_bindings( | ||
process_yaml = binman_process_yaml, | ||
list_versions = mock_binman_list_versions_chrome, | ||
app_dir = mock_binman_app_dir, | ||
) | ||
local_mocked_bindings( | ||
normalizePath = mock_base_normalizePath, | ||
list.files = mock_base_list.files, | ||
`subprocess::spawn_process` = mock_subprocess_spawn_process, | ||
`subprocess::process_return_code` = function(...) { | ||
"some error" | ||
}, | ||
`subprocess::process_read` = | ||
mock_subprocess_process_read_selenium, | ||
`wdman:::generic_start_log` = mock_generic_start_log, | ||
{ | ||
expect_error( | ||
chrome(version = "2.24"), | ||
"Chromedriver couldn't be started" | ||
) | ||
} | ||
.package = "base" | ||
) | ||
local_mocked_bindings( | ||
check_bindings = function(...) {}, | ||
.package = "testthat" | ||
) | ||
local_mocked_bindings( | ||
process = mock_processx_process_fail, | ||
.package = "processx" | ||
) | ||
local_mocked_bindings( | ||
generic_start_log = mock_generic_start_log, | ||
) | ||
|
||
expect_error( | ||
chrome(), | ||
"Chromedriver couldn't be started" | ||
) | ||
}) | ||
|
||
test_that("pickUpErrorFromPortInUse", { | ||
with_mock( | ||
`binman::process_yaml` = function(...) {}, | ||
`binman::list_versions` = mock_binman_list_versions_chrome, | ||
`binman::app_dir` = mock_binman_app_dir, | ||
local_mocked_bindings( | ||
process_yaml = binman_process_yaml, | ||
list_versions = mock_binman_list_versions_chrome, | ||
app_dir = mock_binman_app_dir, | ||
) | ||
local_mocked_bindings( | ||
normalizePath = mock_base_normalizePath, | ||
list.files = mock_base_list.files, | ||
`subprocess::spawn_process` = mock_subprocess_spawn_process, | ||
`subprocess::process_return_code` = | ||
mock_subprocess_process_return_code, | ||
`subprocess::process_read` = | ||
mock_subprocess_process_read_selenium, | ||
`subprocess::process_kill` = mock_subprocess_process_kill, | ||
`wdman:::generic_start_log` = function(...) { | ||
.package = "base" | ||
) | ||
local_mocked_bindings( | ||
check_bindings = function(...) {}, | ||
.package = "testthat" | ||
) | ||
local_mocked_bindings( | ||
process = mock_processx_process, | ||
.package = "processx" | ||
) | ||
local_mocked_bindings( | ||
generic_start_log = function(...) { | ||
list(stderr = "Address already in use") | ||
}, | ||
{ | ||
expect_error( | ||
chrome(version = "2.24"), | ||
"Chrome Driver signals port" | ||
) | ||
} | ||
kill_process = mock_subprocess_process_kill | ||
) | ||
|
||
expect_error( | ||
chrome(), | ||
"Chrome Driver signals port" | ||
) | ||
}) |
Oops, something went wrong.