Viewing the paywall

BDD file with acceptance criteria for viewing the paywall, describing each step of the feature and user permissions.
Feature: As a user I want to view the paywall page and manage my subscription

Scenario Outline: Paywall permission - <userRole>
 Given  my current user role is <userRole>
 And  my current plan label is <currentPlanLabel>
 And  I am on the paywall modal
 Then  I won't have the permission to change plan to <upgradePlanLabel>

Examples:
| userRole | currentPlanLabel | upgradePlanLabel |
| INTERNAL_REVIEWER | Company | Team |
| EXTERNAL_REVIEWER | Company | Team |

Scenario: Paywall permission - enterprise users
 And  my current plan label is "Enterprise"
 And  I am on the paywall modal
 Then  I will see a 404 page

Scenario: Paywall plans as anonymous user - yearly billing
 Given  I am on the paywall modal
 Then  I will see the following plans:
| name | subtitle | price | billing | button |
| Free | Try one project for yourself or your team with no time-limits. | $0 / mo |  | Get Free |
| Pro | For individuals or small teams that need more projects | $12 / mo | Billed yearly | Get Pro |
| Team | Great for teams that want to get started with more features | $42 / mo | Billed yearly | Start 7-day free trial |
| Enterprise | Per user, volume pricing. |  |  | Request a Quote |

Scenario: Paywall plans as anonymous user - monthly billing
 Given  I am on the paywall modal
 And  I switched to monthly billing
 Then  I will see the following plans:
| name | subtitle | price | billing | button |
| Free | Try one project for yourself or your team with no time-limits. | $0 / mo |  | Get Free |
| Pro | For individuals or small teams that need more projects | $16 / mo | Billed monthly | Get Pro |
| Team | Great for teams that want to get started with more features | $48 / mo |  | Start 7-day free trial |
| Enterprise | Per user, volume pricing. |  |  | Request a Quote |

Scenario: Enterprise page
 Given  I am on the paywall modal
 And  I click on "Request a Quote"
 Then  I will be taken to the enterprise page

Scenario Outline: Dynamic header title based on query parameters - <url>
 Given  I land on the paywall modal from the url <url>
 Then  I will see a header with text <header>

Examples:
| url | header |
| /plans | Upgrade and get more out of Marvel |
| /plans?intent=reached-project-limit | Upgrade to create unlimited projects |
| /plans?intent=reached-ut-results-limit | Upgrade for more user test results |

Scenario Outline: Display the user's current plan: <planLabel>
 Given  my current plan label is <planLabel>
 And  I am on the paywall modal
 Then  I will see the plan button in position <planIndex> marked as "Current plan"
 And  it will be disabled

Examples:
| planLabel | planIndex |
| Free | 0 |
| Pro | 1 |
| Team | 2 |

Scenario Outline: Open the switch to free dialog
 Given  my current plan label is <planLabel>
 And  I am on the paywall modal
 And  I press "Downgrade"
 Then  I will see the downgrade survey with title "Before you downgrade"
 And  a "Reason" question
 And  a "How likely would you recommend Marvel to a friend?" question
 And  a "Are you switching to an alternative tool?" question

Examples:
| planLabel |
| Pro |
| Team |

Scenario: Switch to the free plan - success
 Given  my current plan label is "Pro"
 And  I am on the paywall modal
 And  I press "Downgrade"
 And  I type "writing tests" in the input with placeholder "Why are you leaving us?"
 And  I select "very likely" to recommend Marvel to a friend
 And  I say I'm not switching to another tool
 When  I confirm the downgrade
 Then  I will be downgraded to the free plan
 And  the modal will close

Scenario: Switch to the free plan - failure
 Given  my current plan label is "Pro"
 And  I am on the paywall modal
 And  I press "Downgrade"
 When  I try to get to the next step
 Then  I will see errors telling me to complete the form

Scenario Outline: Upgrade from free to paid - <url>
 Given  my current plan label is "Free"
 And  I am on the paywall modal
 And  the billing toggle is set to <billing>
 And  I press the <buttonText> button
 Then  I will be redirected to the upgrade modal with <url>
 And  I will see a form to confirm my upgrade

Examples:
| buttonText | billing | url |
| Get Pro | monthly | /upgrade/plan/pro/billing-cycle/monthly |
| Get Pro | yearly | /upgrade/plan/pro/billing-cycle/yearly |
| Start 7-day free trial | monthly | /upgrade/plan/company-3-person/billing-cycle/monthly |
| Start 7-day free trial | yearly | /upgrade/plan/company-3-person/billing-cycle/yearly |

Scenario Outline: Switch from paid to paid - <url>
 Given  my current plan label is <planLabel>
 And  my current billing cycle is <currentBilling>
 And  I am on the paywall modal
 And  the billing toggle is set to <newBilling>
 And  I press the <buttonText> button
 Then  I will be redirected to the upgrade modal with <url>
 And  I will see a form to confirm my upgrade

Examples:
| planLabel | buttonText | currentBilling | newBilling | url |
| Pro | Start 7-day free trial | monthly | yearly | /upgrade/plan/company-3-person/billing-cycle/yearly |
| Team | Get Pro | monthly | monthly | /upgrade/plan/pro/billing-cycle/monthly |

Scenario Outline: Billing cycle switch visibility: enabled
 Given  my current plan label is <planLabel>
 And  my current billing cycle is "monthly"
 And  I am on the paywall modal
 Then  I will see a toggle button to switch to yearly billing

Examples:
| planLabel |
| Pro |
| Team |

Scenario Outline: Billing cycle switch visibility: disabled
 Given  my current plan label is <planLabel>
 And  my current billing cycle is "yearly"
 And  I am on the paywall modal
 Then  I won't see a toggle button to switch to monthly billing

Examples:
| planLabel |
| Pro |
| Team |

Scenario Outline: Switch to yearly
 Given  my current plan label is <planLabel>
 And  my current billing cycle is "monthly"
 And  I am on the paywall modal
 And  I set the billing toggle to "yearly"
 Then  I will see the plan button in position <planIndex> with text "Switch to yearly"
 And  when I press it
 Then  will see the switch to yearly modal with url "/switch-to-yearly-plan"

Examples:
| planLabel | planIndex |
| Pro | 1 |
| Team | 2 |

Scenario: Users on free plan cannot switch to yearly
 Given  my current plan label is "Free"
 And  I am on the paywall modal
 And  the billing toggle is set to "yearly"
 Then  I will see a plan button with text "Current plan" in position 0

Scenario: Seeing student discount link
 Given  I have specified my occupation as student
 Then  I will see a student discount link
 And  I will not see the enterprise card

Scenario: No student link
 Given  I have specified my occupation as <occupation>
| occupation |
| OCCUPATION_DEVELOPER |
| OCCUPATION_DESIGNER |
| OCCUPATION_MARKETING_MANAGER |
| OCCUPATION_PRODUCT_MANAGER |
| OCCUPATION_DIRECTOR |
| OCCUPATION_OTHER |
| OCCUPATION_RESEARCHER |
| OCCUPATION_FOUNDER |
| OCCUPATION_TEACHER |
| OCCUPATION_FINANCE |
| OCCUPATION_SALES |
| OCCUPATION_SUPPORT |
| OCCUPATION_IT |
 Then  I will see the enterprise card
 And  I won't see a student discount link