/**
  * @maxattempts 1
  * @dataProvider languageAndCountryPairs
  * @parallelize
  */
 public function testFullProcess($language, $country)
 {
     self::setValue('language', $language);
     self::setValue('country', $country);
     $this->browser->clearCookies();
     $this->homePage->getBrowser()->clearCookies();
     $accountCreation = new AccountCreation($this->homePage);
     $secrets = $this->getSecrets();
     $uid = HumanHash::humanMd5(self::newUid() . $language . $country);
     $this->writeMetaData('uid', $uid);
     self::setValue('uid', $uid);
     $email = implode("+{$uid}@", explode('@', $secrets['customer']['email']));
     $shop_name = $uid;
     $this->writeMetaData('email', $email);
     $this->writeMetaData('password', $secrets['customer']['password']);
     $data = $accountCreation->createAccountAndShop(['email' => $email, 'password' => $secrets['customer']['password'], 'shop_name' => $shop_name, 'country' => $country, 'language' => $language]);
     $this->shop = $data['shop'];
     self::setShop($this->shop);
     $this->writeMetaData('backOfficeURL', $this->shop->getBackOfficeURL());
     $this->shop->getBackOfficeNavigator()->login();
     if (!empty($secrets['smtp'])) {
         $smtp = $secrets['smtp'];
         $this->shop->getPageObject('AdminStores')->visit()->setShopEmail($smtp['sender']);
         $this->shop->getPageObject('AdminEmails')->visit()->setSMTP($smtp);
     }
     $loc = $this->shop->getPageObject('AdminLocalization')->visit();
     $actualLanguage = $loc->getDefaultLanguageName();
     $actualCountry = $loc->getDefaultCountryName();
     // Check that the shop is setup with the same country as defined during onboarding
     $expectedCountry = $this->extraLocalizationData('AdminLocalizationExpectedCountry');
     $this->assertEquals($expectedCountry, $actualCountry, "Shop doesn't have the expected default country, expected `{$expectedCountry}` but got `{$actualCountry}`.");
     $expectedLanguage = $this->extraLocalizationData('AdminLocalizationExpectedLanguage');
     $this->assertEquals($expectedLanguage, $actualLanguage, "Shop doesn't have the expected default language, expected `{$expectedLanguage}` but got `{$actualLanguage}`.");
     $this->customersCanRegister();
     $this->emailsAreSent();
     $this->basicSellingFeatures();
 }
 /**
  * @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(
     			'*****@*****.**',
     			'123456789'
     		);*/
     $storeDetailsPage = $myStoresPage->gotoDetails();
     $spinner = new Spinner('Could not find an available domain to order.', 60, 1000);
     $spinner->assertBecomesTrue(function () use($storeDetailsPage) {
         return $storeDetailsPage->checkIfDomainIsAvailable(md5(microtime()) . '.com');
     });
     $addressForm = $storeDetailsPage->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.');
     }
 }
 /**
  * @depends testSubdomains2and3AreUnassignedFromShopA
  */
 public function testCreateShopB()
 {
     $uidB = self::newUID();
     self::setValue('uidB', $uidB);
     $accountCreation = new AccountCreation($this->homePage);
     $secrets = $this->getSecrets();
     $email = implode("+{$uidB}@", explode('@', $secrets['customer']['email']));
     self::setValue('emailB', $email);
     $accountCreation->createAccountAndShop(['password' => $this->getSecrets()['customer']['password'], 'shop_name' => $uidB, 'language' => 'en', 'country' => 'United States', 'email' => $email, 'waitForSubdomain' => false], true);
 }