-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
cleanup data after and add env files
- Loading branch information
1 parent
7e961ba
commit 4adb0ce
Showing
20 changed files
with
118 additions
and
76 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
URL="https://automationintesting.online/" | ||
ADMIN_URL="https://automationintesting.online/#/admin" | ||
ADMIN_USERNAME="admin" | ||
ADMIN_PASSWORD="password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
URL="https://automationintesting.online/" | ||
ADMIN_URL="https://automationintesting.online/#/admin" | ||
ADMIN_USERNAME="admin" | ||
ADMIN_PASSWORD="password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
URL="https://automationintesting.online/" | ||
ADMIN_URL="https://automationintesting.online/#/admin" | ||
ADMIN_USERNAME="admin" | ||
ADMIN_PASSWORD="password" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,44 @@ | ||
import Env from "./env" | ||
import { request } from "@playwright/test"; | ||
import { GetRoomsOutput } from "./models/api/get-room-output"; | ||
|
||
|
||
async function deleteRoom(roomName:string) { | ||
let rooms=getRooms(); | ||
async function getRequestContext() { | ||
return await request.newContext({ | ||
baseURL: Env.URL, | ||
extraHTTPHeaders: { Accept: 'application/json', }, | ||
}); | ||
} | ||
|
||
async function getLoginToken() { | ||
const response = await (await getRequestContext()).post("auth/login", { | ||
data: { | ||
username: Env.ADMIN_USERNAME, | ||
password: Env.ADMIN_PASSWORD, | ||
}, | ||
}); | ||
|
||
async function getRooms() { | ||
|
||
} | ||
const headers = response.headers(); | ||
let tokenString = headers["set-cookie"].split(";")[0]; | ||
return tokenString.split("=")[1]; | ||
} | ||
|
||
export async function getRooms(): Promise<GetRoomsOutput> { | ||
const response = await (await getRequestContext()).get("room/", { | ||
headers: { | ||
cookie: `token=${await getLoginToken()}` | ||
}, | ||
}); | ||
return await response.json() as GetRoomsOutput; | ||
} | ||
|
||
export async function deleteRoom(roomName: number) { | ||
let roomsList = await getRooms(); | ||
let roomId = roomsList.rooms.filter(x => x.roomName == roomName)[0].roomid; | ||
|
||
const response = await (await getRequestContext()).delete(`room/${roomId}`, { | ||
headers: { | ||
cookie: `token=${await getLoginToken()}` | ||
}, | ||
}); | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default class Env { | ||
public static readonly URL = process.env.URL; | ||
public static readonly ADMIN_URL = process.env.ADMIN_URL; | ||
public static readonly ADMIN_USERNAME = process.env.ADMIN_USERNAME; | ||
public static readonly ADMIN_PASSWORD = process.env.ADMIN_PASSWORD; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
|
||
interface Room { | ||
roomid: number; | ||
roomName: number; | ||
type: string; | ||
accessible: boolean; | ||
image: string; | ||
description: string; | ||
features: string[]; | ||
roomPrice: number; | ||
} | ||
|
||
export interface GetRoomsOutput { | ||
rooms: Room[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,4 @@ | ||
enum RoomType | ||
{ | ||
enum RoomType { | ||
Single, | ||
Twin, | ||
Double, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
"@types/node": "^20.8.7" | ||
}, | ||
"dependencies": { | ||
"dotenv": "^16.3.1", | ||
"faker": "^6.6.6" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters