From 062a1ce668f20d36157308dac7ad34d6bfc9c49b Mon Sep 17 00:00:00 2001 From: YaelChen Date: Wed, 11 Dec 2024 13:22:11 +0200 Subject: [PATCH] test: api basic tests --- tests/APItests.spec.ts | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tests/APItests.spec.ts diff --git a/tests/APItests.spec.ts b/tests/APItests.spec.ts new file mode 100644 index 00000000..520d5d76 --- /dev/null +++ b/tests/APItests.spec.ts @@ -0,0 +1,17 @@ +import { test, expect } from '@playwright/test' + +test('sanity test', async ({ request }) => { + const response = await request.get('/') + expect(response.status()).toBe(200) +}) + +test('basic load test - sends a 100 requests', async ({ request }) => { + const promises = [] + //an array of 100 requests + for (let i = 0; i < 100; i++) promises.push(request.get('/')) + //request all in parallel + const responses = await Promise.all(promises) + for (const response of responses) { + expect(response.status()).toBe(200) + } +})