In an attempt to use assertSelectorWillNotContain in a test of a change in data value I used $this->assertSelectorWillNotContain("document.querySelector('#mealid').getAttribute('data-rte')", $rteCount); In a Firefox console the command document.querySelector('#mealid').getAttribute('data-rte') returns an integer. In a functional test, however, I get the error Given css selector expression "document.querySelector('#mealid').getAttribute('data-rte')" is invalid. Is there a syntax that will be acceptable in both a console and a test
Edit: Identical results are obtained with the equivalent selector document.querySelector('#mealid').dataset.rte. Even giving up hiding the value that changes and doing something as simple as document.querySelector('.rte') I get invalid selector. Here's the test:
use Symfony\Component\Panther\PantherTestCase;
class MealTest extends PantherTestCase
{
public function testFood()
{
$client = static::createPantherClient();
$client->followRedirects();
$client->request('GET', 'http://diet/meal');
$crawler = $client->clickLink('edit');
$rteCount = $crawler->filter('.rte')->text();
$client->executeScript("document.querySelector('#meal_pantry td').click()");
$this->assertSelectorWillNotContain("document.querySelector('.rte').textContent", $rteCount);
}
}
In an attempt to use
assertSelectorWillNotContain
in a test of a change in data value I used$this->assertSelectorWillNotContain("document.querySelector('#mealid').getAttribute('data-rte')", $rteCount);
In a Firefox console the commanddocument.querySelector('#mealid').getAttribute('data-rte')
returns an integer. In a functional test, however, I get the errorGiven css selector expression "document.querySelector('#mealid').getAttribute('data-rte')" is invalid
. Is there a syntax that will be acceptable in both a console and a testEdit: Identical results are obtained with the equivalent selector
document.querySelector('#mealid').dataset.rte
. Even giving up hiding the value that changes and doing something as simple asdocument.querySelector('.rte')
I get invalid selector. Here's the test: