⏱️ Duration: 1.23s
❌ Error:
self = <tests.test_pricing.TestPricing object at 0x7fd2d4cda0e0>
pricing_page = <pages.pricing_page.PricingPage object at 0x7fd2d4cfd570>
base_url = 'https://promo.com'
def test_p05_anonymous_user_sees_correct_currency(
self, pricing_page, base_url
):
"""
P05 Anonymous user has a correct currency in pricing & on the upgrade page
Feature scenario:
When I open pricing page
Then I verify a correct currency is displayed
When I open the upgrade page with url
Then I verify a correct currency is displayed
The expected currency symbol is derived from the CURRENCY_IP env var
(defaults to "$" / USD when not set).
"""
expected_symbol = pricing_page.get_expected_currency_symbol()
pricing_page.go_to_pricing_page(base_url)
pricing_page.skip_cookies()
pricing_page.assert_currency_displayed(expected_symbol)
pricing_page.go_to_upgrade_page(base_url)
> pricing_page.assert_currency_displayed(expected_symbol)
tests/test_pricing.py:106:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
self = <pages.pricing_page.PricingPage object at 0x7fd2d4cfd570>
expected_symbol = '$'
def assert_currency_displayed(self, expected_symbol: str = "$"):
"""
Verifies at least one currency element on the page shows the expected
symbol. Mirrors: currencies_check(browser) from newcancellation_page.py
"""
locator = self.page.locator(
f'{self.CURRENCY_SYMBOL}:has-text("{expected_symbol}")'
)
count = locator.count()
> assert count > 0, (
f"Expected at least one '{expected_symbol}' currency symbol on the "
f"page, found {count}"
)
E AssertionError: Expected at least one '$' currency symbol on the page, found 0
pages/pricing_page.py:293: AssertionError
📸 Failure Screenshot: