-
Notifications
You must be signed in to change notification settings - Fork 2
/
test-reports-is1.R
58 lines (48 loc) · 1.52 KB
/
test-reports-is1.R
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
if (!exists("context_of")) source("initialize.R")
pageURL <- paste0(site_url, "/project/HIPC/IS1/begin.view?pageId=Report")
context_of(
file = "test-reports-is1.R",
what = "IS1 Report",
url = pageURL
)
test_connection(remDr, pageURL, "Analysis: /HIPC/IS1")
test_that("report is generated", {
labkey_knitr <- remDr$findElements(using = "class", value = "labkey-knitr")
expect_equal(length(labkey_knitr), 1)
report_div <- labkey_knitr[[1]]$findChildElements(
using = "id",
value = "publication-info"
)
expect_equal(length(report_div), 1)
report_header <- report_div[[1]]$findChildElements("css selector", "h2")
expect_equal(length(report_header), 1)
expect_equal(
report_header[[1]]$getElementText()[[1]],
"PUBLICATION INFO"
)
})
test_that("report is producing figures and tables", {
labkey_knitr <- remDr$findElements(using = "class", value = "labkey-knitr")
# check figures
figures <- labkey_knitr[[1]]$findChildElements(
using = "css selector",
value = "img"
)
expect_length(figures, 9)
if (length(figures) > 0) {
fig1 <- figures[[1]]$getElementAttribute("src")
expect_equal(fig1[[1]], paste0(site_url, "/ImmuneSignatures/images/fig1.png"))
}
# check tables
tables <- labkey_knitr[[1]]$findChildElements(
using = "class",
value = "dataTables_wrapper"
)
expect_length(tables, 6)
# check data for tables
widget_data <- labkey_knitr[[1]]$findChildElements(
using = "css selector",
value = "script[data-for]"
)
expect_length(widget_data, 6)
})