<commit_before><?php

/**
 * Anonymous user with plugin but no config open passbolt test
 *
 * @copyright (c) 2015-present Bolt Softwares Pvt Ltd
 * @licence GNU Affero General Public License http://www.gnu.org/licenses/agpl-3.0.en.html
 */
class OpenPassboltTest extends PassboltSetupTestCase {

	/**
	 * Scenario :   As an AP with a plugin installed but not configured, clicking on the passbolt toolbar icon or using
	 * 				the passbolt shortcut, I should open the passbolt public page "getting started" in a new tab
	 * Given 		Wherever I am on the web
	 * And			The passbolt plugin is installed
	 * And			The passbolt plugin is not configured
	 * When			I click on the passbolt toolbar icon or I compose the passbolt shortcut
	 * Then			I should reach the passbolt public page "getting started" in a new tab
	 * And			This page redirects me to the demo login
	 */
	public function testOpenPassboltNoConfig() {
		$this->findByCss('body')->sendKeys(array(WebDriverKeys::SHIFT, WebDriverKeys::ALT, 'p'));
 		//$this->waitUntilUrlMatches('https://www.passbolt.com/start', false);
		$this->waitUntilUrlMatches('https://demo.passbolt.com/auth/login', false);
	}

	/**
	 * Scenario :   As an AP with a plugin installed and partially configured, clicking on the passbolt toolbar icon or using
	 * 				the passbolt shortcut, I should open the setup in a new tab
	 * Given 		Wherever I am on the web
	 * And			The passbolt plugin is installed
	 * And			The passbolt plugin is partially configured
	 * When			I click on the passbolt toolbar icon or I compose the passbolt shortcut
	 * Then			I should reach the setup in a new tab
	 */
	public function testOpenPassboltPartialConfig() {
		// Reset database at the end of test.
		$this->resetDatabaseWhenComplete();

		$key = Gpgkey::get(['name' => 'johndoe']);

		// Register <NAME> as a user.
		$this->registerUser('John', 'Doe', $key['owner_email']);

		// Go to setup page.<commit_msg>PASSBOLT-1725 make the test compatible chrome and firefox<commit_after><?php

/**
 * Anonymous user with plugin but no config open passbolt test
 *
 * @copyright (c) 2015-present Bolt Softwares Pvt Ltd
 * @licence GNU Affero General Public License http://www.gnu.org/licenses/agpl-3.0.en.html
 */
class OpenPassboltTest extends PassboltSetupTestCase {

	/**
	 * Scenario :   As an AP with a plugin installed but not configured, clicking on the passbolt toolbar icon or using
	 * 				the passbolt shortcut, I should open the passbolt public page "getting started" in a new tab
	 * Given 		Wherever I am on the web
	 * And			The passbolt plugin is installed
	 * And			The passbolt plugin is not configured
	 * When			I click on the passbolt toolbar icon or I compose the passbolt shortcut
	 * Then			I should reach the passbolt public page "getting started" in a new tab
	 * And			This page redirects me to the demo login
	 */
	public function testOpenPassboltNoConfig() {
		$this->waitUntilISee('body');
		$this->findByCss('body')->sendKeys(array(WebDriverKeys::SHIFT, WebDriverKeys::ALT, 'p'));
		// Ensure the selenium works on the new tab.
		$handles=$this->driver->getWindowHandles();
		$last_window = next($handles);
		$this->driver->switchTo()->window($last_window);
 		//$this->waitUntilUrlMatches('https://www.passbolt.com/start', false);
		$this->waitUntilUrlMatches('https://demo.passbolt.com/auth/login', false);
	}

	/**
	 * Scenario :   As an AP with a plugin installed and partially configured, clicking on the passbolt toolbar icon or using
	 * 				the passbolt shortcut, I should open the setup in a new tab
	 * Given 		Wherever I am on the web
	 * And			The passbolt plugin is installed
	 * And			The passbolt plugin is partially configured
	 * When			I click on the passbolt toolbar icon or I compose the passbolt shortcut
	 * Then			I should reach the setup in a new tab
	 */
	public function testOpenPassboltPartialConfig() {
		// Reset database at the end of test.
		$this->resetDatabaseWhenComplete();

		$key = Gpgkey::get(['name' => 'johndoe']);

		// Register <NAME> as a user.
		$this->registerUser('John', 'Doe', $key['owner_email']);

		// Go to setup page.
{'fraction_non_alphanumeric': 0.0959902794653706, 'fraction_numerical': 0.003888213851761847, 'mean_word_length': 3.7147766323024056, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 25, 'https://': 4, 'lorem ipsum': 0, 'www.': 4, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2345382', 'n_tokens_mistral': 1357, 'n_tokens_neox': 1178, 'n_words': 483}