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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
//! WebDriver client that interacts with the web application
use Url;
use Deref;
use ;
use WebDriver;
use TypedBuilder;
/// WebDriver client that interacts with the web application
///
/// The `Client` implements the [WebDriver] protocol to interact with the web application. It is
/// preconfigured to target the server that has been passed to Doco so that users only need to
/// supply the path that they want to test.
///
/// Internally, the client uses the [thirtyfour] crate to interact with the WebDriver server. For
/// examples on what methods are available on the `Client` and how to interact with the web
/// application, see the [thirtyfour] documentation.
///
/// # Example
///
/// ```rust
/// use doco::{Client, Result};
///
/// #[doco::test]
/// async fn visit_root_path(client: Client) -> Result<()> {
/// client.goto("/").await?;
///
/// let body = client.source().await?;
///
/// assert!(body.contains("Hello World"));
///
/// Ok(())
/// }
/// #
/// # use doco::{Doco, Server};
/// #
/// # #[doco::main]
/// # async fn main() -> Doco {
/// # let server = Server::builder()
/// # .image("crccheck/hello-world")
/// # .tag("v1.0.0")
/// # .port(8000)
/// # .build();
/// #
/// # Doco::builder().server(server).build()
/// # }
/// ```
///
/// [thirtyfour]: https://crates.io/crates/thirtyfour
/// [webdriver]: https://developer.mozilla.org/en-US/docs/Web/WebDriver