Skip to content

Commit

Permalink
Merge pull request #3 from punktDe/feature/add-memorized-equal-test
Browse files Browse the repository at this point in the history
ADD: equality test for memorized values
  • Loading branch information
kabarakh authored Apr 14, 2020
2 parents 56f2d85 + f38a0c1 commit 75e4153
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Classes/ActorTraits/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,13 @@ public function elementTextShouldBeDifferentFromMemorized(string $selector): voi
{
$this->elementTextShouldNotBeEqualToStore($selector);
}

/**
* @Given the text in the :selector element should be equal from memorized
* @param string $selector
*/
public function elementTextShouldBeEqualFromMemorized(string $selector): void
{
$this->elementTextShouldBeEqualToStore($selector);
}
}
12 changes: 12 additions & 0 deletions Classes/Module/Storage.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,16 @@ public function elementTextShouldNotBeEqualToStore(string $selector): void

Assert::assertNotEquals($this->textStorage, $actual, 'Text is equal but should not be');
}

/**
* @param string $selector
* @throws ModuleException
*/
public function elementTextShouldBeEqualToStore(string $selector): void
{
$webdriver = $this->getModule('WebDriver');
$actual = $webdriver->grabTextFrom($selector);

Assert::assertEquals($this->textStorage, $actual, 'Text is not equal but should be');
}
}

0 comments on commit 75e4153

Please sign in to comment.