rundoc 4.1.2 → 4.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +5 -0
- data/lib/rundoc/code_command/background/wait.rb +1 -1
- data/lib/rundoc/code_command/website/navigate.rb +6 -2
- data/lib/rundoc/code_command/website/screenshot.rb +9 -4
- data/lib/rundoc/code_command/website/visit.rb +18 -11
- data/lib/rundoc/version.rb +1 -1
- data/test/integration/website_test.rb +2 -0
- data/test/rundoc/code_commands/background_test.rb +5 -0
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b65a04eca7d7099223b2a626c47eb78e14a8e102266cf880cddc747a0d9fc4a5
|
4
|
+
data.tar.gz: 840585e8f0c6b3cddbb1d15354f4fdf862d2440b20054cd1b5344c026adb23d9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 99661d14543918c21a988bd1c4cffc1d5c9d73a852a95c16b0905b5ddde312dc986d970b4082921752cd2eac4d786a0ae37f42f3577fdea2df54c6de50376810
|
7
|
+
data.tar.gz: 6819d3babc4cb2a7ad1f76386e3d7e7f28886a989e6a31ef052ea87b3b226a6979cc1c2092653fa7aadadd34d3f8af9b268464c2a14c70f385b559ee8a13ca9a
|
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,10 @@
|
|
1
1
|
## HEAD
|
2
2
|
|
3
|
+
## 4.1.3
|
4
|
+
|
5
|
+
- Fix: Internal error in `background.wait` introduced in 4.1.2 (https://github.com/zombocom/rundoc/pull/97)
|
6
|
+
- Fix: Website commands such as `:::>> website.visit(...)` now use lazy lookup (like Background tasks since 4.1.2). This allows `pre.erb` to be used with these commands (https://github.com/zombocom/rundoc/pull/98)
|
7
|
+
|
3
8
|
## 4.1.2
|
4
9
|
|
5
10
|
- Fix: Background task name lookup is now lazy, this fixes a bug when using `:::>- pre.erb background.start(...)` (https://github.com/zombocom/rundoc/pull/95)
|
@@ -2,7 +2,11 @@ class Rundoc::CodeCommand::Website
|
|
2
2
|
class Navigate < Rundoc::CodeCommand
|
3
3
|
def initialize(name:)
|
4
4
|
@name = name
|
5
|
-
@driver =
|
5
|
+
@driver = nil
|
6
|
+
end
|
7
|
+
|
8
|
+
def driver
|
9
|
+
@driver ||= Rundoc::CodeCommand::Website::Driver.find(@name)
|
6
10
|
end
|
7
11
|
|
8
12
|
def to_md(env = {})
|
@@ -11,7 +15,7 @@ class Rundoc::CodeCommand::Website
|
|
11
15
|
|
12
16
|
def call(env = {})
|
13
17
|
puts "website.navigate [#{@name}]: #{contents}"
|
14
|
-
|
18
|
+
driver.safe_eval(contents, env)
|
15
19
|
""
|
16
20
|
end
|
17
21
|
|
@@ -1,8 +1,13 @@
|
|
1
1
|
class Rundoc::CodeCommand::Website
|
2
2
|
class Screenshot < Rundoc::CodeCommand
|
3
3
|
def initialize(name:, upload: false)
|
4
|
-
@
|
4
|
+
@name = name
|
5
5
|
@upload = upload
|
6
|
+
@driver = nil
|
7
|
+
end
|
8
|
+
|
9
|
+
def driver
|
10
|
+
@driver ||= Rundoc::CodeCommand::Website::Driver.find(@name)
|
6
11
|
end
|
7
12
|
|
8
13
|
def to_md(env = {})
|
@@ -10,14 +15,14 @@ class Rundoc::CodeCommand::Website
|
|
10
15
|
end
|
11
16
|
|
12
17
|
def call(env = {})
|
13
|
-
puts "Taking screenshot: #{
|
14
|
-
filename =
|
18
|
+
puts "Taking screenshot: #{driver.current_url}"
|
19
|
+
filename = driver.screenshot(
|
15
20
|
upload: @upload,
|
16
21
|
screenshots_dir: env[:context].screenshots_dir
|
17
22
|
)
|
18
23
|
|
19
24
|
relative_filename = filename.relative_path_from(env[:context].output_dir)
|
20
|
-
env[:before] << "![Screenshot of #{
|
25
|
+
env[:before] << "![Screenshot of #{driver.current_url}](#{relative_filename})"
|
21
26
|
""
|
22
27
|
end
|
23
28
|
|
@@ -6,14 +6,21 @@ class Rundoc::CodeCommand::Website
|
|
6
6
|
@name = name
|
7
7
|
@url = url
|
8
8
|
@scroll = scroll
|
9
|
-
@
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
9
|
+
@height = height
|
10
|
+
@width = width
|
11
|
+
@visible = visible
|
12
|
+
end
|
13
|
+
|
14
|
+
def driver
|
15
|
+
@driver ||= Driver.new(
|
16
|
+
name: @name,
|
17
|
+
url: @url,
|
18
|
+
height: @height,
|
19
|
+
width: @width,
|
20
|
+
visible: @visible
|
21
|
+
).tap do |driver|
|
22
|
+
Driver.add(@name, driver)
|
23
|
+
end
|
17
24
|
end
|
18
25
|
|
19
26
|
def to_md(env = {})
|
@@ -26,11 +33,11 @@ class Rundoc::CodeCommand::Website
|
|
26
33
|
|
27
34
|
puts message
|
28
35
|
|
29
|
-
|
30
|
-
|
36
|
+
driver.visit(@url) if @url
|
37
|
+
driver.scroll(@scroll) if @scroll
|
31
38
|
|
32
39
|
return "" if contents.nil? || contents.empty?
|
33
|
-
|
40
|
+
driver.safe_eval(contents, env)
|
34
41
|
|
35
42
|
""
|
36
43
|
end
|
data/lib/rundoc/version.rb
CHANGED
@@ -6,6 +6,8 @@ class IntegrationWebsiteTest < Minitest::Test
|
|
6
6
|
```
|
7
7
|
:::>> website.visit(name: "example", url: "http://example.com")
|
8
8
|
:::>> website.screenshot(name: "example")
|
9
|
+
:::>> website.navigate(name: "example")
|
10
|
+
session.execute_script "window.scrollBy(0,10)"
|
9
11
|
```
|
10
12
|
RUBY
|
11
13
|
|
@@ -19,6 +19,11 @@ class BackgroundTest < Minitest::Test
|
|
19
19
|
output = stdin_write.call
|
20
20
|
assert_equal("hello there" + $/, output)
|
21
21
|
|
22
|
+
Rundoc::CodeCommand::Background::Wait.new(
|
23
|
+
name: "cat",
|
24
|
+
wait: "hello"
|
25
|
+
).call
|
26
|
+
|
22
27
|
Rundoc::CodeCommand::Background::Log::Clear.new(
|
23
28
|
name: "cat"
|
24
29
|
).call
|