src/Context/TqContext.php
public function iSwitchToWindow()
    {
        $windows = $this->getWindowNames();

        // If the window was not switched yet, then store it name and working element for future switching back.
        if (empty($this->mainWindow)) {
            $this->mainWindow['name'] = array_shift($windows);
            $this->mainWindow['element'] = $this->getWorkingElement();

            $window = reset($windows);
        } else {
            $window = $this->mainWindow['name'];
            $element = $this->mainWindow['element'];

            $this->mainWindow = [];
        }

        $this->getSession()->switchToWindow($window);
        $this->setWorkingElement(isset($element) ? $element : $this->getBodyElement());
    }
public function iSwitchToWindow()
    {
        $windows = $this->getWindowNames();

        // If the window was not switched yet, then store it name and working element for future switching back.
        if (empty($this->mainWindow)) {
            $this->mainWindow['name'] = array_shift($windows);
            $this->mainWindow['element'] = $this->getWorkingElement();

            $window = reset($windows);
        } else {
            $window = $this->mainWindow['name'];
            $element = $this->mainWindow['element'];

            $this->mainWindow = [];
        }

        $this->getSession()->switchToWindow($window);
        $this->setWorkingElement(isset($element) ? $element : $this->getBodyElement());
    }
Supports switching between the two windows only.

@Given /^(?:|I )switch to opened window$/
@Then /^(?:|I )switch back to main window$/