Conditions | 2 |
Paths | 2 |
Total Lines | 12 |
Code Lines | 8 |
Lines | 12 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
11 | public function assert() |
||
12 | { |
||
13 | $this->getTestCase()->assertElementExists($this->selector, $this->by); |
||
14 | try { |
||
15 | $this->getTestCase()->assertTrue( |
||
16 | $this->webDriver->{$this->by}($this->selector)->isDisplayed(), |
||
17 | sprintf('The element: %s, is not displayed and it should have been', $this->selector) |
||
18 | ); |
||
19 | } catch (\Exception $e) { |
||
20 | $this->getTestCase()->fail(sprintf('Element "%s" using selector "%s" is displayed', $this->selector, $this->by)); |
||
21 | } |
||
22 | } |
||
23 | |||
24 | } |
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.
You can also find more detailed suggestions in the “Code” section of your repository.