Skip to content

Commit

Permalink
adjust vehat tests to testing samecostcenter=1
Browse files Browse the repository at this point in the history
  • Loading branch information
semteacher committed Nov 6, 2024
1 parent 50f932b commit 4ad65b4
Showing 1 changed file with 24 additions and 20 deletions.
44 changes: 24 additions & 20 deletions tests/behat/shopping_cart_costcenter_credit_manager.feature
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ Feature: Cashier manage credits with costcenters enabled in shopping cart
Given the following config values are set as admin:
| config | value | plugin |
| samecostcenterforcredits | 1 | local_shopping_cart |
| samecostcenter | 1 | local_shopping_cart |
| defaultcostcenterforcredits | CostCenter1 | local_shopping_cart |
And the following "local_shopping_cart > user credits" exist:
| user | credit | currency | costcenter |
Expand Down Expand Up @@ -114,6 +115,7 @@ Feature: Cashier manage credits with costcenters enabled in shopping cart
Given the following config values are set as admin:
| config | value | plugin |
| samecostcenterforcredits | 1 | local_shopping_cart |
| samecostcenter | 1 | local_shopping_cart |
| defaultcostcenterforcredits | CostCenter1 | local_shopping_cart |
And the following "local_shopping_cart > user credits" exist:
| user | credit | currency | costcenter |
Expand Down Expand Up @@ -197,26 +199,27 @@ Feature: Cashier manage credits with costcenters enabled in shopping cart
Given the following config values are set as admin:
| config | value | plugin |
| samecostcenterforcredits | 1 | local_shopping_cart |
| samecostcenter | 1 | local_shopping_cart |
| defaultcostcenterforcredits | CostCenter1 | local_shopping_cart |
And the following "local_shopping_cart > user credits" exist:
| user | credit | currency | costcenter |
| user1 | 31 | EUR | CostCenter1 |
| user1 | 41 | EUR | CostCenter2 |
| user1 | 51 | EUR | |
##| user1 | 51 | EUR | |
And I log in as "user1"
And Shopping cart has been cleaned for user "user1"
And Testitem "6" has been put in shopping cart of user "user1"
And Testitem "4" has been put in shopping cart of user "user1"
And Testitem "7" has been put in shopping cart of user "user1"
And Testitem "8" has been put in shopping cart of user "user1"
And I visit "/local/shopping_cart/checkout.php"
And I wait until the page is ready
And I should see "Your shopping cart"
And I should see "(CostCenter1)" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-6" "css_element"
And I should see "10.00 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-6 .item-price" "css_element"
And I should see "(CostCenter2)" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-7" "css_element"
And I should see "20.30 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-7 .item-price" "css_element"
And I should see "(CostCenter3)" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-8" "css_element"
And I should see "13.80 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-8 .item-price" "css_element"
And I should see "dummy item description" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-4" "css_element"
And I should see "10.00 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-4 .item-price" "css_element"
And I should see "(CostCenter2)" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-7" "css_element"
And I should see "20.30 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-7 .item-price" "css_element"
And I should see "(CostCenter3)" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-8" "css_element"
And I should see "13.80 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-8 .item-price" "css_element"
## Price
And I should see "44.10 EUR" in the ".sc_price_label .sc_initialtotal" "css_element"
## Used credit - should be all from unnamed costcenter!
Expand Down Expand Up @@ -252,38 +255,39 @@ Feature: Cashier manage credits with costcenters enabled in shopping cart
Given the following config values are set as admin:
| config | value | plugin |
| samecostcenterforcredits | 1 | local_shopping_cart |
| samecostcenter | 1 | local_shopping_cart |
| defaultcostcenterforcredits | CostCenter1 | local_shopping_cart |
And the following "local_shopping_cart > user credits" exist:
| user | credit | currency | costcenter |
| user1 | 32 | EUR | CostCenter1 |
| user1 | 42 | EUR | CostCenter2 |
And I log in as "user1"
And Shopping cart has been cleaned for user "user1"
And Testitem "6" has been put in shopping cart of user "user1"
And Testitem "7" has been put in shopping cart of user "user1"
And Testitem "8" has been put in shopping cart of user "user1"
And I visit "/local/shopping_cart/checkout.php"
And I wait until the page is ready
And I should see "Your shopping cart"
And I should see "(CostCenter1)" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-6" "css_element"
And I should see "10.00 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-6 .item-price" "css_element"
And I should see "(CostCenter2)" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-7" "css_element"
And I should see "20.30 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-main-7 .item-price" "css_element"
And I should see "(CostCenter2)" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-7" "css_element"
And I should see "20.30 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-7 .item-price" "css_element"
And I should see "(CostCenter2)" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-8" "css_element"
And I should see "13.80 EUR" in the ".checkoutgrid.checkout #item-local_shopping_cart-option-8 .item-price" "css_element"
## Price
And I should see "30.30 EUR" in the ".sc_price_label .sc_initialtotal" "css_element"
And I should see "34.10 EUR" in the ".sc_price_label .sc_initialtotal" "css_element"
## Used credit - should be all from unnamed costcenter!
And I should see "Use credit: 74.00 EUR" in the ".sc_price_label .sc_credit" "css_element"
And I should see "Use credit: 42.00 EUR" in the ".sc_price_label .sc_credit" "css_element"
## Deductible
And I should see "30.30 EUR" in the ".sc_price_label .sc_deductible" "css_element"
And I should see "34.10 EUR" in the ".sc_price_label .sc_deductible" "css_element"
## Remaining credit
And I should see "43.70 EUR" in the ".sc_price_label .sc_remainingcredit" "css_element"
And I should see "7.90 EUR" in the ".sc_price_label .sc_remainingcredit" "css_element"
And I should see "0 EUR" in the ".sc_totalprice" "css_element"
When I press "Checkout"
And I wait "1" seconds
And I press "Confirm"
And I wait until the page is ready
Then I should see "Payment successful!"
And I should see "Test item 6" in the ".payment-success ul.list-group" "css_element"
And I should see "Test item 7" in the ".payment-success ul.list-group" "css_element"
And I should see "Test item 8" in the ".payment-success ul.list-group" "css_element"
## Verify by admin
And I log out
And I log in as "admin"
Expand All @@ -292,7 +296,7 @@ Feature: Cashier manage credits with costcenters enabled in shopping cart
And I should see "Username1 Test"
And I click on "Continue" "button"
And I wait until the page is ready
And I should see "22.00" in the ".cashier-history-items [data-costcenter=\"CostCenter1\"] .credit_total" "css_element"
And I should see "21.70" in the ".cashier-history-items [data-costcenter=\"CostCenter2\"] .credit_total" "css_element"
And I should see "32.00" in the ".cashier-history-items [data-costcenter=\"CostCenter1\"] .credit_total" "css_element"
And I should see "7.90" in the ".cashier-history-items [data-costcenter=\"CostCenter2\"] .credit_total" "css_element"
And "cashier-history-items [data-costcenter=\"No costcenter\"]" "css_element" should not exist
And I log out

0 comments on commit 4ad65b4

Please sign in to comment.