Coder Social home page Coder Social logo

mwinteringham / restful-booker-platform Goto Github PK

View Code? Open in Web Editor NEW
122.0 16.0 149.0 83.79 MB

A SaaS platform used for various test automation training

Home Page: http://www.automationintesting.com

License: GNU General Public License v3.0

JavaScript 30.07% HTML 0.28% Java 66.56% Shell 0.86% Batchfile 1.14% Dockerfile 0.46% SCSS 0.63%
automation-in-testing training automation automation-api automation-ui

restful-booker-platform's Introduction

restful-booker-platform

A platform of web services that forms a Bed and Breakfast booking system. The platforms primary purpose is for training others on how to explore and test web service platforms as well as strategise and implement automation in testing strategies.

Requirements

RBP is currently known to work with the following requirements:

  • JDK 18.0.2 or higher (Tested with JDK 18)
  • Maven 3.6.3
  • Node 20.9.0
  • NPM 10.1.0

Building locally

Assuming you have the above requirements in place, to get started open a terminal/command line window and follow these instructions:

  1. Clone/Download the repository
  2. Navigate into the restful-booker-platform root folder
  3. Run either bash build_locally.sh for Linux or Mac or build_locally.cmd on Windows to build RBP and get it running (It may take a while on the first run as it downloads dependencies)
  4. Navigate to http://localhost:8080 to access the site

Running locally

Assuming you have successfully built the application at least once, you can now run the app without having to rebuild the whole application.

Mac / Linux

  1. To run without end-to-end checks run: run_locally.sh
  2. To run with end-to-end checks run: run_locally.sh -e true

Windows

  1. To run without end-to-end checks run: run_locally.cmd
  2. To run with end-to-end checks run: run_locally.cmd true

Login

The user login details are:

  • Username: admin
  • Password: password

Development

API details

The details on running checks, building APIs and additional details on documentation for development can be found in READMEs inside each of the API folders.

Setting up your own CI/CD for this project

The build process for this project is managed by CircleCI which is all managed by the config.yml file in the .circleci folder. To get setup you will need to:

Running CI tests

Follow these steps to get a CI setup running the tests

  1. Fork this repository so that you have your own copy
  2. If you haven't already, create a CircleCI login using your GitHub details. This will connect CircleCI to your GitHub profile.
  3. Head to the Projects page in CircleCI, locate the RBP repository and click setup project.
  4. Go through the steps to for setting up the project, ensuring that it loads in the config.yml from the project (Click use existing config)

If you would like to setup CircleCI to run a full deployment, please drop an issue into the repository.

restful-booker-platform's People

Contributors

ardesco avatar dcoomber avatar dependabot[bot] avatar friendlytester avatar jvsanten avatar mwinteringham avatar ollyjshaw avatar testingchef avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

restful-booker-platform's Issues

9. User bookings

As a guest of the B&B
I want to be able to book a specific room on specific dates
So I can book online without having to contact the B&B directly

Features:

  • Guest can search for room availabilities based on date
  • If a room is available they can select the room and submit details to confirm booking

cannot run the app

Hi,

I've bee trying to use your platform for API Testing (exercise testing with Postman) and there are moments when this is not working.

When I do docker-compose build or docker compose up, I get this error

image

Can you help me with this? I'm a test apprentice at the test lab 2007 - eurostar and I'd like to prepare some API tests n your environment.

thank you

Research analytics in RBP

We want to be able to track users when they interact with the application using monitoring techniques

Move SQL seeding out of code

Currently, Hotel and Booking data is created in the code, which is a bit ugly. We should move the SQL out into a SQL file.

Room Type Dropdown

Turn the room type into a dropdown, provides more WebDriver examples, and potentially more JS interaction idea.

Initialisation fails when Timezone not set to UK timezones

Running the shell script will fail if the system's timezone is set to be outside the UK (eg, if you're from Ecuador)

The script will finish after erroring out, informing that the server's been successfully raised, but the app will be unavailable

5. Basic profit reports

As a B&B owner
I want to see how much each room is making
So I can quickly determine which is the most profitable room

Features:

  • All rooms are shown on a graph on X-axis
  • Y-axis will show the total of all the booking prices added to together

1. Store bookings

As a B&B owner
I want to be able to store bookings for a single room
So I can track bookings for the room

Features include:

  • Create bookings that contain:
    • First name
    • Last name
    • Price of booking
    • Deposit paid
    • Checkin date
    • Checkout date
  • Edit bookings
  • Delete bookings
  • Show bookings in list form

Improve end-to-end tests

End-to-end tests are needed to ensure paths are all correct between services and UI.

  • Update README to reflect how to switch between local and production runs
  • Work out how to trigger e2e locally as part of the test flow (requires app up and running)
  • Integrate e2e into CircleCI and with SauceLabs

Break dependency between Room and Booking

At the moment when a specific Room is requested Room calls Booking to get specific Bookings related to the Room. Room then returns a response with Room details and related Bookings.

We should decouple this and have the UI be responsible for making GETs to Room and then Bookings. It will clean up the models for both APIs and make report cleaner.

IP range for CORS is too restrictive

Multiple issues raised show that IP range for CORS is too restrictive and those not running off of Localhost have run into issues running the app.

8. Room availability reports

As a B&B owner
I want the ability to see available dates for a room
So I can quickly select see which dates are available for booking

Features:

  • Attempting to book a room during a date that is already booked will return an error
  • A calendar will show what rooms are booked on specific dates

6. User management

As a B&B owner
I want to be able to manage user access
So that I can allow different levels of access to multiple users

Features:

  • DB is configured with an Admin user
  • Guests are asked to create an account to make a booking
  • Admin can see the accounts created on the platform and can delete them

No handling for bookings in a deleted room

When you have an booking in a deleted room, when located via search the app fails to load. A GET to room/[room_id] returns a 500. An error of TypeError: Cannot read property 'toString' of undefined is thrown.

To reproduce:

  1. Login as the admin user
  2. Either create a room and a booking, then delete the room you created. Alternatively delete room 101 if the default database is currently being used.
  3. Using the search feature, search for the name used in the booking which will be visible and then click.

Result:
The above errors are thrown and the app fails to render.

Expected Result:
Either deleting a room should destroy all bookings, or bookings without rooms should error when accessed.

Abstract booking validator into it's own class

At the moment validation for bookings live both in the controller and the DB classes. We could do with making this cleaner and having a class that can be responsible for validation and simply spew out validation errors for the controller to handle.

Empty building report page

After I deleted all rooms and clicked on Report, building report page is stuck.I expect some notification or just Building report title to disappear.

screenshot_11

10. Hotel front page

As a guest of the B&B
I want to be able to view details on the B&B
So I can learn about the rooms offered and more about the B&B

Features:

  • Remove search features
  • Setup service that stores generic details of site
  • Extend room manager to have details on room and store image
  • Create front page that shows generic details of site and each of the rooms
  • Fix tests broken by navigation restructure

Fix run_locally.cmd to cleanly support visual checks

At the moment it's proving difficult to get the batch script to recognise if an API key for Applitools has been set and allow the visual checks to be run if the key exists. It's resulted in run_locally.cmd failing because it doesn't check the env var properly and triggers the visual checks with no API key set.

Batch scripting sucks...

11. Expand reporting features

As a B&B owner
I want to be able to see reports in the room pages
And I want to be able to see all rooms grouped by dates in the report page
So I can get visibility of both the occupation of an individual room and all rooms

Features:

  • Reports page retired in favour of an all bookings heatmap on the rooms page
  • All bookings heatmap allows you to hover over a date and see which specific rooms have been booked
  • Individual rooms show a heatmap for that specific room

Can duplicate room numbers

There is no uniqueness check on room numbers, and as a result rooms can be created with the same room number.

To Reproduce:

  1. Login as the admin
  2. Add a room with all valid options and a number of [SOMENUMBER]
  3. Add another room with all valid options and a number of [SOMENUMBER]

Result:
Room created

Expected Result:
Should error and enforce room# uniqueness

2. Manage multiple rooms

As a B&B owner
I want to be able to manage multiple rooms and their bookings
So that I can track bookings across multiple rooms

Features include:

  • Create room that contains:
    • Room number
    • Room type (Single, Twin, Family, Suite)
    • Number of beds
    • Room details
    • Whether the room is accessible to people with special needs
  • Edit room details
  • Delete rooms
  • Assign bookings to a specific room

Update of booking data leads to deletion of name and price entry

Steps to reproduce:

  • enter a booking (name, price etc.), press create button
  • update this booking, e.g. extend the booking by one day

Actual result:
With the update, first name and family name are deleted. Price is set to 0.

Expected result:
The values should not be updated since the user did not change them.

Make timezone checks less sensitive to local timezones

Environment:

OS: Mac OSX Mojave
JVM: Java 8
Node: 8.14.0
JVM_HOME: Set

I tried running the tests two different ways.
1.) Via run_locally.sh
2.) Via mvn clean test

Expected Results:
Tests Pass and I can deploy the application

Actual Results:

This is the log when running with -X flag.

[INFO]
[INFO] Results:
[INFO]
[ERROR] Errors:
[ERROR]   BuildReportTest.testGettingBookingsSearchResults:49 »  Failed Approval
  Appro...
[INFO]
[ERROR] Tests run: 3, Failures: 0, Errors: 1, Skipped: 0
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for restful-booker-platform 1.0-SNAPSHOT:
[INFO]
[INFO] restful-booker-platform-auth ....................... SUCCESS [01:39 min]
[INFO] restful-booker-platform-booking .................... SUCCESS [ 34.396 s]
[INFO] restful-booker-platform-room ....................... SUCCESS [01:03 min]
[INFO] restful-booker-platform-search ..................... SUCCESS [  0.842 s]
[INFO] restful-booker-platform-report ..................... FAILURE [  4.139 s]
[INFO] restful-booker-platform-ui ......................... SKIPPED
[INFO] restful-booker-platform ............................ SKIPPED
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  03:22 min
[INFO] Finished at: 2018-12-13T15:42:37-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project restful-booker-platform-report: There are test failures.
[ERROR]
[ERROR] Please refer to /Users/silne30/Desktop/selenium-article/restful-booker-platform/report/target/surefire-reports for the individual test results.
[ERROR] Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
[ERROR] -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.apache.maven.plugins:maven-surefire-plugin:2.22.0:test (default-test) on project restful-booker-platform-report: There are test failures.

Please refer to /Users/silne30/Desktop/selenium-article/restful-booker-platform/report/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:215)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
Caused by: org.apache.maven.plugin.MojoFailureException: There are test failures.

Please refer to /Users/silne30/Desktop/selenium-article/restful-booker-platform/report/target/surefire-reports for the individual test results.
Please refer to dump files (if any exist) [date]-jvmRun[N].dump, [date].dumpstream and [date]-jvmRun[N].dumpstream.
    at org.apache.maven.plugin.surefire.SurefireHelper.throwException (SurefireHelper.java:240)
    at org.apache.maven.plugin.surefire.SurefireHelper.reportExecution (SurefireHelper.java:112)
    at org.apache.maven.plugin.surefire.SurefirePlugin.handleSummary (SurefirePlugin.java:364)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.executeAfterPreconditionsChecked (AbstractSurefireMojo.java:1052)
    at org.apache.maven.plugin.surefire.AbstractSurefireMojo.execute (AbstractSurefireMojo.java:868)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:498)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:289)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:229)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:415)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:356)
[ERROR]
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
[ERROR]
[ERROR] After correcting the problems, you can resume the build with the command

Type - bed relation

Type can only contain the room options Single, Twin, Family, Suite. There must be a correlation between Type and number of beds.

screenshot_1

User can't login with enter

When I type username "admin" and password "password" I can log in only with "Login" button on front page. I want to be logged in with "Enter" key on the keyboard.

screenshot_1

First name and Last name accept numbers as valid names

Currently if I provide a single number char for either of first name and last name, the system accepts as valid name.

It should validate at least that the name should not start with numbers and should be at least more than 1 character.

Check in and checkout dates are not validated

When I provide checkout date which is before checkin date, it will accept me happily.

But I expected the system to validate the the checkout date always should be greater than or equal to the check in date.

I could not login to the site

I could not login to the site, what use name and password should I use?
I used admin & password, admin without password. Neither worked.

3. Provide authentication to access content

As a B&B owner
I want to have to provide a username and password
So that I can prevent unauthorised access to my bookings

Features:

  • User has to provide a username and password to login
  • Incorrect logins return an error
  • Correct logins provide a token that is used to authorise future requests

4. Search for bookings

As a B&B owner
I want to be able to search for bookings
So that I can easily retrieve specific bookings

Features:

  • User can search for booking based on Firstname or Lastname

Setup production environment with continuous deployment

AiT want to offer a place where students can practise test automation techniques. So we're going to create a continuously deployable environment of RBP for students to practise against.

  • Setup CircleCI to run tests, build images and then deploy image
  • Create Docker images and storage location
  • Timer to reset DBs
  • Welcome messages to get started with RBP

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.