From 22f7b79a3da79efbbcd013e3e7181475388b57a7 Mon Sep 17 00:00:00 2001 From: David Gwilliam Date: Sat, 25 Apr 2026 21:13:35 -0700 Subject: [PATCH] feat: add wordmark navigation feature test (issue #24) - Add wordmark-navigation.feature with 3 scenarios - Add step definitions for clicking wordmark and page assertions - Test unauthenticated, player, and admin navigation paths --- .../features/wordmark-navigation.feature | 26 +++++++++++++++++++ e2e/cucumber/step-definitions/common-steps.ts | 21 +++++++++++++++ 2 files changed, 47 insertions(+) create mode 100644 e2e/cucumber/features/wordmark-navigation.feature diff --git a/e2e/cucumber/features/wordmark-navigation.feature b/e2e/cucumber/features/wordmark-navigation.feature new file mode 100644 index 0000000..eee5275 --- /dev/null +++ b/e2e/cucumber/features/wordmark-navigation.feature @@ -0,0 +1,26 @@ +Feature: Wordmark Navigation + As a user + I want the EuchreCamp wordmark to navigate to my appropriate homepage + So that I can quickly access my relevant content + + @happy-path @navigation @issue-24 + Scenario: Unauthenticated user clicks wordmark goes to public homepage + Given I am on the home page + When I click the "EuchreCamp" wordmark + Then I should be on the home page + And I should see "Top 10 Players" + And I should see "Sign In" + + @happy-path @navigation @authenticated @issue-24 + Scenario: Authenticated player clicks wordmark goes to their profile + Given I am logged in as a player + When I click the "EuchreCamp" wordmark + Then I should be redirected to my profile page + And I should see "Welcome" + + @happy-path @navigation @authenticated @issue-24 + Scenario: Authenticated admin clicks wordmark goes to admin dashboard + Given I am logged in as a club admin + When I click the "EuchreCamp" wordmark + Then I should be on the admin page + And I should see "Admin" diff --git a/e2e/cucumber/step-definitions/common-steps.ts b/e2e/cucumber/step-definitions/common-steps.ts index 103c01d..7d23538 100644 --- a/e2e/cucumber/step-definitions/common-steps.ts +++ b/e2e/cucumber/step-definitions/common-steps.ts @@ -139,6 +139,13 @@ When('I click the {string} link', async function (linkText: string) { await world.page.click(selector); }); +When('I click the {string} wordmark', async function (wordmarkText: string) { + const selector = `a:has-text("${wordmarkText}")`; + console.log(`🌍 Clicking wordmark: ${wordmarkText}`); + await world.page.click(selector); + await world.page.waitForLoadState('networkidle'); +}); + When('I click the {string} element', async function (elementText: string) { const selector = `text=${elementText}`; console.log(`🌍 Clicking element: ${elementText}`); @@ -202,6 +209,20 @@ Then('I should be on the login page', async function () { expect(currentUrl).toContain('/auth/login'); }); +Then('I should be on the admin page', async function () { + const currentUrl = world.page.url(); + + console.log(`🌍 Checking current URL: ${currentUrl}`); + expect(currentUrl).toContain('/admin'); +}); + +Then('I should be on the home page', async function () { + const currentUrl = world.page.url(); + + console.log(`🌍 Checking current URL: ${currentUrl}`); + expect(currentUrl).toContain('/'); +}); + Then('I should be redirected to {string}', async function (path: string) { await world.page.waitForLoadState('networkidle'); const currentUrl = world.page.url();