diff --git a/README.md b/README.md index 147e474..f096c95 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ One switch in the admin panel, under **Settings → Roadmap**: whether comments ## Demo data ```bash -php artisan modules:seed --module=roadmap --demo +php artisan modules:seed --module=roadmap --state=showcase ``` Adds sample items with votes and comments from sample users, and a staff account (`roadmap@saucebase.dev`) that only sees the roadmap in the admin. All use the `DEMO_PASSWORD` from `.env`. diff --git a/Taskfile.yml b/Taskfile.yml index e288c1f..218f501 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -14,9 +14,9 @@ tasks: # ── Database ────────────────────────────────────────────────── - db:seed:demo: + db:seed:showcase: desc: Seed the Roadmap module with sample content - cmd: '{{.APP}} php artisan modules:seed --module=roadmap --demo' + cmd: '{{.APP}} php artisan modules:seed --module=roadmap --state=showcase' # ── Code Generation ──────────────────────────────────────────── diff --git a/composer.json b/composer.json index c5345f6..0c952d5 100644 --- a/composer.json +++ b/composer.json @@ -5,7 +5,7 @@ "license": "MIT", "version": "v3.5.1", "require": { - "saucebase/core": "^2.8" + "saucebase/core": "^3.0" }, "authors": [ { @@ -25,6 +25,9 @@ "vue", "react" ] + }, + "branch-alias": { + "dev-dev": "3.6.x-dev" } }, "autoload": { diff --git a/database/seeders/DemoRoadmapDatabaseSeeder.php b/database/seeders/ShowcaseRoadmapDatabaseSeeder.php similarity index 99% rename from database/seeders/DemoRoadmapDatabaseSeeder.php rename to database/seeders/ShowcaseRoadmapDatabaseSeeder.php index 7d2f599..6dea187 100644 --- a/database/seeders/DemoRoadmapDatabaseSeeder.php +++ b/database/seeders/ShowcaseRoadmapDatabaseSeeder.php @@ -9,7 +9,7 @@ use Modules\Roadmap\Models\RoadmapItem; use Spatie\Permission\Models\Role; -class DemoRoadmapDatabaseSeeder extends Seeder +class ShowcaseRoadmapDatabaseSeeder extends Seeder { public function run(): void { diff --git a/resources/js/react/components/ItemCard.tsx b/resources/js/react/components/ItemCard.tsx index 06ecd35..50596e2 100644 --- a/resources/js/react/components/ItemCard.tsx +++ b/resources/js/react/components/ItemCard.tsx @@ -60,6 +60,7 @@ export default function ItemCard({ variant="secondary" className="text-xs" data-testid={`item-status-${item.id}`} + data-state={item.status} > {item.status_label} diff --git a/resources/js/vue/components/ItemCard.vue b/resources/js/vue/components/ItemCard.vue index f8737ac..a8d31f1 100644 --- a/resources/js/vue/components/ItemCard.vue +++ b/resources/js/vue/components/ItemCard.vue @@ -55,6 +55,7 @@ defineEmits<{ vote: [item: RoadmapItem] }>(); variant="secondary" class="text-xs" :data-testid="`item-status-${item.id}`" + :data-state="item.status" > {{ item.status_label }} diff --git a/tests/Feature/DemoStaffTest.php b/tests/Feature/ShowcaseStaffTest.php similarity index 79% rename from tests/Feature/DemoStaffTest.php rename to tests/Feature/ShowcaseStaffTest.php index 70ff37b..e61c105 100644 --- a/tests/Feature/DemoStaffTest.php +++ b/tests/Feature/ShowcaseStaffTest.php @@ -6,20 +6,20 @@ use Illuminate\Foundation\Testing\RefreshDatabase; use Illuminate\Support\Facades\Hash; use Modules\Roadmap\Database\Seeders\DatabaseSeeder; -use Modules\Roadmap\Database\Seeders\DemoRoadmapDatabaseSeeder; +use Modules\Roadmap\Database\Seeders\ShowcaseRoadmapDatabaseSeeder; use Tests\TestCase; /** * The demo ships a staff account for this module's admin area, so visitors can try a * role that sees only part of the panel. */ -class DemoStaffTest extends TestCase +class ShowcaseStaffTest extends TestCase { use RefreshDatabase; public function test_the_demo_adds_a_staff_account_for_this_module_only(): void { - $this->seed([DatabaseSeeder::class, DemoRoadmapDatabaseSeeder::class]); + $this->seed([DatabaseSeeder::class, ShowcaseRoadmapDatabaseSeeder::class]); $staff = User::where('email', 'roadmap@saucebase.dev')->firstOrFail(); @@ -31,7 +31,7 @@ public function test_demo_accounts_use_the_configured_demo_password(): void { config(['saucebase.demo_password' => 'not-the-old-default']); - $this->seed([DatabaseSeeder::class, DemoRoadmapDatabaseSeeder::class]); + $this->seed([DatabaseSeeder::class, ShowcaseRoadmapDatabaseSeeder::class]); $this->assertTrue(Hash::check('not-the-old-default', User::where('email', 'roadmap@saucebase.dev')->value('password'))); } diff --git a/tests/e2e/tests/roadmap.spec.ts b/tests/e2e/tests/roadmap.spec.ts index 6da3b4b..fa5b1bb 100644 --- a/tests/e2e/tests/roadmap.spec.ts +++ b/tests/e2e/tests/roadmap.spec.ts @@ -178,19 +178,12 @@ test.describe('Roadmap', () => { await expect(panel.getByTestId(`vote-count-${item.id}`)).toHaveText( '1', ); - // Toasts stack (sign-in, then each vote): look a toast up by its text. - await expect( - page.locator('[data-sonner-toast]', { hasText: 'Upvoted!' }), - ).toBeVisible(); await expect(panel).toBeVisible(); await expect(page).toHaveURL(new RegExp(`/roadmap/${item.slug}$`)); const card = page.getByTestId(`roadmap-item-${item.id}`); await expect(card.getByTestId(`vote-count-${item.id}`)).toHaveText('1'); await panel.getByTestId(`vote-btn-${item.id}`).click(); - await expect( - page.locator('[data-sonner-toast]', { hasText: 'Vote removed' }), - ).toBeVisible(); await expect(panel).toBeVisible(); await expect(page).toHaveURL(new RegExp(`/roadmap/${item.slug}$`)); await expect(panel.getByTestId(`vote-count-${item.id}`)).toHaveText( @@ -315,7 +308,9 @@ test.describe('Roadmap', () => { await page.getByTestId('filter-mine').click(); const mine = page.getByTestId('roadmap-mine'); await expect(mine).toContainText('Export to CSV'); - await expect(mine).toContainText('Under Review'); + await expect( + mine.locator('[data-testid^="item-status-"]'), + ).toHaveAttribute('data-state', 'under_review'); await page.getByTestId('filter-mine-back').click(); await expect(page.getByTestId('roadmap-board')).toBeVisible();