Commit 0739f5d7 authored by Miroslav Vranka's avatar Miroslav Vranka
Browse files

Merge branch 'sorry-cypress' into 'master'

sorry-cypress extension

See merge request !10
parents 64f5bb97 ac4a590e
Pipeline #12495 passed with stages
in 4 minutes and 13 seconds
# ![React + Redux Example App](project-logo.png)
[![RealWorld Frontend](https://img.shields.io/badge/realworld-frontend-%23783578.svg)](http://realworld.io)
> ### React + Redux codebase containing real world examples (CRUD, auth, advanced patterns, etc) that adheres to the [RealWorld](https://github.com/gothinkster/realworld-example-apps) spec and API.
<a href="https://stackblitz.com/edit/react-redux-realworld" target="_blank"><img width="187" src="https://github.com/gothinkster/realworld/blob/master/media/edit_on_blitz.png?raw=true" /></a>&nbsp;&nbsp;<a href="https://thinkster.io/tutorials/build-a-real-world-react-redux-application" target="_blank"><img width="384" src="https://raw.githubusercontent.com/gothinkster/realworld/master/media/learn-btn-hr.png" /></a>
### [Demo](https://react-redux.realworld.io)&nbsp;&nbsp;&nbsp;&nbsp;[RealWorld](https://github.com/gothinkster/realworld)
Originally created for this [GH issue](https://github.com/reactjs/redux/issues/1353). The codebase is now feature complete; please submit bug fixes via pull requests & feedback via issues.
We also have notes in [**our wiki**](https://github.com/gothinkster/react-redux-realworld-example-app/wiki) about how the various patterns used in this codebase and how they work (thanks [@thejmazz](https://github.com/thejmazz)!)
## Getting started
You can view a live demo over at https://react-redux.realworld.io/
To get the frontend running locally:
- Clone this repo
- `npm install` to install all req'd dependencies
- `npm start` to start the local server (this project uses create-react-app)
Local web server will use port 4100 instead of standard React's port 3000 to prevent conflicts with some backends like Node or Rails. You can configure port in scripts section of `package.json`: we use [cross-env](https://github.com/kentcdodds/cross-env) to set environment variable PORT for React scripts, this is Windows-compatible way of setting environment variables.
Alternatively, you can add `.env` file in the root folder of project to set environment variables (use PORT to change webserver's port). This file will be ignored by git, so it is suitable for API keys and other sensitive stuff. Refer to [dotenv](https://github.com/motdotla/dotenv) and [React](https://github.com/facebookincubator/create-react-app/blob/master/packages/react-scripts/template/README.md#adding-development-environment-variables-in-env) documentation for more details. Also, please remove setting variable via script section of `package.json` - `dotenv` never override variables if they are already set.
### Making requests to the backend API
For convenience, we have a live API server running at https://conduit.productionready.io/api for the application to make requests against. You can view [the API spec here](https://github.com/GoThinkster/productionready/blob/master/api) which contains all routes & responses for the server.
The source code for the backend server (available for Node, Rails and Django) can be found in the [main RealWorld repo](https://github.com/gothinkster/realworld).
If you want to change the API URL to a local server, simply edit `src/agent.js` and change `API_ROOT` to the local server's URL (i.e. `http://localhost:3000/api`)
## Functionality overview
The example application is a social blogging site (i.e. a Medium.com clone) called "Conduit". It uses a custom API for all requests, including authentication. You can view a live demo over at https://redux.productionready.io/
**General functionality:**
- Authenticate users via JWT (login/signup pages + logout button on settings page)
- CRU* users (sign up & settings page - no deleting required)
- CRUD Articles
- CR*D Comments on articles (no updating required)
- GET and display paginated lists of articles
- Favorite articles
- Follow other users
**The general page breakdown looks like this:**
- Home page (URL: /#/ )
- List of tags
- List of articles pulled from either Feed, Global, or by Tag
- Pagination for list of articles
- Sign in/Sign up pages (URL: /#/login, /#/register )
- Use JWT (store the token in localStorage)
- Settings page (URL: /#/settings )
- Editor page to create/edit articles (URL: /#/editor, /#/editor/article-slug-here )
- Article page (URL: /#/article/article-slug-here )
- Delete article button (only shown to article's author)
- Render markdown from server client side
- Comments section at bottom of page
- Delete comment button (only shown to comment's author)
- Profile page (URL: /#/@username, /#/@username/favorites )
- Show basic user info
- List of articles populated from author's created articles or author's favorited articles
<br />
[![Brought to you by Thinkster](https://raw.githubusercontent.com/gothinkster/realworld/master/media/end.png)](https://thinkster.io)
**Sorry cypress integration**
- Run sorry-cypress dashboard locally:
- docker-compose -f docker-compose.minio.yml up
- For execution parallel tests run command:
- cypress run --record --key cypress_demo --parallel --ci-build-id $CI_CONCURRENT_ID
- For integration with some cloud platform follow https://sorry-cypress.dev/
- Remove html reports storing from .gitlab-ci.yml and set cypress.json file according:
- https://github.com/sorry-cypress/sorry-cypress/blob/master/example/cypress.json
......@@ -16,6 +16,7 @@
"pageLoadTimeout": 120000,
"requestTimeout": 10000,
"responseTimeout": 60000,
"projectId": "cypress_demo",
"env": {
"apiUrl": "https://conduit.productionready.io/api",
"user": {
......
/**
* @type {Cypress.PluginConfig}
*/
// import {randomString} from "../support/helpers";
module.exports = (on, config) => {
require('@cypress/code-coverage/task')(on, config)
return config
}
\ No newline at end of file
}
......@@ -18,6 +18,11 @@ import './commands'
import '@cypress/code-coverage/support'
import '@testing-library/cypress/add-commands';
import {configure} from '@testing-library/cypress'
import {randomString} from "./helpers";
configure({testIdAttribute: 'data-testid'})
before(() => {
cy.log('Test Suite Started')
const token ='sefasefsaf'
cy.exec(`export CI_TOKEN=${token}`)
})
version: '3.6'
services:
mongo:
image: mongo:4.0
director:
image: agoldis/sorry-cypress-director:latest
environment:
DASHBOARD_URL: cypress-inventi-dashboard.herokuapp.com/
MONGODB_URI: 'mongodb://mongo:27017'
MONGODB_DATABASE: 'cypress-db'
EXECUTION_DRIVER: '../execution/mongo/driver'
SCREENSHOTS_DRIVER: '../screenshots/s3.driver'
AWS_ACCESS_KEY_ID: 'key'
AWS_SECRET_ACCESS_KEY: 'secret'
S3_BUCKET: cypress-inventi-dashboard
ports:
- 1234:1234
depends_on:
- mongo
api:
image: agoldis/sorry-cypress-api:latest
environment:
MONGODB_URI: 'mongodb://mongo:27017'
MONGODB_DATABASE: 'sorry-cypress'
ports:
- 4000:4000
depends_on:
- mongo
dashboard:
image: agoldis/sorry-cypress-dashboard:latest
environment:
GRAPHQL_SCHEMA_URL: http://localhost:4000
ports:
- 8080:8080
depends_on:
- mongo
- api
version: '3.6'
services:
mongo:
image: mongo:4.0
storage:
image: minio/minio
hostname: 'storage'
environment:
MINIO_ACCESS_KEY: 'MW32h3gd6HvjBEgTRx'
MINIO_SECRET_KEY: 't6NgQWUcEyG2AzaDCVkN6sbWcvDCVkN6sGiZ7'
volumes:
- ./data/data-minio-cypress:/data
command: server /data
ports:
- 9000:9000
createbuckets:
image: minio/mc
depends_on:
- storage
entrypoint: >
/bin/sh -c "
sleep 3;
/usr/bin/mc config host add myminio http://storage:9000 MW32h3gd6HvjBEgTRx t6NgQWUcEyG2AzaDCVkN6sbWcvDCVkN6sGiZ7;
/usr/bin/mc rm -r --dangerous --force myminio/sorry-cypress;
/usr/bin/mc mb myminio/sorry-cypress;
/usr/bin/mc policy set download myminio/sorry-cypress;
/usr/bin/mc policy set public myminio/sorry-cypress;
exit 0;
"
director:
image: agoldis/sorry-cypress-director:latest
links:
- 'storage:storage'
environment:
DASHBOARD_URL: http://localhost:8080
EXECUTION_DRIVER: '../execution/mongo/driver'
MONGODB_URI: 'mongodb://mongo:27017'
MONGODB_DATABASE: 'sorry-cypress'
SCREENSHOTS_DRIVER: '../screenshots/minio.driver'
MINIO_ACCESS_KEY: 'MW32h3gd6HvjBEgTRx'
MINIO_SECRET_KEY: 't6NgQWUcEyG2AzaDCVkN6sbWcvDCVkN6sGiZ7'
MINIO_ENDPOINT: 'storage'
MINIO_URL: 'http://localhost'
MINIO_PORT: '9000'
MINIO_USESSL: 'false'
MINIO_BUCKET: sorry-cypress
ports:
- 1234:1234
depends_on:
- mongo
- storage
api:
image: agoldis/sorry-cypress-api:latest
environment:
MONGODB_URI: 'mongodb://mongo:27017'
MONGODB_DATABASE: 'sorry-cypress'
ports:
- 4000:4000
depends_on:
- mongo
dashboard:
image: agoldis/sorry-cypress-dashboard:latest
environment:
GRAPHQL_SCHEMA_URL: http://localhost:4000
ports:
- 8080:8080
depends_on:
- mongo
- api
{
"name": "react-redux-realworld-example-app",
"name": "cypress-demo",
"version": "0.1.0",
"private": true,
"devDependencies": {
......@@ -43,6 +43,7 @@
"cypress:open": "cypress open",
"cy:run": "node cypress_runner -b chrome -m headless -s 'cypress/tests/**/*.spec.ts'",
"cy:run:mobile": "node cypress_runner -b chrome -m headed --config viewportWidth=375,viewportHeight=667 -s 'cypress/tests/**/*.spec.ts'",
"cy:parallel:run": "cypress run --record --key cypress_demo --parallel --ci-build-id $CI_CONCURRENT_ID",
"cy:verify": "cypress verify",
"cy:info": "cypress info",
"cy:version": "cypress version",
......
No preview for this file type
......@@ -16,7 +16,7 @@
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>Conduit</title>
<title>Example Inventi App</title>
</head>
<body>
<div id="root"></div>
......
{
"reporterEnabled": "mochawesome",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports/mocha",
"quiet": true,
"overwrite": false,
"html": false,
"json": true
}
}
\ No newline at end of file
"reporterEnabled": "mochawesome",
"mochawesomeReporterOptions": {
"reportDir": "cypress/reports/mocha",
"quiet": true,
"overwrite": false,
"html": false,
"json": true
}
}
......@@ -57,7 +57,7 @@ const ArticlePreview = props => {
</div>
<Link to={`/article/${article.slug}`} className="preview-link">
<h1>{article.title}</h1>
<h1 data-testid={`TEST_ARTICLE`}>{article.title}</h1>
<p>{article.description}</p>
<span>Read more...</span>
<ul className="tag-list">
......
......@@ -75,7 +75,7 @@ class Header extends React.Component {
<nav className="navbar navbar-light">
<div className="container">
<Link to="/" className="navbar-brand">
<Link to="/" className="navbar-brand" data-testid={`TEST_HOME_BTN`}>
{this.props.appName.toLowerCase()}
</Link>
......
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress"],
"baseUrl": ".",
"esModuleInterop": true
},
"include": [
"**/*.ts"
]
}
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment