-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* ci: add browser tests with cypress - single test that uses the current fixtures - add test:e2e to package scripts * ci: add e2e job for github actions * ci: fix job name * chore: fix lint issues * ci: remove firefox from cypress to check error * ci: change cyress-io/github-action version * ci: test e2e failing test * test: fix failing before all - should fail in CI - combination of promise and cypress commands caused tests to be skipped - moved helpers to e2e folder instead of cypress commands * ci: test e2e passing test * ci: move code coverage to e2e * ci: forgot to set coverage=true * ci: run codecov separately from install * ci: break code coverage into 2 jobs install and then run * test: move tests from unit to e2e * chore: add e2e test to test script * ci: set node 14 only for checking basics - lint - types - unit tests - build * Move to Cypress 7.1.0 Co-authored-by: Stefan Cameron <stefan@stefcameron.com>
- Loading branch information
1 parent
e1b59bb
commit e140602
Showing
17 changed files
with
1,746 additions
and
323 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"viewportHeight": 600, | ||
"viewportWidth": 800, | ||
"video": false, | ||
"integrationFolder": "test/e2e", | ||
"testFiles": "**/*.e2e.js" | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/// <reference types="cypress" /> | ||
// *********************************************************** | ||
// 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) | ||
|
||
/** | ||
* @type {Cypress.PluginConfig} | ||
*/ | ||
// eslint-disable-next-line no-unused-vars | ||
module.exports = (on, config) => { | ||
// enable coverage | ||
require('@cypress/code-coverage/task')(on, config); | ||
// instrument code | ||
on( | ||
'file:preprocessor', | ||
require('@cypress/code-coverage/use-browserify-istanbul') | ||
); | ||
// fetch fixtures | ||
on('task', { | ||
getFixtures() { | ||
return require('../../test/fixtures/index'); | ||
}, | ||
}); | ||
// IMPORTANT to return the config object | ||
// with the any changed environment variables | ||
return config; | ||
}; |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'; | ||
import '@cypress/code-coverage/support'; | ||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta http-equiv="X-UA-Compatible" content="IE=edge" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Cypress test sandbox</title> | ||
</head> | ||
<body> </body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
export function setupTestWindow(done) { | ||
cy.visit('./cypress/test-sandbox.html'); | ||
cy.window().then(done); | ||
} | ||
export function getFixtures(done) { | ||
cy.task('getFixtures').then(done); | ||
} | ||
export function getIdsFromElementsArray(elements) { | ||
return elements.map((el) => el.getAttribute('id')); | ||
} | ||
export function removeAllChildNodes(parent) { | ||
while (parent.firstChild) { | ||
parent.removeChild(parent.firstChild); | ||
} | ||
} | ||
export function setupFixture(content) { | ||
const container = document.createElement('div'); | ||
container.innerHTML = content; | ||
document.body.append(container); | ||
return { container }; | ||
} |
Oops, something went wrong.