Skip to content

Commit

Permalink
fix: use fixed admin sciper for mocks
Browse files Browse the repository at this point in the history
  • Loading branch information
PascalinDe committed Dec 4, 2023
1 parent bf17a92 commit 42146a5
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 3 deletions.
61 changes: 61 additions & 0 deletions web/frontend/tests/hars/get_dev_login.123456.har
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"log": {
"version": "1.2",
"creator": {
"name": "Playwright",
"version": "1.40.1"
},
"browser": {
"name": "chromium",
"version": "120.0.6099.28"
},
"entries": [
{
"startedDateTime": "2023-12-04T16:43:22.400Z",
"time": -1,
"request": {
"method": "GET",
"url": "http://127.0.0.1:3000/api/get_dev_login/123456",
"httpVersion": "HTTP/1.1",
"cookies": [],
"headers": [
{ "name": "user-agent", "value": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.6099.28 Safari/537.36" },
{ "name": "accept", "value": "*/*" },
{ "name": "accept-encoding", "value": "gzip,deflate,br" },
{ "name": "cookie", "value": "connect.sid=s%3AZwwbh1O0l2yOuZFfDW4Os1Lhl7xg3sMq.%2B%2BsVN1Vd%2FikujBxcBTcXR%2FeHn8iHGI4Zpo90ej%2FUj00" }
],
"queryString": [],
"headersSize": -1,
"bodySize": -1
},
"response": {
"status": 302,
"statusText": "Found",
"httpVersion": "1.1",
"cookies": [],
"headers": [
{ "name": "x-powered-by", "value": "Express" },
{ "name": "location", "value": "/logged" },
{ "name": "vary", "value": "Accept" },
{ "name": "content-type", "value": "text/plain; charset=utf-8" },
{ "name": "content-length", "value": "29" },
{ "name": "set-cookie", "value": "connect.sid=s%3AZwwbh1O0l2yOuZFfDW4Os1Lhl7xg3sMq.%2B%2BsVN1Vd%2FikujBxcBTcXR%2FeHn8iHGI4Zpo90ej%2FUj00; Path=/; Expires=Tue, 05 Dec 2023 16:43:22 GMT; HttpOnly" },
{ "name": "date", "value": "Mon, 04 Dec 2023 16:43:22 GMT" },
{ "name": "connection", "value": "keep-alive" },
{ "name": "keep-alive", "value": "timeout=5" }
],
"content": {
"size": 0,
"mimeType": "text/plain; charset=utf-8"
},
"headersSize": -1,
"bodySize": -1,
"redirectURL": "/logged"
},
"cache": {},
"timings": { "send": -1, "wait": -1, "receive": -1 },
"_apiRequest": true
}
]
}
}
6 changes: 3 additions & 3 deletions web/frontend/tests/mocks.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
export const SCIPER_ADMIN = process.env.REACT_APP_SCIPER_ADMIN;
export const SCIPER_ADMIN = '123456';
export const SCIPER_USER = '789012';

export async function mockGetDevLogin (page: any) {
await page.routeFromHAR(
`./tests/hars/get_dev_login.admin.har`,
`./tests/hars/get_dev_login.${SCIPER_ADMIN}.har`,
{
url: `${process.env.FRONT_END_URL}/api/get_dev_login/${SCIPER_ADMIN}`,
update: false,
update: true,
});
await page.routeFromHAR(
`./tests/hars/get_dev_login.${SCIPER_USER}.har`,
Expand Down

0 comments on commit 42146a5

Please sign in to comment.