Skip to content

Commit

Permalink
resolve conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
Prashant Bellad committed Jan 16, 2024
1 parent 1578e63 commit fc058b7
Show file tree
Hide file tree
Showing 40 changed files with 13,355 additions and 0 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
on: [push]
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Cypress run
uses: cypress-io/github-action@v1
with:
record: true
start: yarn test:e2e:ci
wait-on: "http://localhost:3000"
env:
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
27 changes: 27 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.

# dependencies
/node_modules
/.pnp
.pnp.js

# testing
/coverage

# production
/build

# misc
.DS_Store
.env*
.env.local
.env.development.local
.env.test.local
.env.production.local

npm-debug.log*
yarn-debug.log*
yarn-error.log*

cypress/videos
cypress/screenshots
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"typescript.tsdk": "node_modules/typescript/lib"
}
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,9 @@
# cypress-real-world

Cypress Real World app to teach Cypress

# Pay App

[![CircleCI](https://circleci.com/gh/cypress-io/rwa-react.svg?style=svg)](https://circleci.com/gh/cypress-io/rwa-react)

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
4 changes: 4 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"baseUrl": "http://localhost:3000",
"projectId": "kdvy9a"
}
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
26 changes: 26 additions & 0 deletions cypress/integration/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// type definitions for Cypress object "cy"
/// <reference types="cypress" />

// check this file using TypeScript if available
// @ts-check

describe("App", function() {
beforeEach(function() {
cy.task("db:reset");
cy.task("db:seed");
cy.visit("/");
});

it("renders the app", function() {
cy.get("#root").should("contain", "PayMeNow");
});

it("renders transaction list", function() {
/*cy.request("GET", "http://localhost:3001/transactions").then(response => {
expect(response.body[0]).to.have.property("id");
});*/
cy.get("[data-cy='transaction-list']")
.children()
.should("have.length", 10);
});
});
50 changes: 50 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************

// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
const { readFile } = require("fs").promises;
const path = require("path");
const low = require("lowdb");
const FileSync = require("lowdb/adapters/FileSync");

let adapter = new FileSync(
path.join(__dirname, "../../src/data/database.test.json")
);
let db = low(adapter);

const defaultStructure = {
transactions: [],
stooges: []
};

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
on("task", {
"db:seed"() {
// seed database with test data
return readFile(
path.join(__dirname, "../../src/data/test-seed.json"),
"utf-8"
).then(data => {
db.setState(JSON.parse(data)).write();
console.log("test data seeded into test database");
return null;
});
},
"db:reset"() {
// reset database to empty status
db.setState(defaultStructure).write();
console.log("test database reset");
return null;
}
});
};
25 changes: 25 additions & 0 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// ***********************************************
// This example commands.js shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add("login", (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add("drag", { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add("dismiss", { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
20 changes: 20 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
75 changes: 75 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
{
"name": "pay-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"@material-ui/core": "^4.8.3",
"@types/dotenv": "^8.2.0",
"@types/express-session": "^1.15.16",
"@types/jest": "24.0.24",
"@types/json-server": "^0.14.2",
"@types/lowdb": "^1.0.9",
"@types/node": "12.12.24",
"@types/passport": "^1.0.2",
"@types/react": "16.9.17",
"@types/react-dom": "16.9.4",
"@types/react-redux": "7.1.5",
"@types/react-router": "5.1.3",
"@types/react-router-dom": "5.1.3",
"@types/webpack-env": "1.15.0",
"axios": "0.19.0",
"dotenv": "^8.2.0",
"express-session": "^1.17.0",
"json-server": "0.15.1",
"passport": "^0.4.1",
"passport-local": "^1.0.0",
"react": "16.12.0",
"react-dom": "16.12.0",
"react-redux": "7.1.3",
"react-router": "5.1.2",
"react-router-dom": "5.1.2",
"react-scripts": "3.3.0",
"redux": "4.0.5",
"redux-devtools-extension": "2.13.8",
"redux-logger": "3.0.6",
"redux-logic": "2.1.1",
"ts-node": "^8.5.4",
"typescript": "3.7.4"
},
"devDependencies": {
"cypress": "3.8.1",
"start-server-and-test": "1.10.6"
},
"scripts": {
"db:seed:dev": "cp src/data/dev-seed.json src/data/database.json",
"db:seed:test": "cp src/data/test-seed.json src/data/database.test.json",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"cypress:run:record": "cypress run --record",
"prestart:dev": "yarn db:seed:dev",
"start": "react-scripts start",
"start:dev": "NODE_ENV=development yarn start:api & yarn start",
"start:api": "ts-node src/api.ts",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject",
"start:server-and-api": "start-test start:api 3001 start",
"test:e2e": "NODE_ENV=test start-test start:server-and-api 3000 cypress:run",
"test:e2e:ci": "NODE_ENV=test yarn start:server-and-api"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
Binary file added public/favicon.ico
Binary file not shown.
43 changes: 43 additions & 0 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<link rel="icon" href="%PUBLIC_URL%/favicon.ico" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="theme-color" content="#000000" />
<meta
name="description"
content="Web site created using create-react-app"
/>
<link rel="apple-touch-icon" href="logo192.png" />
<!--
manifest.json provides metadata used when your web app is installed on a
user's mobile device or desktop. See https://developers.google.com/web/fundamentals/web-app-manifest/
-->
<link rel="manifest" href="%PUBLIC_URL%/manifest.json" />
<!--
Notice the use of %PUBLIC_URL% in the tags above.
It will be replaced with the URL of the `public` folder during the build.
Only files inside the `public` folder can be referenced from the HTML.
Unlike "/favicon.ico" or "favicon.ico", "%PUBLIC_URL%/favicon.ico" will
work correctly both with client-side routing and a non-root public URL.
Learn how to configure a non-root public URL by running `npm run build`.
-->
<title>React App</title>
</head>
<body>
<noscript>You need to enable JavaScript to run this app.</noscript>
<div id="root"></div>
<!--
This HTML file is a template.
If you open it directly in the browser, you will see an empty page.
You can add webfonts, meta tags, or analytics to this file.
The build step will place the bundled scripts into the <body> tag.
To begin the development, run `npm start` or `yarn start`.
To create a production bundle, use `npm run build` or `yarn build`.
-->
</body>
</html>
Binary file added public/logo192.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/logo512.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
25 changes: 25 additions & 0 deletions public/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{
"short_name": "React App",
"name": "Create React App Sample",
"icons": [
{
"src": "favicon.ico",
"sizes": "64x64 32x32 24x24 16x16",
"type": "image/x-icon"
},
{
"src": "logo192.png",
"type": "image/png",
"sizes": "192x192"
},
{
"src": "logo512.png",
"type": "image/png",
"sizes": "512x512"
}
],
"start_url": ".",
"display": "standalone",
"theme_color": "#000000",
"background_color": "#ffffff"
}
2 changes: 2 additions & 0 deletions public/robots.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# https://www.robotstxt.org/robotstxt.html
User-agent: *
20 changes: 20 additions & 0 deletions renovate.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
{
"extends": ["config:base"],
"automerge": true,
"commitMessage": "{{semanticPrefix}}Update {{depName}} to {{newVersion}} 🌟",
"prTitle": "{{semanticPrefix}}{{#if isPin}}Pin{{else}}Update{{/if}} dependency {{depName}} to version {{#if isRange}}{{newVersion}}{{else}}{{#if isMajor}}{{newVersionMajor}}.x{{else}}{{newVersion}}{{/if}}{{/if}} 🌟",
"major": {
"automerge": false
},
"minor": {
"automerge": false
},
"prHourlyLimit": 1,
"updateNotScheduled": false,
"timezone": "America/New_York",
"schedule": ["after 10pm", "before 6am"],
"lockFileMaintenance": {
"enabled": true
},
"masterIssue": true
}
Loading

0 comments on commit fc058b7

Please sign in to comment.