@Then I should see( the text) :text in the :region( region)

@throws \Exception
If region or text within it cannot be found.
423031
public function assertRegionText($text, $region)
    {
        $regionObj = $this->getRegion($region);

        // Find the text within the region
        $regionText = $regionObj->getText();
        if (strpos($regionText, $text) === false) {
            throw new \Exception(sprintf("The text '%s' was not found in the region '%s' on the page %s", $text, $region, $this->getSession()->getCurrentUrl()));
        }
    }
1274426
private function validate()
    {
        if (!stristr(self::CHARACTER_LIST, $this->value[0])) {
            throw new \Exception('Invalid first character: ' . $this->value[0]);
        }

        if (!in_array($this->value, self::listForCharacter($this->value[0]))) {
            throw new \Exception('Word not in known list of words: ' . $this->value);
        }
    }
137517
public function isRegionInEditMode($region)
    {
        if ($site = $this->siteManager->getContext()) {
            return
                ($this->getPageContext()->isTemporary() && $this->isPageContextRegion($region, $site->theme)) ||
                ($this->getSiteContext()->isTemporary() && $this->isTransversalContextRegion($region, $site->theme))
            ;
        }
        return false;
    }
915278
public function assertRegionHeading($heading, $region)
    {
        $regionObj = $this->getRegion($region);

        foreach (array('h1', 'h2', 'h3', 'h4', 'h5', 'h6') as $tag) {
            $elements = $regionObj->findAll('css', $tag);
            if (!empty($elements)) {
                foreach ($elements as $element) {
                    if (trim($element->getText()) === $heading) {
                        return;
                    }
                }
            }
        }

        throw new \Exception(sprintf('The heading "%s" was not found in the "%s" region on the page %s', $heading, $region, $this->getSession()->getCurrentUrl()));
    }
1299518
public function assertRegionLinkFollow($link, $region)
    {
        $regionObj = $this->getRegion($region);

        // Find the link within the region
        $linkObj = $regionObj->findLink($link);
        if (empty($linkObj)) {
            throw new \Exception(sprintf('The link "%s" was not found in the region "%s" on the page %s', $link, $region, $this->getSession()->getCurrentUrl()));
        }
        $linkObj->click();
    }
459565
public function unsetTemporaryRegion(): self
	{
		if ($this->isSettingSet(self::SET_ORIG_REGION))
		{
			$region = $this->getSetting(self::SET_ORIG_REGION);
			$this->setSetting(self::SET_REGION, $region);
			$this->setSetting(self::SET_PLATFORM, $this->platforms->getPlatformName($region));
			$this->setSetting(self::SET_ORIG_REGION, null);
		}
		return $this;
	}
1161019
private function getRegionTitle($region)
    {
        $region = str_replace('_', ' ', $region);

        $region = explode('/', $region);
        $title = array_shift($region);
        foreach ($region as $part) {
            $title .= ' (' . $part . ')';
        }

        return $title;
    }
1238317
protected function load()
    {
        if (false !== ($token = @file_get_contents($this->getFilename()))) {
            $this->token = trim($token);
        } else {
            throw new \Exception(sprintf('Token could not be loaded from "%s"', $this->getFilename()));
        }
    }
493899
private void parseCountries(List<String> content) throws Exception {
        for (String line : content) {
            Matcher matcher = COUNTRY_REGEX_LINE.matcher(line);
            if (matcher.matches()) {
                String countryCode = matcher.group(1);
                String currencyCode = matcher.group(2);
                registerCountry(countryCode, currencyCode);
            }
        }
    }
727982
public function onPageSectionISeeText( $text, $pageSection = null )
    {
        trigger_error(
            "onPageSectionISeeText is deprecated since v6.3.0 and will be removed in v7.0.0",
            E_USER_DEPRECATED
        );

        $base = $this->makeXpathForBlock( $pageSection );

        $literal = $this->getXpath()->literal( $text );
        $el = $this->getXpath()->findXpath( "$base//*[contains( text(), $literal )]" );

        Assertion::assertNotNull( $el, "Couldn't find '$text' text" );
        Assertion::assertEquals( trim( $el->getText() ), $text, "Couldn't find '$text' text" );
    }
1072188
protected function checkAreaCode()
    {
        /* Magento related config (Object Manager) */
        $manObj = \Magento\Framework\App\ObjectManager::getInstance();
        /** @var \Magento\Framework\App\State $appState */
        $appState = $manObj->get(\Magento\Framework\App\State::class);
        try {
            /* area code should be set only once */
            $appState->getAreaCode();
        } catch (\Magento\Framework\Exception\LocalizedException $e) {
            /* exception will be thrown if no area code is set */
            $areaCode = \Magento\Framework\App\Area::AREA_GLOBAL;
            $appState->setAreaCode($areaCode);
            /** @var \Magento\Framework\ObjectManager\ConfigLoaderInterface $configLoader */
            $configLoader = $manObj->get(\Magento\Framework\ObjectManager\ConfigLoaderInterface::class);
            $config = $configLoader->load($areaCode);
            $manObj->configure($config);
        }
    }
50629
protected function _getRegionData() {
        $this->_streamOutput->writeln('Downloading new region listing…');
        $regionsFile = $this->_getFileTmp('region.csv');
        $this->_download($regionsFile, self::REGION_URL);
        $regionsPath = $regionsFile->getPathOnLocalFilesystem();
        $handle = fopen($regionsPath, 'r');
        if (!$handle) {
            throw new CM_Exception('Could not open file', null, ['file' => $regionsPath]);
        }

        $this->_streamOutput->writeln('Reading new region listing…');
        $regionData = array();
        while (false !== ($row = fgetcsv($handle))) {
            if (count($row) >= 3) { // Skip empty lines
                $regionData[] = $row;
            }
        }
        if (!fclose($handle)) {
            throw new CM_Exception('Could not close file', null, ['file' => $regionsPath]);
        }
        return $regionData;
    }
902561
private void parseContent() throws Exception {
        char c;

        while (true) {
            // consume characters (or ignorable whitspace) until delimiter
            parseCharData();

            // Handle delimiters
            c = readCh();
            switch (c) {
                case '&': // Found "&"
                    c = readCh();
                    if (c == '#') {
                        parseCharRef();
                    } else {
                        unread(c);
                        parseEntityRef(true);
                    }
                    isDirtyCurrentElement = true;
                    break;

                case '<': // Found "<"
                    dataBufferFlush();
                    c = readCh();
                    switch (c) {
                        case '!': // Found "<!"
                            c = readCh();
                            switch (c) {
                                case '-': // Found "<!-"
                                    require('-');
                                    isDirtyCurrentElement = false;
                                    parseComment();
                                    break;
                                case '[': // Found "<!["
                                    isDirtyCurrentElement = false;
                                    require("CDATA[");
                                    handler.startCDATA();
                                    inCDATA = true;
                                    parseCDSect();
                                    inCDATA = false;
                                    handler.endCDATA();
                                    break;
                                default:
                                    fatal("expected comment or CDATA section",
                                            c, null);
                                    break;
                            }
                            break;

                        case '?': // Found "<?"
                            isDirtyCurrentElement = false;
                            parsePI();
                            break;

                        case '/': // Found "</"
                            isDirtyCurrentElement = false;
                            parseETag();
                            return;

                        default: // Found "<" followed by something else
                            isDirtyCurrentElement = false;
                            unread(c);
                            parseElement(false);
                            break;
                    }
            }
        }
    }
770087
@Then("^this text exists '(.+?)'$")
    public void assertSeleniumTextInSource(String text) {
        assertThat(this.commonspec, commonspec.getDriver()).as("Expected text not found at page").contains(text);
    }
322366
public function getOnEmptyText()
    {
        static $warned;

        $dir = $this->getPath(false, 'index');

        if (! is_dir($dir)) {
            try {
                \MUtil_File::ensureDir($dir);

            } catch (\Zend_Exception $e) {
                $text = $e->getMessage();

                if (! $warned) {
                    $warned = true;
                    $this->addMessage($text);
                }
                return $text;
            }
        }

        return parent::getOnEmptyText();
    }
878184
public function getRegion()
    {
        $region = $this->getRegionFromLocale($this->getLocale());
        if (!$region) {
            $region = $this->findRegion();
        }

        return $region;
    }
87742
protected function parseContent()
    {
        $flatContent = implode($this->content);

        try {
            $parser = $this->getParser();
            $this->syntaxTree = $parser->parse($flatContent);
        } catch (Error $e) {
            throw new Exception('Error on parsing '.$this->classShortName." class\n".$e->getMessage());
        }

        return $this;
    }