-
Restore .NET tools:
dotnet tool restore
-
Create the buttercup_dev user that will be used to connect to the application and test databases:
mysql -u root -p < scripts/create-dev-user.sql
-
Create the application database:
dotnet ef database update -s src/Buttercup.Web
-
Insert a user account:
mysql -u buttercup_dev buttercup_app << SQL INSERT users (name, email, security_stamp, time_zone, created, modified, revision) VALUES ('<your-name>', '<your-email>', '', 'Etc/UTC', UTC_TIMESTAMP, UTC_TIMESTAMP, 0) SQL
Once the application is running, you'll be able to use the password reset flow to set a password.
-
Change to the web project directory
cd src/Buttercup.Web
-
Create a SendGrid API key with full access to Mail Send > Mail Send only, and add it as a user secret:
dotnet user-secrets set "Email:ApiKey" "<replace-with-api-key>"
-
Create a Bugsnag project for the application and add the corresponding notifier API key as a user secret:
dotnet user-secrets set "Bugsnag:ApiKey" "<replace-with-api-key>"
-
Change to the web project directory:
cd src/Buttercup.Web
-
Install node dependencies:
npm install
-
Build all development and production assets once:
npx gulp
Or build only development assets and watch for changes:
npx gulp watch
-
Run the app:
dotnet run
-
To run all .NET tests:
dotnet test
-
Change to the web project directory:
cd src/Buttercup.Web
-
Install node dependencies:
npm install
-
Run all tests once:
npx jest
Or run tests for changed files in watch mode:
npx jest --watch
-
Change to the web project directory:
cd src/Buttercup.Web
-
Install node dependencies:
npm install
-
Build frontend assets:
npx gulp
-
Run all tests once:
npx playwright test
Or run the tests in UI mode:
npx playwright test --ui
-
Before running any tests, Playwright will automatically start an instance of the app on http://localhost:5005. However, the app can also be started manually first:
cd src/Buttercup.Web dotnet run --environment E2E --urls http://localhost:5005
-
End-to-end tests should be designed to clean up any database records they create, even on failure. However, if necessary, the database can be deleted, ready to be recreated on the next run:
cd src/Buttercup.Web DOTNET_ENVIRONMENT=E2E dotnet ef database drop
-
To generate and open the .NET coverage report:
dotnet test --collect "XPlat Code Coverage" ./scripts/build-dotnet-coverage-report.sh open coverage/index.html
-
To generate and open the TypeScript coverage report:
cd src/Buttercup.Web npx jest --coverage open coverage/lcov-report/index.html
-
To lint scripts:
cd src/Buttercup.Web npx eslint .
-
To lint styles:
cd src/Buttercup.Web npx stylelint styles/
-
To create a new database migration:
dotnet ef migrations add <MIGRATION_NAME> -s src/Buttercup.Web -p src/Buttercup.EntityModel.Migrations
-
To run all pending database migrations:
dotnet ef database update -s src/Buttercup.Web