Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions tests/01_post_static_data.spec.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// @ts-check
const { test, expect } = require('@playwright/test');

//test case 1
test('should be able to create a booking', async ({ request }) => {
const response = await request.post(`/booking`, {
data: {
Expand Down
2 changes: 1 addition & 1 deletion tests/02_post_static_json_data.spec.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// @ts-check
const { test, expect } = require('@playwright/test');
const bookingDetails = require('../test-data/booking-details.json');

//testcase 2
test('should be able to create a booking', async ({ request }) => {
const response = await request.post(`/booking`, {
data: bookingDetails
Expand Down
14 changes: 7 additions & 7 deletions tests/03_post_dynamic_data.spec.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
// @ts-check
const { test, expect } = require('@playwright/test');
import { faker } from '@faker-js/faker';
const { DateTime } = require("luxon");
// const { DateTime } = require("luxon");

const randomFirstName = faker.name.firstName()
const randomLastName = faker.name.lastName()
const randomNumber = faker.random.numeric(4)
const currentDate = DateTime.now().toFormat('yyyy-MM-dd')
const currentDatePlusFive = DateTime.now().plus({ days: 5 }).toFormat('yyyy-MM-dd')
// const currentDate = DateTime.now().toFormat('yyyy-MM-dd')
// const currentDatePlusFive = DateTime.now().plus({ days: 5 }).toFormat('yyyy-MM-dd')

test('should be able to create a booking', async ({ request }) => {
const response = await request.post(`/booking`, {
Expand All @@ -16,10 +16,10 @@ test('should be able to create a booking', async ({ request }) => {
"lastname": randomLastName,
"totalprice": randomNumber,
"depositpaid": true,
"bookingdates": {
"checkin": currentDate,
"checkout": currentDatePlusFive
},
// "bookingdates": {
// "checkin": currentDate,
// "checkout": currentDatePlusFive
// },
"additionalneeds": "Breakfast"
}
});
Expand Down