Skip to content

Commit

Permalink
Merge pull request #5601 from pamil/context/locale-selector
Browse files Browse the repository at this point in the history
Make locales switchable by user & dependent on current channel
  • Loading branch information
Paweł Jędrzejewski committed Jul 28, 2016
2 parents f3cf074 + 70c2802 commit ead0263
Show file tree
Hide file tree
Showing 84 changed files with 1,645 additions and 872 deletions.
3 changes: 3 additions & 0 deletions features/channel/managing_channels/adding_channel.feature
Expand Up @@ -6,6 +6,7 @@ Feature: Adding a new channel

Background:
Given the store has currency "Euro"
And the store has locale "English (United States)"
And I am logged in as an administrator

@ui
Expand All @@ -14,6 +15,7 @@ Feature: Adding a new channel
When I specify its code as "MOBILE"
And I name it "Mobile channel"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the channel "Mobile channel" should appear in the registry
Expand All @@ -27,6 +29,7 @@ Feature: Adding a new channel
And I set its hostname as "m.avengers-gear.com"
And I define its color as "blue"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the channel "Mobile channel" should appear in the registry
Expand Up @@ -5,15 +5,17 @@ Feature: Not being able to add a disabled channel when no other exist
I want to be prevented from adding disabled channel when no other exist

Background:
Given I am logged in as an administrator
And the store has currency "Euro"
Given the store has currency "Euro"
And the store has locale "English (United States)"
And I am logged in as an administrator

@ui
Scenario: Adding a new disabled channel should result
Given I want to create a new channel
When I specify its code as "MOBILE"
And I name it "Mobile channel"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I disable it
And I add it
Then I should be notified that at least one channel has to be defined
Expand Down
Expand Up @@ -5,15 +5,17 @@ Feature: Selecting available currencies for a channel
I want to be able to select available currencies

Background:
Given the store has currency Euro
Given the store has currency "Euro"
And the store has locale "English (United States)"
And I am logged in as an administrator

@ui
Scenario: Adding a new channel with currencies
Given I want to create a new channel
When I specify its code as MOBILE
And I name it "Mobile store"
And I allow for paying in Euro
And I allow for paying in "Euro"
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And paying in Euro should be possible for the "Mobile store" channel
Expand All @@ -22,7 +24,8 @@ Feature: Selecting available currencies for a channel
Scenario: Adding currencies to an existing channel
Given the store operates on a channel named "Web store"
And I want to modify this channel
When I allow for paying in Euro
When I allow for paying in "Euro"
And I choose "English (United States)" as a default locale
And I save my changes
Then I should be notified that it has been successfully edited
And paying in Euro should be possible for the "Web store" channel
Expand Up @@ -5,9 +5,10 @@ Feature: Selecting default tax zone for a channel
I want to be able to select default tax zone

Background:
Given there is a zone "EU" containing all members of the European Union
Given the store has currency "Euro"
And the store has locale "English (United States)"
And there is a zone "EU" containing all members of the European Union
And there is a zone "The Rest of the World" containing all other countries
And the store has currency "Euro"
And I am logged in as an administrator

@ui
Expand All @@ -17,6 +18,7 @@ Feature: Selecting default tax zone for a channel
And I name it "Mobile store"
And I select the "European Union" as default tax zone
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the default tax zone for the "Mobile store" channel should be "European Union"
Expand Down
Expand Up @@ -5,26 +5,27 @@ Feature: Selecting available locales for a channel
I want to be able to select available locales

Background:
Given the store has locale "Norwegian (Norway)"
And the store has currency "Euro"
Given the store has currency "Euro"
And the store has locale "English (United States)"
And I am logged in as an administrator

@ui
Scenario: Adding a new channel with locales
Given I want to create a new channel
When I specify its code as "MOBILE"
And I name it "Mobile channel"
And I make it available in "Norwegian (Norway)"
And I make it available in "English (United States)"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the channel "Mobile channel" should be available in "Norwegian (Norway)"
And the channel "Mobile channel" should be available in "English (United States)"

@ui
Scenario: Adding locales to an existing channel
Given the store operates on a channel named "Web Channel"
And I want to modify this channel
When I make it available in "Norwegian (Norway)"
When I make it available in "English (United States)"
And I save my changes
Then I should be notified that it has been successfully edited
And the channel "Web channel" should be available in "Norwegian (Norway)"
And the channel "Web channel" should be available in "English (United States)"
Expand Up @@ -5,8 +5,9 @@ Feature: Selecting available payment methods for a channel
I want to be able to select available payment methods

Background:
Given the store has a payment method "Offline" with a code "OFF"
And the store has currency "Euro"
Given the store has currency "Euro"
And the store has locale "English (United States)"
And the store has a payment method "Offline" with a code "OFF"
And I am logged in as an administrator

@ui
Expand All @@ -16,6 +17,7 @@ Feature: Selecting available payment methods for a channel
And I name it "Mobile store"
And I select the "Offline" payment method
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the "Offline" payment method should be available for the "Mobile store" channel
Expand Down
Expand Up @@ -5,9 +5,10 @@ Feature: Selecting available shipping methods for a channel
I want to be able to select available shipping methods

Background:
Given there is a zone "EU" containing all members of the European Union
Given the store has currency "Euro"
And the store has locale "English (United States)"
And there is a zone "EU" containing all members of the European Union
And the store allows shipping with "UPS Carrier" identified by "UPS_CARRIER"
And the store has currency "Euro"
And I am logged in as an administrator

@ui
Expand All @@ -17,6 +18,7 @@ Feature: Selecting available shipping methods for a channel
And I name it "Mobile store"
And I select the "UPS Carrier" shipping method
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the "UPS Carrier" shipping method should be available for the "Mobile store" channel
Expand Down
Expand Up @@ -5,15 +5,17 @@ Feature: Selecting tax calculation strategy for a channel
I want to be able to select tax calculation strategy

Background:
Given I am logged in as an administrator
And the store has currency "Euro"
Given the store has currency "Euro"
And the store has locale "English (United States)"
And I am logged in as an administrator

@ui
Scenario: Adding a new channel with implicitly selected tax calculation strategy
Given I want to create a new channel
When I specify its code as "MOBILE"
And I name it "Mobile store"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the tax calculation strategy for the "Mobile store" channel should be "Order items based"
Expand All @@ -25,6 +27,7 @@ Feature: Selecting tax calculation strategy for a channel
And I select the "Order item units based" as tax calculation strategy
And I name it "Mobile store"
And I choose "Euro" as a default currency
And I choose "English (United States)" as a default locale
And I add it
Then I should be notified that it has been successfully created
And the tax calculation strategy for the "Mobile store" channel should be "Order item units based"
Expand Down
@@ -0,0 +1,33 @@
@locales
Feature: Handling different locales on multiple channels
In order to see right prices
As a Customer
I want to browse channels with a valid locale only

Background:
Given the store operates on a channel named "Web"
And that channel allows to shop using "English (United States)", "Polish (Poland)" and "Norwegian (Norway)" locales
And it uses the "English (United States)" locale by default
And the store operates on another channel named "Mobile"
And that channel allows to shop using "Polish (Poland)" and "Norwegian (Norway)" locales
And it uses the "Polish (Poland)" locale by default

@ui
Scenario: Showing locales only from the current channel
When I browse the "Mobile" channel
Then I should shop using the "Polish (Poland)" locale
And I should be able to shop using the "Norwegian (Norway)" locale
And I should not be able to shop using the "English (United States)" locale

@ui
Scenario: Browsing channels using their default locales
When I browse the "Web" channel
And I start browsing the "Mobile" channel
Then I should shop using the "Polish (Poland)" locale

@ui
Scenario: Switching a locale applies only to the current channel
When I browse the "Web" channel
And I switch to the "Norwegian (Norway)" locale
And I start browsing the "Mobile" channel
Then I should still shop using the "Polish (Poland)" locale
38 changes: 38 additions & 0 deletions features/locale/handling_disabled_locales.feature
@@ -0,0 +1,38 @@
@locales
Feature: Handling disabled locales
In order to see right prices
As a Customer
I want to browse channels with a valid locale only

Background:
Given the store operates on a channel named "Web"
And that channel allows to shop using "English (United States)", "Polish (Poland)" and "Norwegian (Norway)" locales
And it uses the "English (United States)" locale by default

@ui
Scenario: Not showing the disabled locale
Given the locale "Norwegian (Norway)" is disabled
When I browse that channel
Then I should not be able to shop using the "Norwegian (Norway)" locale

@ui
Scenario: Failing to browse channel with disabled default locale
Given the locale "English (United States)" is disabled as well
When I try to browse that channel
Then I should not be able to shop

@ui
Scenario: Falling back to the default locale if selected one is not available
Given I am browsing that channel
And I switch to the "Polish (Poland)" locale
When the locale "Polish (Poland)" gets disabled
Then I should shop using the "English (United States)" locale
And I should not be able to shop using the "Polish (Poland)" locale

@ui
Scenario: Browsing a channel with the default locale disabled while using the other one
Given I am browsing that channel
And I switch to the "Polish (Poland)" locale
When the locale "English (United States)" gets disabled
Then I should still shop using the "Polish (Poland)" locale
And I should not be able to shop using the "English (United States)" locale
27 changes: 27 additions & 0 deletions features/locale/switching_current_locale.feature
@@ -0,0 +1,27 @@
@locales
Feature: Switching the current locale
In order to see prices in my preferred locale
As a Customer
I want to be able to switch locales

Background:
Given the store operates on a channel named "Web"
And that channel allows to shop using "English (United States)" and "Polish (Poland)" locales
And it uses the "English (United States)" locale by default

@ui
Scenario: Showing the current locale
When I browse that channel
Then I should shop using the "English (United States)" locale

@ui
Scenario: Showing available locales
When I browse that channel
Then I should be able to shop using the "Polish (Poland)" locale

@ui
Scenario: Switching the current locale
When I browse that channel
And I switch to the "Polish (Poland)" locale
Then I should shop using the "Polish (Poland)" locale
And I should be able to shop using the "English (United States)" locale

0 comments on commit ead0263

Please sign in to comment.