Skip to content

Latest commit

 

History

History
43 lines (30 loc) · 1.35 KB

context-extended-mink.md

File metadata and controls

43 lines (30 loc) · 1.35 KB

Extended Mink Context

Parent Entity Context

KnpLabs/FriendlyContexts

Spin function

As the Behat says:

Often, especially when using Mink to test web applications, you will find that Behat goes faster than your web application can keep up - it will try and click links or perform actions before the page has had chance to load, and therefore result in a failing test, that would have otherwise passed. To alleviate this problem, we can use spin functions, to repeatedly try and action or test a condition, until it works. This article looks at applying it to Mink, but the technique is applicable to any test using Behat.

Read the doc

Use the context directly (instead of its parent)

default:
    # ...
    suites:
        default:
            # ...
            contexts:
-                Knp\FriendlyContexts\Context\MinkContext
+                Troopers\BehatContexts\Context\ExtendedMinkContext

Or use the Trait if you use another MinkContext

<?php

namespace Acme\BehatContexts\Context;

use Behat\MinkExtension\Context\MinkContext;
use Troopers\BehatContexts\Context\SpinMinkContextTrait;

class MyMinkContext extends MinkContext
{
    use SpinMinkContextTrait;
}