Skip to content

Commit

Permalink
Puppeteer changed to cypress 4 e2e
Browse files Browse the repository at this point in the history
  • Loading branch information
Uzwername committed Sep 9, 2019
1 parent 91a934c commit 38d17bc
Show file tree
Hide file tree
Showing 15 changed files with 965 additions and 538 deletions.
Binary file removed .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules/
.DS_Store
37 changes: 0 additions & 37 deletions __tests__/E2E/e2e.js

This file was deleted.

6 changes: 3 additions & 3 deletions __tests__/Fragment/fragment.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ describe (`Component <A /> & component <B /> interaction`, () => {

test(`A test that shows that <A /> &
<B /> play well together`, () => {
//expect

expect(0).not.toEqual(1);

});

});
});
Binary file removed buildStats/.DS_Store
Binary file not shown.
3 changes: 3 additions & 0 deletions cypress.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"baseUrl": "http://127.0.0.1:8080"
}
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"
}
16 changes: 16 additions & 0 deletions cypress/integration/local-env-tests/basic.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
/// <reference types="Cypress" />

context('Local basic test', () => {

beforeEach(() => {
cy.visit(`/`)
});

it('Has right title', () => {
// https://on.cypress.io/type
cy.get('nav h1')
.should('be.visible')
.should('contain', 'Hello, React!')
});

});
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) => { ... })
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')
16 changes: 10 additions & 6 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@ module.exports = {
setupFilesAfterEnv: ["<rootDir>src/setupTests.js"],
moduleFileExtensions: ["js"],
transform: {
"^.+\\.js?$": "babel-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
"^.+\\.js?$": "babel-jest",
".+\\.(css|styl|less|sass|scss|png|jpg|ttf|woff|woff2)$": "jest-transform-stub",
},
moduleNameMapper: {
"^@/(.*)$": "<rootDir>/src/$1",
"^@/(.*)$": "<rootDir>/src/$1",
},
moduleDirectories: [
"node_modules",
"src",
],
"preset": "jest-puppeteer",
// Ignore cypress tests
testPathIgnorePatterns: [
"node_modules",
"cypress",
],
moduleNameMapper: {
"IndexScripts(.*)$": "<rootDir>src/index/scripts/$1",
"IndexComponents(.*)$": "<rootDir>src/index/scripts/components/$1",
"IndexContainers(.*)$": "<rootDir>src/index/scripts/containers/$1",
"IndexStyles(.*)$": "<rootDir>src/index/styles/$1",
"Images(.*)$": "<rootDir>assets/images$1"
"Images(.*)$": "<rootDir>assets/images$1",
}
};
};
Loading

0 comments on commit 38d17bc

Please sign in to comment.