Conditions | 2 |
Paths | 3 |
Total Lines | 13 |
Code Lines | 7 |
Lines | 13 |
Ratio | 100 % |
Changes | 0 |
1 | <?php |
||
15 | public function assert() |
||
16 | { |
||
17 | $by = $this->getTestCase()->filterWebDriverAction($this->by); |
||
18 | try { |
||
19 | $this->webDriver->wait(1)->until(ExpectedCondition::elementToBeClickable(WebDriverBy::$by($this->selector))); |
||
20 | $this->getTestCase()->fail(sprintf('The element %s, located with %s, is clickable but should not be', $this->selector, $by)); |
||
21 | } catch (\Exception $e) { |
||
22 | // A failure is what we are hoping for. It indicates that the element is not clickable, just like what the class wants |
||
23 | |||
24 | // Protects against warnings that the test had no assertions. |
||
25 | AbstractTestCase::assertTrue(true); |
||
26 | } |
||
27 | } |
||
28 | |||
30 |
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.