@@ -21,23 +21,6 @@ public function __construct()
21
21
{
22
22
}
23
23
24
- /**
25
- * @Then I should see the terminal
26
- */
27
- public function iShouldSeeTheTerminal ()
28
- {
29
- $ page = $ this ->getSession ()->getPage ();
30
- $ elementList = $ page ->find ('css ' , '.terminal ' );
31
- foreach ($ elementList as $ element ) {
32
- if (!$ element ->isVisible ()) {
33
- throw new ExpectationException (
34
- 'Terminal is not visible, but visible expected. ' ,
35
- $ this ->getSession ()
36
- );
37
- }
38
- }
39
- }
40
-
41
24
/**
42
25
* @When I execute command :command
43
26
*/
@@ -54,20 +37,38 @@ public function iExecuteCommand($command)
54
37
" );
55
38
}
56
39
40
+ /**
41
+ * @Then I should see the terminal
42
+ */
43
+ public function iShouldSeeTheTerminal ()
44
+ {
45
+ $ terminal = $ this ->getTerminal ();
46
+ if (!$ terminal ->isVisible ()) {
47
+ throw new ExpectationException (
48
+ 'Terminal is not visible, but visible expected. ' ,
49
+ $ this ->getSession ()
50
+ );
51
+ }
52
+ }
53
+
57
54
/**
58
55
* @Then I should not see the terminal
59
56
*/
60
57
public function iShouldNotSeeTheTerminal ()
61
58
{
62
- $ page = $ this ->getSession ()->getPage ();
63
- $ elementList = $ page ->findAll ('css ' , '.terminal ' );
64
- foreach ($ elementList as $ element ) {
65
- if ($ element ->isVisible ()) {
66
- throw new ExpectationException (
67
- 'Terminal is visible, but invisible expected. ' ,
68
- $ this ->getSession ()
69
- );
70
- }
59
+ $ terminal = $ this ->getTerminal ();
60
+ if ($ terminal ->isVisible ()) {
61
+ throw new ExpectationException (
62
+ 'Terminal is visible, but invisible expected. ' ,
63
+ $ this ->getSession ()
64
+ );
71
65
}
72
66
}
67
+
68
+ private function getTerminal ()
69
+ {
70
+ return $ this ->getSession ()
71
+ ->getPage ()
72
+ ->find ('css ' , '.terminal ' );
73
+ }
73
74
}
0 commit comments