fix tests, remove rate limit in non production environments

This commit is contained in:
Gregor Vostrak
2024-03-13 14:15:56 +01:00
parent 37cf43fe2d
commit 7320efd0a9
4 changed files with 10 additions and 9 deletions

View File

@@ -27,6 +27,10 @@ class RouteServiceProvider extends ServiceProvider
public function boot(): void public function boot(): void
{ {
RateLimiter::for('api', function (Request $request) { RateLimiter::for('api', function (Request $request) {
if (! $this->app->isProduction()) {
return Limit::none();
}
return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip()); return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
}); });

View File

@@ -364,9 +364,7 @@ test('test that adding a new tag works', async ({ page }) => {
); );
}); });
await expect(page.getByTestId('tag_dropdown_search')).toHaveValue(''); await expect(page.getByTestId('tag_dropdown_search')).toHaveValue('');
await expect(page.getByTestId('tag_dropdown_entries')).toHaveText( await expect(page.getByRole('option', { name: newTagName })).toBeVisible();
newTagName
);
}); });
test('test that adding a new tag when the timer is running', async ({ test('test that adding a new tag when the timer is running', async ({
@@ -389,9 +387,8 @@ test('test that adding a new tag when the timer is running', async ({
); );
}); });
await expect(page.getByTestId('tag_dropdown_search')).toHaveValue(''); await expect(page.getByTestId('tag_dropdown_search')).toHaveValue('');
await expect(page.getByTestId('tag_dropdown_entries')).toHaveText(
newTagName await expect(page.getByRole('option', { name: newTagName })).toBeVisible();
);
await page.waitForResponse(async (response) => { await page.waitForResponse(async (response) => {
return ( return (

View File

@@ -7,7 +7,7 @@
"lint": "eslint --ext .js,.vue,.ts --ignore-path .gitignore .", "lint": "eslint --ext .js,.vue,.ts --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .js,.vue,.ts --ignore-path .gitignore .", "lint:fix": "eslint --fix --ext .js,.vue,.ts --ignore-path .gitignore .",
"type-check": "vue-tsc --noEmit", "type-check": "vue-tsc --noEmit",
"test:e2e": "npx playwright test", "test:e2e": "rm -rf test-results/.auth && npx playwright test",
"generate:zod": "npx openapi-zod-client http://localhost:80/docs/api.json --output openapi.json.client.ts --base-url http://solidtime.test/api" "generate:zod": "npx openapi-zod-client http://localhost:80/docs/api.json --output openapi.json.client.ts --base-url http://solidtime.test/api"
}, },
"devDependencies": { "devDependencies": {

View File

@@ -20,14 +20,14 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */ /* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined, workers: process.env.CI ? 1 : undefined,
/* Reporter to use. See https://playwright.dev/docs/test-reporters */ /* Reporter to use. See https://playwright.dev/docs/test-reporters */
reporter: process.env.CI ? 'list' : 'html', reporter: process.env.CI ? 'github' : 'html',
/* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */ /* Shared settings for all the projects below. See https://playwright.dev/docs/api/class-testoptions. */
use: { use: {
/* Base URL to use in actions like `await page.goto('/')`. */ /* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000', // baseURL: 'http://127.0.0.1:3000',
/* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */ /* Collect trace when retrying the failed test. See https://playwright.dev/docs/trace-viewer */
trace: 'on-first-retry', trace: 'on',
}, },
/* Configure projects for major browsers */ /* Configure projects for major browsers */