Skip to content
This repository has been archived by the owner on May 30, 2019. It is now read-only.

Commit

Permalink
Added Stripe full Behat Feature
Browse files Browse the repository at this point in the history
* Checks all importants price-related steps
* Also moved some common translations inside `common.*` namespace
* Placed such translations inside BambooBundle
  • Loading branch information
mmoreram committed Jun 8, 2015
1 parent 28c2c1e commit 8e55243
Show file tree
Hide file tree
Showing 21 changed files with 108 additions and 64 deletions.
2 changes: 1 addition & 1 deletion features/admin/login.feature
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ Feature: Admin login
Scenario: Logged user is redirected to home when goes to login page
Given In admin, I am logged as "[email protected]" - "1234"
When I go to "/admin/login"
Then I should be on "admin/plugin/setup-wizard/store-setup-wizard"
Then I should be on "admin/store-setup-wizard"
1 change: 0 additions & 1 deletion features/store/product.feature
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ Feature: Store product
Then I should see product 1 name
And the response should contain a "add-product-2-to-cart" test attribute

@now
Scenario: Product redirection
Given I am on "product/ibiza-lips-en-false/1"
Then I should be on "product/ibiza-lips-en/1"
49 changes: 39 additions & 10 deletions features/workflow/payment.feature
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,54 @@ Feature: Test payment
As a logged user
I need to be able to buy products using coupons and check created order

@javascript
@javascript @stripe
Scenario: Payment workflow with stripe
Given In admin, I am logged as "[email protected]" - "1234"
When I go to "/admin/plugins"
When I go to "/admin/payment"
And I uncheck "enable-plugin-887ee51dc5572759c418db09b66988664f0ecbc1"
And I am logged as "[email protected]" - "1234"
And I go to "/cart/product/2/add"
And I follow "Checkout"
And I press "Payment"
And I should not see "Card number"
And I go to "/admin/payment"
And I check "enable-plugin-887ee51dc5572759c418db09b66988664f0ecbc1"
And I go to "/admin/plugin/887ee51dc5572759c418db09b66988664f0ecbc1"
And I fill in the following:
| elcodi_form_type_plugin_private_key | sk_test_WccEP1bzQJRowjtsx2R65hr3 |
And I press "elcodi_form_type_plugin_save"
And I go to "/cart/payment"
And I should not see "Card number"
And I go to "/admin/payment"
And I check "enable-plugin-887ee51dc5572759c418db09b66988664f0ecbc1"
And I follow "/admin/plugin/887ee51dc5572759c418db09b66988664f0ecbc1"
And I go to "/admin/plugin/887ee51dc5572759c418db09b66988664f0ecbc1"
And I fill in the following:
| elcodi_form_type_plugin_private_key | sk_test_WccEP1bzQJRowjtsx2R65hr3 |
| elcodi_form_type_plugin_public_key | pk_test_6937Di9YMLplqWr6HaQIGdLI |
And I press "elcodi_form_type_plugin_save"
And I am logged as "[email protected]" - "1234"
And I go to "/cart/product/2/add"
And I follow "Checkout"
And I follow "Payment"
And I follow "test-payment-887ee51dc5572759c418db09b66988664f0ecbc1"
And I go to "/cart/payment"
And I should see "Card number"
And I fill in the following:
| stripe_view_credit_cart | 4242424242424242 |
| stripe_view_credit_cart_security | 123 |
| stripe_view_credit_cart_expiration_month | 19 |
| stripe_view_credit_cart_expiration_month | 12 |
| stripe_view_credit_cart_expiration_year | 2020 |
And I press "payment-submit"
Then I should be on "/order/2/thanks"
And I should be on "/order/1/thanks"
And I should see "$5.41"
And I should see "$12.21"
And I should see "$17.62"
And I go to "/my-orders"
And I should see "Paid"
And I should see "Not shipped"
And I go to "/admin/orders"
And the page contains a "order-1" test attribute
And I should see "$17.62"
And I should see "Paid"
And I should see "Not shipped"
And I go to "/admin/order/1"
And I should see "$5.41"
And I should see "$12.21"
And I should see "$17.62"
And I should see "Paid"
And I should see "Not shipped"
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@
<td class="w-70">
<i class="icon-shopping-cart bg-ok mr-s"></i>
<em></em>
{{ 'admin.order.states.initial'|trans }}
{{ 'common.order.states.initial'|trans }}
</td>
<td class="ta-r">
{% include 'AdminCartBundle:Order:date.html.twig' with {
Expand All @@ -96,7 +96,7 @@
<td>
<i class="{{ iconClass }} {{ colorClass }} mr-s"></i>
<em></em>
{{ "admin.order.states.#{stateLine.name}"|trans }}
{{ "common.order.states.#{stateLine.name}"|trans }}
</td>
<td class="ta-r">
{% include 'AdminCartBundle:Order:date.html.twig' with {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
{% block table_body_row %}

<td>
<a href="{{ url('admin_order_edit', { id: entity.id }) }}">
<a href="{{ url('admin_order_edit', { id: entity.id }) }}" data-test="order-{{ entity.id }}">
{{ 'admin.order.field.id'|trans({ '%id%': entity.id }) }}
</a>
</td>
Expand All @@ -50,10 +50,10 @@
</td>
<td>
<span class="label label-warning">
{{ "admin.order.states.#{entity.paymentStateLineStack.lastStateLine.name}"|trans }}
{{ "common.order.states.#{entity.paymentStateLineStack.lastStateLine.name}"|trans }}
</span>
<span class="label label-info">
{{ "admin.order.states.#{entity.shippingStateLineStack.lastStateLine.name}"|trans }}
{{ "common.order.states.#{entity.shippingStateLineStack.lastStateLine.name}"|trans }}
</span>
</td>
<td>
Expand Down
2 changes: 1 addition & 1 deletion src/Elcodi/Admin/CoreBundle/Behat/Context.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function inAdminIAmLoggedAs($username, $password)
$page = $this
->getSession()
->getPage();
echo $page->getContent();die();

$page->fillField('elcodi_admin_user_form_type_login_email', $username);
$page->fillField('elcodi_admin_user_form_type_login_password', $password);
$page->pressButton('submit-login');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,6 @@ admin:
subtotal: Subtotal
discount: Cupó de descompte
shipping: Entrega
states:
title: Historial
initial: Comanda nova
unpaid: Sense pagar
refunded: Reemborsat
shipped: Enviat
not shipped: Sense enviar
paid: Pagat
transition:
refund: Reemborsar
ship: Enviar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -479,14 +479,6 @@ admin:
subtotal: Zwischensumme
discount: Gutschein-Rabatt
shipping: Versand
states:
title: Verlauf
initial: Neue Bestellung
unpaid: Unbezahlt
refunded: Zurückerstattet
shipped: Versendet
not shipped: Nicht versendet
paid: Bezahlt
transition:
refund: Rückerstattung
ship: Versenden
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,6 @@ admin:
subtotal: Subtotal
discount: Coupon Discount
shipping: Shipping
states:
title: History
initial: New order
unpaid: Unpaid
refunded: Refunded
shipped: Shipped
not shipped: Not shipped
paid: Paid
transition:
refund: Refund
ship: Ship
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -498,14 +498,6 @@ admin:
subtotal: Subtotal
discount: Cupón de descuento
shipping: Entrega
states:
title: Historial
initial: Nuevo pedido
unpaid: Sin pagar
refunded: Reembolsado
shipped: Enviado
not shipped: Sin enviar
paid: Pagado
transition:
refund: Reembolsar
ship: Enviar
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -461,14 +461,6 @@ admin:
subtotal: Sous-total
discount: Réduction (coupon)
shipping: Livraison
states:
title: Historique
initial: Nouvelle commande
unpaid: Non payée
refunded: Remboursée
shipped: Livrée
not shipped: Non livrée
paid: Payée
transition:
refund: Remboursement
ship: Livraison
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
common:
order:
states:
title: Historial
initial: Comanda nova
unpaid: Sense pagar
refunded: Reemborsat
shipped: Enviat
not shipped: Sense enviar
paid: Pagat
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
common:
order:
states:
title: Verlauf
initial: Neue Bestellung
unpaid: Unbezahlt
refunded: Zurückerstattet
shipped: Versendet
not shipped: Nicht versendet
paid: Bezahlt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
common:
order:
states:
title: History
initial: New order
unpaid: Unpaid
refunded: Refunded
shipped: Shipped
not shipped: Not shipped
paid: Paid
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
common:
order:
states:
title: Historial
initial: Nuevo pedido
unpaid: Sin pagar
refunded: Reembolsado
shipped: Enviado
not shipped: Sin enviar
paid: Pagado
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
common:
order:
states:
title: Historique
initial: Nouvelle commande
unpaid: Non payée
refunded: Remboursée
shipped: Livrée
not shipped: Non livrée
paid: Payée
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ template:
image: Imatge
number_of_order: Nº de Comanda
order_number: "Comanda #"
state: Comunitat autònoma
payment_state: Estat de pagament
shipping_state: Estat d'enviament
date: Data
total: Total
no_orders: Encara no tens cap comanda
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ template:
image: Image
number_of_order: Number of order
order_number: "Order #"
state: State
payment_state: Payment state
shipping_state: Shipping state
date: Date
total: Total
no_orders: There are no orders
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ template:
image: Imagen
number_of_order: Nº de Pedido
order_number: "Pedido #"
state: Comunidad autónoma
payment_state: Estado de pago
shipping_state: Estado de envío
date: Fecha
total: Total
no_orders: Aún no tienes ningún pedido
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ template:
image: Image
number_of_order: Numéro de commande
order_number: "Commande #"
state: Etat
payment_state: Statut de payement
shipping_state: Statut de livraison
date: Date
total: Total
no_orders: Il n'y a aucune commande
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,10 @@
<dd class="order-item-id">
<a href="{{ url('store_order_view', { id: order.id }) }}" class="order-title">{{ 'template.store_template_bundle.order.list.order_number'|trans }}{{ order.id }}</a>
</dd>
<dt class="order-item-state">{{ 'template.store_template_bundle.order.list.state'|trans }}</dt>
<dd class="order-item-state">{{ order.paymentLastStateLine.name }}</dd>
<dt class="order-item-payment-status">{{ 'template.store_template_bundle.order.list.payment_state'|trans }}</dt>
<dd class="order-item-payment-status">{{ "common.order.states.#{order.paymentStateLineStack.lastStateLine.name}"|trans }}</dd>
<dt class="order-item-shipping-status">{{ 'template.store_template_bundle.order.list.shipping_state'|trans }}</dt>
<dd class="order-item-shipping-status">{{ "common.order.states.#{order.shippingStateLineStack.lastStateLine.name}"|trans }}</dd>
<dt class="order-item-date">{{ 'template.store_template_bundle.order.list.date'|trans }}</dt>
<dd class="order-item-date">{{ order.createdAt|date('d.m.Y') }}</dd>
<dt class="order-item-total">{{ 'template.store_template_bundle.order.list.total'|trans }}</dt>
Expand Down

0 comments on commit 8e55243

Please sign in to comment.