<commit_before><?php

namespace PrestaShop\PSTAF\OnDemandTest;

use PrestaShop\PSTAF\OnDemand\AccountCreation;
use PrestaShop\PSTAF\Helper\Spinner;

class ClientAreaTest extends \PrestaShop\PSTAF\TestCase\OnDemandTestCase
{
	public function getSecretsName()
	{
		// Share the secrets
		return 'EndToEndTest';
	}

	public function languageAndCountryPairs()
	{
		return [
			['en', 'United States'],
			['fr', 'France'],
			['es', 'Spain'],
			['it', 'Italy'],
			['nl', 'Netherlands'],
			['pt', 'Brazil']
		];
	}

	/**
	 * @parallelize
	 * @dataProvider languageAndCountryPairs
	 */
	public function testSubdomainsCanBeBought($language, $country)
	{
		self::setValue('language', $language);
		self::setValue('country', $country);

		$accountCreation = new AccountCreation($this->homePage);

		$uid = md5(microtime().getmypid());

		$secrets = $this->getSecrets();

		$email =  implode("+$uid@", explode('@', $secrets['customer']['email']));

		$data = $accountCreation->createAccountAndShop([
			'email' 	=> $email,
			'password'	=> $secrets['customer']['password'],
			'shop_name' => $uid,
			'language'	=> $language,
			'country'	=> $country,
			'waitForSubdomain' => false
		]);

		$myStoresPage = $data['myStoresPage'];

		/*$myStoresPage = $this->homePage->visit()->login(
			'<EMAIL>',
			'123456789'
		);*/

		$domains = $myStoresPage->gotoDomains();

		while(!$domains->checkIfDomainIsAvailable(md5(microtime()).'.com'));

		$addressForm = $domains->orderDomain();

		$addressForm
		->setAddress('55, Main Street')
		->setPostCode($this->extraLocalizationData('addressData.postCode', '12345'))
		->setCity('Nöwhär')
		->setCountryId($this->extraLocalizationData('addressData.countryId', '1'));

		if (($stateId = $this->extraLocalizationData('addressData.stateId'))) {
			sleep(5);
			$addressForm->setStateId($stateId);
		}

		$addressForm
		->setPhone('0658795126')
		->setAlias('Yiha My Address');

		$addressForm->save();


		$this->browser->click('a.be2bill_link')->clickFirstVisible('[name="submitBe2billForm"]');

		try {
			$this->browser->ensureElementShowsUpOnPage('#be2bill_iframe');
			$this->browser->switchToIFrame('be2bill_iframe');
			$this->browser->ensureElementShowsUpOnPage('#b2b-submit');
		} catch (\Exception $e) {
			throw new \Exception('It seems the be2bill iframe did not show up.');
		}
	}

	public function testSubdomainsCanBeBound()
	{
		$domainsPage = $this->homePage->visit()->gotoMyStores()->gotoDomains();

		$domain = md5(microtime()) . $this->getSecrets()['subdomain'];

		$domainsPage->bindDomain($domain);

		$settingsPage = $this->homePage->visit()->gotoMyStores()->gotoSettings();

		$spinner = new Spinner('Domain `' . $domain . '` wasn\'t bound in 30 minutes.', 1800, 1000);

		$spinner->assertBecomesTrue(function () use ($settingsPage, $domain) {
			$this->getBrowser()->reload();
			return $settingsPage->isDomainActive($domain);
		});
	}
}
<commit_msg>// avoid potential infinite loop<commit_after><?php

namespace PrestaShop\PSTAF\OnDemandTest;

use PrestaShop\PSTAF\OnDemand\AccountCreation;
use PrestaShop\PSTAF\Helper\Spinner;

class ClientAreaTest extends \PrestaShop\PSTAF\TestCase\OnDemandTestCase
{
	public function getSecretsName()
	{
		// Share the secrets
		return 'EndToEndTest';
	}

	public function languageAndCountryPairs()
	{
		return [
			['en', 'United States'],
			['fr', 'France'],
			['es', 'Spain'],
			['it', 'Italy'],
			['nl', 'Netherlands'],
			['pt', 'Brazil']
		];
	}

	/**
	 * @parallelize
	 * @dataProvider languageAndCountryPairs
	 */
	public function testSubdomainsCanBeBought($language, $country)
	{
		self::setValue('language', $language);
		self::setValue('country', $country);

		$accountCreation = new AccountCreation($this->homePage);

		$uid = md5(microtime().getmypid());

		$secrets = $this->getSecrets();

		$email =  implode("+$uid@", explode('@', $secrets['customer']['email']));

		$data = $accountCreation->createAccountAndShop([
			'email' 	=> $email,
			'password'	=> $<PASSWORD>['<PASSWORD>']['password'],
			'shop_name' => $uid,
			'language'	=> $language,
			'country'	=> $country,
			'waitForSubdomain' => false
		]);

		$myStoresPage = $data['myStoresPage'];

		/*$myStoresPage = $this->homePage->visit()->login(
			'<EMAIL>',
			'123456789'
		);*/

		$domains = $myStoresPage->gotoDomains();


		$spinner = new Spinner('Could not find an available domain to order.', 60, 1000);
		$spinner->assertBecomesTrue(function () use ($domains) {
			return $domains->checkIfDomainIsAvailable(md5(microtime()).'.com');
		});

		$addressForm = $domains->orderDomain();

		$addressForm
		->setAddress('55, Main Street')
		->setPostCode($this->extraLocalizationData('addressData.postCode', '12345'))
		->setCity('Nöwhär')
		->setCountryId($this->extraLocalizationData('addressData.countryId', '1'));

		if (($stateId = $this->extraLocalizationData('addressData.stateId'))) {
			sleep(5);
			$addressForm->setStateId($stateId);
		}

		$addressForm
		->setPhone('0658795126')
		->setAlias('Yiha My Address');

		$addressForm->save();


		$this->browser->click('a.be2bill_link')->clickFirstVisible('[name="submitBe2billForm"]');

		try {
			$this->browser->ensureElementShowsUpOnPage('#be2bill_iframe');
			$this->browser->switchToIFrame('be2bill_iframe');
			$this->browser->ensureElementShowsUpOnPage('#b2b-submit');
		} catch (\Exception $e) {
			throw new \Exception('It seems the be2bill iframe did not show up.');
		}
	}

	public function testSubdomainsCanBeBound()
	{
		$domainsPage = $this->homePage->visit()->gotoMyStores()->gotoDomains();

		$domain = md5(microtime()) . $this->getSecrets()['subdomain'];

		$domainsPage->bindDomain($domain);

		$settingsPage = $this->homePage->visit()->gotoMyStores()->gotoSettings();

		$spinner = new Spinner('Domain `' . $domain . '` wasn\'t bound in 30 minutes.', 1800, 1000);

		$spinner->assertBecomesTrue(function () use ($settingsPage, $domain) {
			$this->getBrowser()->reload();
			return $settingsPage->isDomainActive($domain);
		});
	}
}

{'fraction_non_alphanumeric': 0.19311727363848982, 'fraction_numerical': 0.01670564650851988, 'mean_word_length': 5.0535894843276035, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 106, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '6622149', 'n_tokens_mistral': 2346, 'n_tokens_neox': 2000, 'n_words': 322}