-
Notifications
You must be signed in to change notification settings - Fork 0
/
three.js
40 lines (31 loc) · 1.37 KB
/
three.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
import http from 'k6/http';
import { check, group, sleep } from 'k6';
import { htmlReport } from "https://raw.githubusercontent.com/benc-uk/k6-reporter/main/dist/bundle.js";
export { options } from './options.js';
const BASE_URL = `${__ENV.BASE_URL}`;
const userOptions = JSON.parse(open('users.json'));
export default function () {
// 1: unauthenticated load of portal should set a new cookie
const portalPage = http.get(`${BASE_URL}/portal/xlogin`);
check(portalPage, {
'is status 200': (r) => r.status === 200,
'cookie named JSESSIONID': (r) => r.cookies.JSESSIONID[0].name === 'JSESSIONID',
});
// 2: post our credentials and get redirected to authenticated home page
const authenticatedPage = http.post(`${BASE_URL}/portal/xlogin`, { eid: userOptions.instEid, pw: userOptions.instPw });
check(authenticatedPage, {
'auth page is status 200': (r) => r.status === 200,
'verify homepage text': (r) => r.body.includes('Message Of The Day'),
});
// 3: go to the assignments page
const assignmentsPage = http.get(`${BASE_URL}/portal/site/${userOptions.site}/tool/${userOptions.assignments}`);
check(assignmentsPage, {
'assignments page is status 200': (r) => r.status === 200,
'verify assignments text': (r) => r.body.includes('Assignment Title'),
});
};
export function handleSummary(data) {
return {
"three.html": htmlReport(data),
};
}