src/Context/TqContext.php
public function afterStep(Scope\StepScope $scope)
    {
        // If "mainWindow" variable is not empty that means that additional window has been opened.
        // Then, if number of opened windows equals to one, we need to switch back to original window,
        // otherwise an error will occur: "Window not found. The browser window may have been closed".
        // This happens due to auto closing window by JavaScript (CKFinder does this after choosing a file).
        if (!empty($this->mainWindow) && count($this->getWindowNames()) == 1) {
            $this->iSwitchToWindow();
        }

        if (self::hasTag('javascript') && self::isStepImpliesJsEvent($scope)) {
            $this->waitAjaxAndAnimations();
        }
    }
public function afterStep(Scope\StepScope $scope)
    {
        // If "mainWindow" variable is not empty that means that additional window has been opened.
        // Then, if number of opened windows equals to one, we need to switch back to original window,
        // otherwise an error will occur: "Window not found. The browser window may have been closed".
        // This happens due to auto closing window by JavaScript (CKFinder does this after choosing a file).
        if (!empty($this->mainWindow) && count($this->getWindowNames()) == 1) {
            $this->iSwitchToWindow();
        }

        if (self::hasTag('javascript') && self::isStepImpliesJsEvent($scope)) {
            $this->waitAjaxAndAnimations();
        }
    }
IMPORTANT! The "AfterStep" hook should not be tagged, because steps has no tags!

@param Scope\StepScope|Scope\AfterStepScope $scope
Scope of the processing step.

@AfterStep