-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Force a ?flush=1 on first test run in browser #7
Comments
This might also be because we're using the same folder on our buildslave to run multiple projects. Let's try fixing that first, as this seems like a little bit of a hack. |
When you try to call getRegionObj with a string starting with a number, e.g. "60 NZ Minutes", the getRegionObj function will fail with a syntax exception, and not fall back to looking at the data-title attribute as designed. Stack trace of the exception thrown: | #0 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/Parser/Parser.php(281): Symfony\Component\CssSelector\Exception\SyntaxErrorException::unexpectedToken('selector', Object(Symfony\Component\CssSelector\Parser\Token)) | silverstripe#1 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/Parser/Parser.php(140): Symfony\Component\CssSelector\Parser\Parser->parseSimpleSelector(Object(Symfony\Component\CssSelector\Parser\TokenStream)) | silverstripe#2 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/Parser/Parser.php(116): Symfony\Component\CssSelector\Parser\Parser->parserSelectorNode(Object(Symfony\Component\CssSelector\Parser\TokenStream)) | silverstripe#3 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/Parser/Parser.php(51): Symfony\Component\CssSelector\Parser\Parser->parseSelectorList(Object(Symfony\Component\CssSelector\Parser\TokenStream)) | silverstripe#4 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/XPath/Translator.php(299): Symfony\Component\CssSelector\Parser\Parser->parse('60 NZ Minutes') | silverstripe#5 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/XPath/Translator.php(123): Symfony\Component\CssSelector\XPath\Translator->parseSelectors('60 NZ Minutes') | silverstripe#6 /var/www/public/vendor/symfony/css-selector/Symfony/Component/CssSelector/CssSelector.php(65): Symfony\Component\CssSelector\XPath\Translator->cssToXPath('60 NZ Minutes', 'descendant-or-s...') | silverstripe#7 /var/www/public/vendor/behat/mink/src/Behat/Mink/Selector/CssSelector.php(35): Symfony\Component\CssSelector\CssSelector::toXPath('60 NZ Minutes') | silverstripe#8 /var/www/public/vendor/behat/mink/src/Behat/Mink/Selector/SelectorsHandler.php(111): Behat\Mink\Selector\CssSelector->translateToXPath('60 NZ Minutes') | silverstripe#9 /var/www/public/vendor/behat/mink/src/Behat/Mink/Element/Element.php(159): Behat\Mink\Selector\SelectorsHandler->selectorToXpath('css', '60 NZ Minutes') | silverstripe#10 /var/www/public/vendor/behat/mink/src/Behat/Mink/Element/Element.php(140): Behat\Mink\Element\Element->findAll('css', '60 NZ Minutes') | silverstripe#11 /var/www/public/vendor/silverstripe/behat-extension/src/SilverStripe/BehatExtension/Context/SilverStripeContext.php(148): Behat\Mink\Element\Element->find('css', '60 NZ Minutes') Thanks, Igor
@chillu I come across cache-dir related issues all the time, and I'm sure I've encountered scenarios where some aspect of the F/S cache isn't cleared by flush= and I need to manually blow away the cache dir entirely - so for a bootstrapped env in which behat is running, couldn't you manually recursively delete the cache dir prior to the test run or just run behat via the webserver user?
|
@phptek you are right in that we don't trigger a delete on caches on flush; We could do a hard-reset of TEMP_DIR on flush, that that may be a little risky. How about a flush request processor that iterates all cache definitions in config, and invokes clear() on them? e.g.
Could be cleared with: class CacheFlushHandler implements Flushable {
public function flush()
{
$config = Config::inst()->get(Injector::class);
foreach ($config as $name => $definition) {
if (strtok($name, '.') === CacheInterface::class) {
$cache = Injector::inst()->get($name);
$cache->clear();
}
}
}
} |
@tractorcow while that might work, and not wanting to irk the crowd, but the original problem to me sounds like something that may best be "fixed" by bootstrapping the environment first, i.e. in calling code or in build pipelines. |
This issue concerns running tests through the browser, which can't be done anymore... |
@dhensby I initially commented on that too, but this is behat not phpunit. |
Whoops |
Whoops... |
Otherwise tests fail in a very unfriendly fashion. And given that CLI and web don't share the same cache folders, a
sake dev/build flush=1
won't fix this either. Keep performance in mind though.The text was updated successfully, but these errors were encountered: