summaryrefslogtreecommitdiffstats
path: root/pkg/integration/components/search_driver.go
blob: 498047cce9d99fc551363323db42ed4955e731b0 (plain)
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
package components

// TODO: soft-code this
const ClearKey = "<c-u>"

type SearchDriver struct {
	t *TestDriver
}

func (self *SearchDriver) getViewDriver() *ViewDriver {
	return self.t.Views().Search()
}

// asserts on the text initially present in the prompt
func (self *SearchDriver) InitialText(expected *TextMatcher) *SearchDriver {
	self.getViewDriver().Content(expected)

	return self
}

func (self *SearchDriver) Type(value string) *SearchDriver {
	self.t.typeContent(value)

	return self
}

func (self *SearchDriver) Clear() *SearchDriver {
	self.t.press(ClearKey)

	return self
}

func (self *SearchDriver) Confirm() {
	self.getViewDriver().PressEnter()
}

func (self *SearchDriver) Cancel() {
	self.getViewDriver().PressEscape()
}