working
This commit is contained in:
parent
c0999370c6
commit
4e1a339432
17 changed files with 393 additions and 91 deletions
|
|
@ -1,6 +1,7 @@
|
|||
import { test, expect, Page } from "@playwright/test";
|
||||
import { getTomorrowDateStr } from "./helpers/date";
|
||||
import { API_URL, REGULAR_USER, ADMIN_USER, clearAuth, loginUser } from "./helpers/auth";
|
||||
import { REGULAR_USER, ADMIN_USER, clearAuth, loginUser } from "./helpers/auth";
|
||||
import { getBackendUrl } from "./helpers/backend-url";
|
||||
|
||||
/**
|
||||
* Exchange Page E2E Tests
|
||||
|
|
@ -17,7 +18,7 @@ async function setAvailability(page: Page, dateStr: string) {
|
|||
throw new Error("No auth cookie found when trying to set availability");
|
||||
}
|
||||
|
||||
const response = await page.request.put(`${API_URL}/api/admin/availability`, {
|
||||
const response = await page.request.put(`${getBackendUrl()}/api/admin/availability`, {
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
"Content-Type": "application/json",
|
||||
|
|
@ -287,7 +288,7 @@ test.describe("Exchange API", () => {
|
|||
let authCookie = cookies.find((c) => c.name === "auth_token");
|
||||
|
||||
if (authCookie) {
|
||||
const priceResponse = await request.get(`${API_URL}/api/exchange/price`, {
|
||||
const priceResponse = await request.get(`${getBackendUrl()}/api/exchange/price`, {
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
},
|
||||
|
|
@ -299,7 +300,7 @@ test.describe("Exchange API", () => {
|
|||
expect(priceData.config.eur_max).toBeDefined();
|
||||
|
||||
// Test regular user can get trades
|
||||
const tradesResponse = await request.get(`${API_URL}/api/trades`, {
|
||||
const tradesResponse = await request.get(`${getBackendUrl()}/api/trades`, {
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
},
|
||||
|
|
@ -316,7 +317,7 @@ test.describe("Exchange API", () => {
|
|||
authCookie = cookies.find((c) => c.name === "auth_token");
|
||||
|
||||
if (authCookie) {
|
||||
const adminPriceResponse = await request.get(`${API_URL}/api/exchange/price`, {
|
||||
const adminPriceResponse = await request.get(`${getBackendUrl()}/api/exchange/price`, {
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
},
|
||||
|
|
@ -324,11 +325,14 @@ test.describe("Exchange API", () => {
|
|||
expect(adminPriceResponse.status()).toBe(403);
|
||||
|
||||
// Test admin can get upcoming trades
|
||||
const adminTradesResponse = await request.get(`${API_URL}/api/admin/trades/upcoming`, {
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
},
|
||||
});
|
||||
const adminTradesResponse = await request.get(
|
||||
`${getBackendUrl()}/api/admin/trades/upcoming`,
|
||||
{
|
||||
headers: {
|
||||
Cookie: `auth_token=${authCookie.value}`,
|
||||
},
|
||||
}
|
||||
);
|
||||
expect(adminTradesResponse.status()).toBe(200);
|
||||
const adminTradesData = await adminTradesResponse.json();
|
||||
expect(Array.isArray(adminTradesData)).toBe(true);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue