src/Context/Redirect/RedirectContext.php
public function shouldBeRedirected($page = null)
    {
        $wait = $this->getTqParameter('wait_for_redirect');
        $pages = [];
        $seconds = 0;

        new Message('comment', 4, ['Waiting %s seconds for redirect...'], [$wait]);

        if (isset($page)) {
            $page = trim($page, '/');
            $pages = [$page, $this->locatePath($page)];
        }

        while ($wait >= $seconds++) {
            $url = $this->getCurrentUrl();
            $raw = explode('?', $url)[0];

            self::debug([
                'Expected URLs: %s',
                'Current URL: %s',
            ], [
                implode(', ', $pages),
                $raw,
            ]);

            if ((!empty($pages) && in_array($raw, $pages)) || $url === self::$pageUrl) {
                return;
            }

            sleep(1);
        }

        throw new \OverflowException('The waiting time is over.');
    }
public function shouldBeRedirected($page = null)
    {
        $wait = $this->getTqParameter('wait_for_redirect');
        $pages = [];
        $seconds = 0;

        new Message('comment', 4, ['Waiting %s seconds for redirect...'], [$wait]);

        if (isset($page)) {
            $page = trim($page, '/');
            $pages = [$page, $this->locatePath($page)];
        }

        while ($wait >= $seconds++) {
            $url = $this->getCurrentUrl();
            $raw = explode('?', $url)[0];

            self::debug([
                'Expected URLs: %s',
                'Current URL: %s',
            ], [
                implode(', ', $pages),
                $raw,
            ]);

            if ((!empty($pages) && in_array($raw, $pages)) || $url === self::$pageUrl) {
                return;
            }

            sleep(1);
        }

        throw new \OverflowException('The waiting time is over.');
    }
@param string $page
Expected page URL.

@throws \Exception
@throws \OverflowException

@Then /^(?:|I )should be redirected(?:| on "([^"]*)")$/