Skip to content

Commit

Permalink
Fix Behat stability (#1684)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored Oct 21, 2021
1 parent 5d62861 commit c7e1960
Show file tree
Hide file tree
Showing 98 changed files with 11 additions and 27 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ jobs:
if [ -n "$LOG_COVERAGE" ]; then mkdir coverage && cp tools/CoverageUtil.php demos; fi
sed -i "s~'https://raw.githack.com/atk4/ui/develop/public.*~'/public',~" src/App.php
ci_wait_until () { timeout 30 sh -c "until { $1 2> /dev/null; }; do sleep 0.02; done" || timeout 15 sh -c "$1" || { echo "health timeout: $1"; exit 1; }; }
php -S 127.0.0.1:8888 > /dev/null 2>&1 &
php -d opcache.enable_cli=1 -S 127.0.0.1:8888 > /dev/null 2>&1 &
ci_wait_until 'nc -w 1 127.0.0.1 8888'
if [ -f /etc/alpine-release ]; then addgroup browser && adduser browser -G browser -D -s /bin/sh; else adduser browser --gecos "" --disabled-login -shell /bin/sh > /dev/null; fi
{ Xvfb -ac :99 -screen 0 1920x1200x24 2> /dev/null & } && export DISPLAY=:99
Expand Down
2 changes: 1 addition & 1 deletion docs/app.rst
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ Loading Templates for Views
.. php:method:: loadTemplate($name)
Views use :php:attr:`View::$defaultTemplate` to specify which template they are using. By default
those are loaded from `vendor/atk4/ui/template/semantic-ui` however by overriding this method,
those are loaded from `vendor/atk4/ui/template` however by overriding this method,
you can specify extended logic.

You may override this method if you are using a different CSS framework.
Expand Down
9 changes: 1 addition & 8 deletions docs/view.rst
Original file line number Diff line number Diff line change
Expand Up @@ -353,7 +353,7 @@ relative to a current file::
View::addTo($app, ['defaultTemplate' => __DIR__.'/../templates/mytpl.httml']);

Agile UI does not currently provide advanced search path for templates, by default the
template is loaded from folder `vendor/atk4/ui/template/semantic-ui/`. To change this
template is loaded from folder `vendor/atk4/ui/template`. To change this
behaviour, see :php:class:`App::loadTemplate()`.

.. php:attr:: region
Expand Down Expand Up @@ -486,13 +486,6 @@ Rest of yet-to-document/implement methods and properties
========================================================


.. php:attr:: skin
protected

Just here temporarily, until App picks it up


.. php:attr:: content
Set static contents of this view.
Expand Down
5 changes: 1 addition & 4 deletions src/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,6 @@ class App
*/
public $template_dir;

/** @var string Name of skin */
public $skin = 'semantic-ui';

/**
* Will replace an exception handler with our own, that will output errors nicely.
*
Expand Down Expand Up @@ -269,7 +266,7 @@ protected function setupTemplateDirs()
$this->template_dir = [$this->template_dir];
}

$this->template_dir[] = dirname(__DIR__) . '/template/' . $this->skin;
$this->template_dir[] = dirname(__DIR__) . '/template';
}

protected function callBeforeExit(): void
Expand Down
13 changes: 7 additions & 6 deletions src/Behat/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ public function closeAllToasts(BeforeStepScope $event): void
return;
}

if (strpos($event->getStep()->getText(), 'Toast display should contains text ') !== 0) {
$this->getSession()->executeScript('$(\'.toast-box > .ui.toast\').toast(\'close\');');
if (!str_starts_with($event->getStep()->getText(), 'Toast display should contains text ')) {
$this->getSession()->executeScript('jQuery(\'.toast-box > .ui.toast\').toast(\'close\');');
}
}

Expand All @@ -52,6 +52,7 @@ protected function getFinishedScript(): string
{
return 'document.readyState === \'complete\''
. ' && typeof jQuery !== \'undefined\' && jQuery.active === 0'
. ' && document.querySelectorAll(\'.animating.ui.transition:not(.looping)\').length === 0'
. ' && typeof atk !== \'undefined\' && atk.vueService.areComponentsLoaded()';
}

Expand All @@ -73,7 +74,7 @@ protected function jqueryWait(string $extraWaitCondition = 'true', int $maxWaitd
}
} else {
$c = 0;
usleep(50000);
usleep(20000);
}
}

Expand Down Expand Up @@ -273,7 +274,7 @@ public function iClickIconUsingCss(string $selector): void
*/
public function iPressModalButton(string $buttonLabel): void
{
$modal = $this->getElementInPage('.modal.transition.visible.active.front');
$modal = $this->getElementInPage('.modal.visible.active.front');
$btn = $this->getElementInElement($modal, '//div[text()="' . $buttonLabel . '"]', 'xpath');
$btn->click();
}
Expand All @@ -286,7 +287,7 @@ public function iPressModalButton(string $buttonLabel): void
*/
public function modalIsOpenWithText(string $text, string $tag = 'div'): void
{
$modal = $this->getElementInPage('.modal.transition.visible.active.front');
$modal = $this->getElementInPage('.modal.visible.active.front');
$this->getElementInElement($modal, '//' . $tag . '[text()="' . $text . '"]', 'xpath');
}

Expand All @@ -295,7 +296,7 @@ public function modalIsOpenWithText(string $text, string $tag = 'div'): void
*/
public function iFillModalField(string $fieldName, string $value): void
{
$modal = $this->getElementInPage('.modal.transition.visible.active.front');
$modal = $this->getElementInPage('.modal.visible.active.front');
$field = $modal->find('named', ['field', $fieldName]);
$field->setValue($value);
}
Expand Down
7 changes: 0 additions & 7 deletions src/View.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,6 @@ class View extends AbstractView implements JsExpressionable
*/
public $attr = [];

/**
* Just here temporarily, until App picks it up.
*
* @var string
*/
protected $skin;

/**
* Template object, that, for most Views will be rendered to
* produce HTML output. If you leave this object as "null" then
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit c7e1960

Please sign in to comment.