Skip to content

Vere-Grey/Vere-automation-exhibition

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Cypress Real World App Logo Cypress Real World App Logo

A payment application to demonstrate real-world test automation.

Cypress Real World App

💬 Note from maintainers

This application is purely for demonstration and educational purposes. Its setup and configuration resemble typical real-world applications, but it's not a full-fledged production system. My aim is to further develop my knowledge of automation testing frameworks and have this repo as example for my future interview.

I, Martin Vere Cihlar, have not created this application. It originates from this repo


Features

🛠 Built with React, XState, Express, lowdb, Material-UI and TypeScript ⚡️ Zero database dependencies 🚀 Full-stack Express/React application with real-world features and tests 👮‍♂️ Local Authentication 🔥 Database Seeding with End-to-end Tests

Getting Started

The Cypress Real-World App (RWA) is a full-stack Express/React application backed by a local JSON database (lowdb).

The app is bundled with example data (data/database.json) that contains everything you need to start using the app and run tests out-of-the-box.

🚩 Note

You can login to the app with any of the example app users. The default password for all users is s3cret. Example users can be seen by running yarn list:dev:users.

Prerequisites

This project requires Node.js to be installed on your machine. Refer to the .node-version file for the exact version.

Yarn Classic is also required. Once you have Node.js installed, execute the following to install the npm module yarn (Classic - version 1) globally.

npm install yarn@latest -g

If you have Node.js' experimental Corepack feature enabled, then you should skip the step npm install yarn@latest -g to install Yarn Classic globally. The RWA project is locally configured for Corepack to use Yarn Classic (version 1).

Yarn Modern

This project is not compatible with Yarn Modern (version 2 and later).

Installation

To clone the repo to your local system and install dependencies, execute the following commands:

git clone https://github.com/cypress-io/cypress-realworld-app
cd cypress-realworld-app
yarn

Mac users with M-series chips will need to prepend PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true.

PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true yarn install

Run the app

yarn dev

🚩 Note

The app will run on port 3000 (frontend) and 3001 (API backend) by default. Please make sure there are no other applications or services running on both ports. If you want to change the default ports, you can do so by modifying PORT and VITE_BACKEND_PORT variables in .env file. However, make sure the modified port numbers in .env are not committed into Git since the CI environments still expect the application to run on the default ports.

Database

  • The local JSON database is located in data/database.json and is managed with lowdb.

  • The database is reseeded each time the application is started (via yarn dev). Database seeding is done in between each Cypress End-to-End test.

  • Updates via the React frontend are sent to the Express server and handled by a set of database utilities

  • Generate a new database using yarn db:seed.

  • An empty database seed is provided along with a script (yarn start:empty) to view the application without data.

Additional NPM Scripts

| Script | Description | | -------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --- | | dev | Starts backend in watch mode and frontend | | | dev:auth0 | Starts backend in watch mode and frontend; Uses Auth0 for Authentication > Read Guide | | dev:okta | Starts backend in watch mode and frontend; Uses Okta for Authentication > Read Guide | | dev:cognito | Starts backend in watch mode and frontend; Uses Cognito for Authentication > Read Guide | | dev:google | Starts backend in watch mode and frontend; Uses Google for Authentication > Read Guide | | start | Starts backend and frontend | | types | Validates types | | db:seed | Generates fresh database seeds for json files in /data | | start:empty | Starts backend, frontend with empty database seed | | tsnode | Customized ts-node command to get around react-scripts restrictions | | list:dev:users | Provides id and username for users in the dev database |

For a complete list of scripts see package.json

3rd Party Authentication Providers

Support for 3rd party authentication is available in the application to demonstrate the concepts on logging in with a 3rd party provider.

The app contains different entry points for each provider. There is a separate index file for each provider, and to use one, you must replace the current index.tsx file with the desired one. The following providers are supported:

License

license

This project is licensed under the terms of the MIT license.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages