Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ The admin panel theme is under **Settings → Admin theme**.
## Demo data

```bash
php artisan modules:seed --module=themes --demo
php artisan modules:seed --module=themes --state=showcase
```

Adds a staff account (`themes@saucebase.dev`) that only sees the admin theme settings. It uses the `DEMO_PASSWORD` from `.env`.
Expand Down
5 changes: 4 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"version": "v3.5.0",
"require": {
"saucebase/core": "^2.8"
"saucebase/core": "^3.0"
},
"authors": [
{
Expand All @@ -25,6 +25,9 @@
"vue",
"react"
]
},
"branch-alias": {
"dev-dev": "3.6.x-dev"
}
},
"autoload": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use Illuminate\Database\Seeder;
use Spatie\Permission\Models\Role;

class DemoThemesDatabaseSeeder extends Seeder
class ShowcaseThemesDatabaseSeeder extends Seeder
{
public function run(): void
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,33 @@
use Illuminate\Foundation\Testing\RefreshDatabase;
use Illuminate\Support\Facades\Hash;
use Modules\Themes\Database\Seeders\DatabaseSeeder;
use Modules\Themes\Database\Seeders\DemoThemesDatabaseSeeder;
use Modules\Themes\Database\Seeders\ShowcaseThemesDatabaseSeeder;
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, DemoThemesDatabaseSeeder::class]);
$this->seed([DatabaseSeeder::class, ShowcaseThemesDatabaseSeeder::class]);

$staff = User::where('email', 'themes@saucebase.dev')->firstOrFail();

$this->assertSame(['themes admin'], $staff->getRoleNames()->all());
$this->assertEqualsCanonicalizing(['access admin panel', 'manage themes'], $staff->getAllPermissions()->pluck('name')->all());

Check warning on line 27 in tests/Feature/ShowcaseStaffTest.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 134 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=saucebase-dev_themes&issues=AaHgkWkL-L6fORci48Fi&open=AaHgkWkL-L6fORci48Fi&pullRequest=24
}

public function test_demo_accounts_use_the_configured_demo_password(): void
{
config(['saucebase.demo_password' => 'not-the-old-default']);

$this->seed([DatabaseSeeder::class, DemoThemesDatabaseSeeder::class]);
$this->seed([DatabaseSeeder::class, ShowcaseThemesDatabaseSeeder::class]);

$this->assertTrue(Hash::check('not-the-old-default', User::where('email', 'themes@saucebase.dev')->value('password')));

Check warning on line 36 in tests/Feature/ShowcaseStaffTest.php

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Split this 127 characters long line (which is greater than 120 authorized).

See more on https://sonarcloud.io/project/issues?id=saucebase-dev_themes&issues=AaHgkWkL-L6fORci48Fj&open=AaHgkWkL-L6fORci48Fj&pullRequest=24
}
}
2 changes: 1 addition & 1 deletion tests/e2e/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ test.describe('Theme panel', () => {
await page.getByTestId('save-theme-submit').click();

await expect(
page.getByText('Something went wrong. Try again.'),
page.locator('[data-sonner-toast][data-type="error"]'),
).toBeVisible();
await expect(page.getByTestId('save-theme-submit')).toBeEnabled();
});
Expand Down
Loading