[Shop][Account] Enable behat tests

This commit is contained in:
Wojdylak 2024-09-05 14:13:00 +02:00 committed by Grzegorz Sadowski
parent 5ac9f0a511
commit 47e75d1f37
17 changed files with 33 additions and 36 deletions

View file

@ -12,27 +12,27 @@ Feature: Being unable to see non-own orders and associated resources
And I am a logged in customer
And there is a customer "john@example.com" that placed order with "PHP T-Shirt" product to "United States" based billing address with "Free" shipping method and "Cash on Delivery" payment method
@todo @api
@api @no-ui
Scenario: Being unable to see non-own order
When I try to see the order placed by a customer "john@example.com"
Then I should not be able to see that order
@todo @api
@api @no-ui
Scenario: Being unable to see non-own order item
When I try to see one of the items from the order placed by a customer "john@example.com"
Then I should not be able to see that item
@todo @api
@api @no-ui
Scenario: Being unable to see non-own order item unit
When I try to see one of the units from the order placed by a customer "john@example.com"
Then I should not be able to see that unit
@todo @api
@api @no-ui
Scenario: Being unable to see non-own shipment
When I try to see the shipment of the order placed by a customer "john@example.com"
Then I should not be able to see that shipment
@todo @api
@api @no-ui
Scenario: Being unable to see non-own payment
When I try to see the payment of the order placed by a customer "john@example.com"
Then I should not be able to see that payment

View file

@ -16,13 +16,13 @@ Feature: Changing a payment method of a placed order
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Changing a payment method of an order
When I browse my orders
And I change my payment method to "Bank Transfer"
Then I should have "Bank Transfer" payment method on my order
@todo @ui @api
@api @ui
Scenario: Changing a payment method of an order with a disabled payment method
Given the payment method "Cash on Delivery" is disabled
When I browse my orders

View file

@ -15,7 +15,7 @@ Feature: Order is always placed in a base currency of a channel
And the store has a product "Angel T-Shirt" priced at "$20.00"
And I am a logged in customer
@todo @ui @no-api
@no-api @ui @javascript
Scenario: Placing an order with other than base display currency
Given I changed my currency to "GBP"
And I had product "Angel T-Shirt" in the cart

View file

@ -13,7 +13,7 @@ Feature: Seeing customer's orders placed as guest
And the guest customer placed order with "PHP T-Shirt" product for "john@snow.com" and "United States" based billing address with "Free" shipping method and "Offline" payment
And the another guest customer placed order with "PHP T-Shirt" product for "ned@stark.com" and "United States" based billing address with "Free" shipping method and "Offline" payment
@todo @ui @api
@api @ui
Scenario: Not being able to hijack another customer's orders
Given I registered with previously used "ned@stark.com" email and "lannistersAreDumb" password
When I log in as "ned@stark.com" with "lannistersAreDumb" password

View file

@ -19,7 +19,7 @@ Feature: Seeing province created manually in order history
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Peterborough", "United Kingdom", "East of England"
And I chose "DHL" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Seeing a province manually defined in a order history
When I view the summary of my order "#00000666"
Then I should see "East of England" as province in the shipping address

View file

@ -17,7 +17,7 @@ Feature: Viewing payment's amount on my account panel
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "DHL" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Seeing total payment
When I view the summary of my order "#00000666"
Then I should see "$66.60" as order's total

View file

@ -14,7 +14,7 @@ Feature: Viewing orders on my account page
And the customer "Oliver Queen" addressed it to "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And the customer chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Viewing orders
Given I am a logged in customer
And I placed an order "#00000666"
@ -25,7 +25,7 @@ Feature: Viewing orders on my account page
Then I should see a single order in the list
And this order should have "#00000666" number
@todo @api
@api @ui
Scenario: Viewing orders
When I browse my orders
Then I should be denied an access to order list

View file

@ -16,7 +16,7 @@ Feature: Viewing details of an order
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Viewing basic information about an order
When I view the summary of my order "#00000666"
Then it should have the number "#00000666"

View file

@ -16,7 +16,7 @@ Feature: Viewing details of an order
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Viewing basic information about an order
When I view the summary of my order "#00000666"
Then it should have the number "#00000666"

View file

@ -16,7 +16,7 @@ Feature: Viewing order items with proper names
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Viewing basic information about an order
Given the product "Angel T-Shirt" was renamed to "Devil Cardigan"
And the product "Angel Mug" was renamed to "Devil Glass"

View file

@ -27,7 +27,7 @@ Feature: Viewing orders only from current channel
And the customer chose "Free" shipping method with "Offline" payment
And I am logged in as "hancock@superheronope.com"
@todo @ui @api
@api @ui
Scenario: Viewing orders only from current channel
When I change my current channel to "Web-US"
And I browse my orders

View file

@ -15,7 +15,7 @@ Feature: Viewing only my orders on my account page
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Viewing orders
When I browse my orders
Then I should see a single order in the list

View file

@ -16,23 +16,23 @@ Feature: Viewing payment status on the order show page
And I addressed it to "Lucifer Morningstar", "Seaside Fwy", "90802" "Los Angeles" in the "United States" with identical billing address
And I chose "DHL" shipping method with "Cash on Delivery" payment
@todo @ui @api
@ui
Scenario: Seeing payment status before it's paid
When I view the summary of my order "#00000666"
Then I should see its payment status as "New"
@todo @ui @api
@ui
Scenario: Seeing payment status after it's paid
Given the order "#00000666" is already paid
When I view the summary of my order "#00000666"
And I should see its payment status as "Completed"
@todo @ui @api
@ui
Scenario: Seeing order's payment status before paying all payments
When I view the summary of my order "#00000666"
Then I should see its order's payment status as "Awaiting payment"
@todo @ui @api
@ui
Scenario: Seeing order's payment status after paying all payments
Given the order "#00000666" is already paid
When I view the summary of my order "#00000666"

View file

@ -17,23 +17,23 @@ Feature: Viewing shipment status on a placed order show page
And for the billing address of "Mazikeen Lilim" in the "Pacific Coast Hwy", "90806" "Los Angeles", "United States"
And I chose "Free" shipping method with "Cash on Delivery" payment
@todo @ui @api
@api @ui
Scenario: Seeing shipment status when it has not been shipped yet
When I view the summary of my order "#00000666"
Then the shipment status should be "Ready"
@todo @ui @api
@api @ui
Scenario: Seeing shipment status after shipping
Given this order has already been shipped
When I view the summary of my order "#00000666"
Then the shipment status should be "Shipped"
@todo @ui @api
@api @ui
Scenario: Seeing order's shipment status when it has not been shipped yet
When I view the summary of my order "#00000666"
Then the order's shipment status should be "Ready"
@todo @ui @api
@api @ui
Scenario: Seeing order's shipment status after shipping
Given this order has already been shipped
When I view the summary of my order "#00000666"

View file

@ -432,7 +432,6 @@ final readonly class AccountContext implements Context
$this->orderIndexPage->open();
$this->orderIndexPage->changePaymentMethod($order);
$this->orderShowPage->choosePaymentMethod($paymentMethod);
Assert::same($this->orderShowPage->getChosenPaymentMethod(), $paymentMethod->getName());
}
@ -570,6 +569,7 @@ final readonly class AccountContext implements Context
/**
* @Then I should be on the login page
* @Then I should be denied an access to order list
*/
public function iShouldBeOnTheLoginPage(): void
{

View file

@ -47,7 +47,7 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
['number' => $order->getNumber()],
);
$link = $row->find('css', '[data-test-button="sylius.ui.pay"]');
$link = $row->find('css', '[data-test-button="sylius-pay"]');
$link->click();
}
@ -72,7 +72,7 @@ class IndexPage extends SymfonyPage implements IndexPageInterface
public function openLastOrderPage(): void
{
$this->getElement('last_order')->find('css', '[data-test-button="sylius.ui.show"]')->click();
$this->getElement('last_order')->find('css', '[data-test-button="sylius-show"]')->click();
}
protected function getDefinedElements(): array

View file

@ -84,7 +84,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
foreach ($paymentMethodItems as $method) {
if ($method->find('css', '[data-test-payment-method-select]')->hasAttribute('checked')) {
return $method->find('css', 'a')->getText();
return $method->find('css', '[data-test-payment-method-checkbox]')->getText();
}
}
@ -93,16 +93,12 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
public function getTotal(): string
{
$totalElement = $this->getElement('total');
return trim(str_replace('Total:', '', $totalElement->getText()));
return $this->getElement('total')->getText();
}
public function getSubtotal(): string
{
$totalElement = $this->getElement('subtotal');
return trim(str_replace('Items total:', '', $totalElement->getText()));
return $this->getElement('subtotal')->getText();
}
public function getOrderShipmentStatus(): string
@ -163,6 +159,7 @@ class ShowPage extends SymfonyPage implements ShowPageInterface
{
return array_merge(parent::getDefinedElements(), [
'billing_address' => '[data-test-billing-address]',
'checked_payment_method' => '[data-test-payment-item] div.form-check:has(input:checked)',
'number' => '[data-test-order-number]',
'order_items' => '[data-test-order-table]',
'order_payment_state' => '[data-test-order-payment-state]',