/** * Scenario: As AN, I should be redirected to https if ssl.force parameter is set to true. * Given I am an anonymous user * When I am trying to access the login page * Then I should see that I am automatically redirected to the https version of it */ public function testSslRedirect() { PassboltServer::setExtraConfig(['App' => ['ssl' => ['force' => true]]]); $this->getUrl('auth/login'); $url = $this->driver->getCurrentURL(); try { $this->assertTrue(preg_match('/https.*\\/auth\\/login/', $url) === 1); } catch (Exception $e) { PassboltServer::resetExtraConfig(); throw $e; } PassboltServer::resetExtraConfig(); }
/** * Switch config to use primary domain (for multi domain testing). * * Switch will happen only if a first switch to secondary domain was done first. */ public function switchToPrimaryDomain() { // Switch needs to be done only if a switch to secondary domain was done first. if (Config::read('passbolt.url_primary')) { // Reset the config with the base url. Config::write('passbolt.url', Config::read('passbolt.url_primary')); PassboltServer::resetExtraConfig(); } }
/** * Scenario: As LU I should be logged out when I close the passbolt tab and restore it after my session expired * Given I am Ada * And I am logged in on the passwords workspace * When I close the tab and restore it after my session is expired * Then I should be logged out * * @throws Exception */ public function testCloseRestoreTabAndLoggedOutAfterSessionExpired() { // Given I am Ada $user = User::get('ada'); $this->setClientConfig($user); // And I am on second tab $this->openNewTab(); // Reduce the session timeout to accelerate the test PassboltServer::setExtraConfig(['Session' => ['timeout' => 0.25]]); // And I am logged in on the password workspace $this->loginAs($user); // When I close and restore the tab $this->closeAndRestoreTab(array('waitBeforeRestore' => 15)); // Then I should be logged out $this->waitUntilUrlMatches('auth/login', 120); }