Skip to content

Commit

Permalink
fix tests, remove rate limit in non production environments
Browse files Browse the repository at this point in the history
  • Loading branch information
Gregor Vostrak authored and Gregor Vostrak committed Mar 13, 2024
1 parent a71ba54 commit d5ad57d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
4 changes: 4 additions & 0 deletions app/Providers/RouteServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ class RouteServiceProvider extends ServiceProvider
public function boot(): void
{
RateLimiter::for('api', function (Request $request) {
if (! $this->app->isProduction()) {
return Limit::none();
}

return Limit::perMinute(60)->by($request->user()?->id ?: $request->ip());
});

Expand Down
9 changes: 3 additions & 6 deletions e2e/timetracker.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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_entries')).toHaveText(
newTagName
);
await expect(page.getByRole('option', { name: newTagName })).toBeVisible();
});

test('test that adding a new tag when the timer is running', async ({
Expand All @@ -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_entries')).toHaveText(
newTagName
);

await expect(page.getByRole('option', { name: newTagName })).toBeVisible();

await page.waitForResponse(async (response) => {
return (
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"lint": "eslint --ext .js,.vue,.ts --ignore-path .gitignore .",
"lint:fix": "eslint --fix --ext .js,.vue,.ts --ignore-path .gitignore .",
"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"
},
"devDependencies": {
Expand Down
4 changes: 2 additions & 2 deletions playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ export default defineConfig({
/* Opt out of parallel tests on CI. */
workers: process.env.CI ? 1 : undefined,
/* 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. */
use: {
/* Base URL to use in actions like `await page.goto('/')`. */
// baseURL: 'http://127.0.0.1:3000',

/* 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 */
Expand Down

0 comments on commit d5ad57d

Please sign in to comment.