/**
  * Run create customer segment test.
  *
  * @param Customer $customer
  * @param CustomerSegment $customerSegment
  * @param CustomerSegment $customerSegmentConditions
  * @param array $salesRule
  * @param Browser $browser
  * @return void
  */
 public function test(Customer $customer, CustomerSegment $customerSegment, CustomerSegment $customerSegmentConditions, array $salesRule, Browser $browser)
 {
     // Preconditions
     $customer->persist();
     $replacement = $this->prepareReplacement($customer);
     // Steps
     $this->customerSegmentIndex->open();
     $this->customerSegmentIndex->getPageActionsBlock()->addNew();
     $this->customerSegmentNew->getCustomerSegmentForm()->fill($customerSegment);
     $this->customerSegmentNew->getPageMainActions()->saveAndContinue();
     // Retrieve customer segment id
     preg_match('@id/(\\d+)/@', $browser->getUrl(), $matches);
     $customerSegmentId = $matches[1];
     $this->customerSegmentEdit->getCustomerSegmentForm()->openTab('conditions');
     $this->customerSegmentEdit->getCustomerSegmentForm()->fillForm($customerSegmentConditions, null, $replacement);
     $this->customerSegmentEdit->getPageMainActions()->save();
     $this->createCartPriceRule($salesRule, $customerSegmentId);
 }