Files
calendar/tests/performance/utils/helpers.js
T
Anik Dhabal BabuGitHubDevin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>Volnei Munhoz
a22ca4758c test: Performance tests suite (#21226)
* fix: add org email into ics

* perf test

* update

* fix: address bot comments on performance tests

- Add validation to randomSleep function to ensure min <= max
- Replace new Date().getTime() with Date.now() for better performance
- Move hardcoded test credentials to environment variables
- Add HTTP timeout to requests in helpers.js
- Improve DOM element checking to be less brittle
- Fix spike test sleep duration from 0.01s to 0.1s
- Make GitHub workflow BASE_URL configurable with inputs
- Fix README filename reference from booking_flow.js to booking.js
- Add documentation for new environment variables

Co-Authored-By: anik@cal.com <adhabal2002@gmail.com>

* Add script and small sec check

* chore: fix script path

* chore: fix script path

* chore: change default url

---------

Co-authored-by: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Co-authored-by: Volnei Munhoz <volnei.munhoz@gmail.com>
2025-08-26 09:16:19 -03:00

25 lines
722 B
JavaScript

import { check, group } from "k6";
import http from "k6/http";
import { randomSleep, BASE_URL, randomQueryParam } from "./config.js";
export function viewBookingPage(username, eventSlug) {
return group("View Booking Page", () => {
const url = `${BASE_URL}/${username}/${eventSlug}?${randomQueryParam()}`;
const response = http.get(url, {
tags: { name: "Booking Page" },
timeout: "30s",
});
check(response, {
"Booking page loaded": (r) => r.status === 200,
"Has booking form": (r) => r.body.includes('data-testid="day"') || r.body.includes("booking"),
"Response time acceptable": (r) => r.timings.duration < 5000,
});
randomSleep();
return response;
});
}