-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathsearch.archive
75 lines (69 loc) · 2.2 KB
/
search.archive
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
# searchbox.ht
{
Name: Look for Searchbox on Homepage
Request: {
URL: https://www.example.org/homepage
}
Checks: [
// Start with two basic checks to make sure we got a sensible response.
{Check: "StatusCode", Expect: 200}
{Check: "ContentType", Is: "text/html"}
// Start looking for the search box. Become more and more specific.
// This makes traking problems easier.
{Check: "HTMLTag", Selector: "form.search"}
{Check: "HTMLTag", Selector: "form.search input[type=search\"]"}
{Check: "HTMLTag", Selector: "form.search input[type=search][placeholder=\"search website\"]"}
// Check target of this form: Must hit version 2 of search:
{Check: "HTMLTag", Selector: "form.search[action=\"/search_v2/\"]"}
]
}
# searchspeed.ht
{
Name: Search is fast
Request: {
URL: https://www.example.org/search_v2
Params: {
// This test can be parametrised with different query arguments.
q: "{{QUERY}}"
}
}
Checks: [
{Check: "StatusCode", Expect: 200}
{Check: "ResponseTime", Lower: "1.1s"}
]
}
# searchresults.ht
{
Name: Search produces sorted results
Request: {
URL: https://www.example.org/search_v2
Params: {
q: "open sesame" // has defined usage on site
}
}
Checks: [
{Check: "StatusCode", Expect: 200}
{Check: HTMLContains
Selector: ".results li.hit span.title"
Complete: true, InOrder: true
Text: [
"Ali Baba"
"Sample Document 1 (indexable)"
"Public Information 3"
]
}
]
}
# search.suite
{
Name: Test basic website search
Main: [
{File: "searchbox.ht"}
{File: "searchspeed.ht", Variables: {QUERY: ""}}
{File: "searchspeed.ht", Variables: {QUERY: "blaxyz"}} // no search result
{File: "searchspeed.ht", Variables: {QUERY: "open sesame"}} // exaclty 3 results
{File: "searchspeed.ht", Variables: {QUERY: "product"}} // lots of results
{File: "searchspeed.ht", Variables: {QUERY: "name"}} // hundreds of results
{File: "searchresults.ht"}
]
}