Use $webDriver->see('text', ['css' => '.class'])
This fails because phpunit Assert::assertThat($haystack, Constraint $constraint, string $message = '') has third paramether typehinted as a string. Array ['css' => '.class'] is given.
There was 1 error:
...
[TypeError] Argument 3 passed to PHPUnit\Framework\Assert::assertThat() must be of the type string, array given, called in /var/www/shopsys-framework/vendor/codeception/codeception/src/Codeception/Util/Shared/Asserts.php on line 289
...
/var/www/shopsys-framework/vendor/phpunit/phpunit/src/Framework/Assert.php:2205
/var/www/shopsys-framework/vendor/codeception/codeception/src/Codeception/Util/Shared/Asserts.php:289
/var/www/shopsys-framework/vendor/codeception/codeception/src/Codeception/Module/WebDriver.php:2856
/var/www/shopsys-framework/vendor/codeception/codeception/src/Codeception/Module/WebDriver.php:882
...
ERRORS!
Tests: 1, Assertions: 1, Errors: 1.
composer show)phpunit/php-code-coverage 6.0.1 Library that provides collection, processing, and rendering functionality for PHP code coverage ...
phpunit/php-file-iterator 1.4.5 FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-text-template 1.2.1 Simple template engine.
phpunit/php-timer 2.0.0 Utility class for timing
phpunit/php-token-stream 3.0.0 Wrapper around PHP's tokenizer extension.
phpunit/phpunit 7.0.2 The PHP Unit Testing framework.
phpunit/phpunit-mock-objects 6.0.1
sebastian/code-unit-reverse-lookup 1.0.1 Looks up which function or method a line of code belongs to
sebastian/comparator 2.1.3 Provides the functionality to compare PHP values for equality
sebastian/diff 3.0.0 Diff implementation
sebastian/environment 3.1.0 Provides functionality to handle HHVM/PHP environments
sebastian/exporter 3.1.0 Provides the functionality to export PHP variables for visualization
sebastian/global-state 2.0.0 Snapshotting of global state
sebastian/object-enumerator 3.0.3 Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector 1.1.1 Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context 3.0.0 Provides functionality to recursively process PHP variables
sebastian/resource-operations 1.0.0 Provides a list of PHP built-in functions that operate on resources
sebastian/version 2.0.1
codeception/codeception 2.4.0 BDD-style testing framework
codeception/phpunit-wrapper 7.0.2 PHPUnit classes used by Codeception
codeception/stub 1.0.2
I'm running into this issue as well. This error is confusing given the WebDriver documentation for see(), which gives a strict selector as an example:
You can specify a specific HTML element (via CSS or XPath) as the second parameter to only search within that element.
<?php $I->see('Logout'); // I can suppose user is logged in $I->see('Sign Up', 'h1'); // I can suppose it's a signup page $I->see('Sign Up', '//body/h1'); // with XPath $I->see('Sign Up', ['css' => 'body h1']); // with strict CSS locator
any updates on this?
:rocket: Thanks!
Most helpful comment
any updates on this?