Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add cypress framework and visit tests #4078

Merged
merged 5 commits into from
Apr 4, 2019
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
3 changes: 3 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ load_initial_data: ## Load initial development fixtures.
logs: ## Print and actively tail the docker compose logs.
@docker-compose logs -f

cypress: ## Open cypress testing UI
@npx cypress open

pytest: ## Run pytest (Backend)
@docker-compose exec -e DJANGO_SETTINGS_MODULE="app.settings" web pytest -p no:ethereum

Expand Down
1 change: 1 addition & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{}
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": "[email protected]",
"body": "Fixtures are a great way to mock data for responses to routes"
}
51 changes: 51 additions & 0 deletions cypress/integration/test_visit.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// TODO: commented out tests require github login support

describe('Visit Tests', function() {
it('Visits the Explorer', function() {
cy.visit('http://localhost:8000/explorer');
});
it('Visits the Grants Page', function() {
cy.visit('http://localhost:8000/grants');
});
it('Visits the Landing Page', function() {
cy.visit('http://localhost:8000/');
});
it('Visits the Kudos Page', function() {
cy.visit('http://localhost:8000/kudos');
});
it('Visits the Kudos Marketplace', function() {
cy.visit('http://localhost:8000/kudos/marketplace');
});
/*
it('Visits the Kudos Sender', function() {
cy.visit('http://localhost:8000/kudos/send');
cy.url().should('contain', 'github.com');
});
*/
it('Visits the Labs Page', function() {
cy.visit('http://localhost:8000/explorer');
});
it('Visits the About Page', function() {
cy.visit('http://localhost:8000/about');
});
it('Visits the Mission Page', function() {
cy.visit('http://localhost:8000/mission');
});
/*
it('Visits the Results Page', function() {
cy.visit('http://localhost:8000/results');
});
*/
it('Visits the Activity Page', function() {
cy.visit('http://localhost:8000/activity');
});
it('Visits the Help Page', function() {
cy.visit('http://localhost:8000/help');
});
it('Visits the Terms of Service Page', function() {
cy.visit('http://localhost:8000/legal/terms');
});
it('Visits the Privacy Page', function() {
cy.visit('http://localhost:8000/legal/privacy');
});
});
17 changes: 17 additions & 0 deletions cypress/plugins/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// ***********************************************************
// 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)

module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
};
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 is will overwrite an existing command --
// Cypress.Commands.overwrite("visit", (originalFn, url, options) => { ... })
26 changes: 26 additions & 0 deletions cypress/support/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// ***********************************************************
// 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')

Cypress.on('uncaught:exception', (err, runnable) => {
// returning false here prevents Cypress from
// failing the test
return false;
});
6 changes: 6 additions & 0 deletions docs/RUNNING_LOCALLY_DOCKER.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ make tests # docker-compose exec -e DJANGO_SETTINGS_MODULE=app.settings web pyte

The above make command will run `eslint` and `pytest`.

You can also run the Cypress regression tests by opening the Cypress UI by running:

```shell
make cypress
```

#### Fresh rebuild

`Q: My environment is erroring out due to missing modules/packages or postgresql errors. How can I fix it?`
Expand Down
Loading