phpbb_ui_test_case::login PHP Method

login() protected method

protected login ( $username = 'admin' )
    protected function login($username = 'admin')
    {
        $this->add_lang('ucp');
        self::$webDriver->manage()->deleteAllCookies();
        $this->visit('ucp.php');
        $this->assertContains($this->lang('LOGIN_EXPLAIN_UCP'), self::$webDriver->getPageSource());
        self::$webDriver->manage()->deleteAllCookies();
        self::find_element('cssSelector', 'input[name=username]')->sendKeys($username);
        self::find_element('cssSelector', 'input[name=password]')->sendKeys($username . $username);
        self::find_element('cssSelector', 'input[name=login]')->click();
        $this->assertNotContains($this->lang('LOGIN'), $this->find_element('className', 'navbar')->getText());
        $cookies = self::$webDriver->manage()->getCookies();
        // The session id is stored in a cookie that ends with _sid - we assume there is only one such cookie
        foreach ($cookies as $cookie) {
            if (substr($cookie['name'], -4) == '_sid') {
                $this->sid = $cookie['value'];
            }
        }
        $this->assertNotEmpty($this->sid);
    }