-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from hpi-sam/feature/setup-e2e-tests
Feature/setup e2e tests
- Loading branch information
Showing
16 changed files
with
26,709 additions
and
20,383 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
*.jpg filter=lfs diff=lfs merge=lfs -text | ||
*.png filter=lfs diff=lfs merge=lfs -text | ||
*.jpeg filter=lfs diff=lfs merge=lfs -text | ||
*.mp4 filter=lfs diff=lfs merge=lfs -text |
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
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
3 changes: 3 additions & 0 deletions
3
frontend/cypress-visual-screenshots/baseline/landing-page.spec.ts-landing page.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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 @@ | ||
{ | ||
"$schema": "https://on.cypress.io/cypress.schema.json", | ||
"integrationFolder": "cypress/integration", | ||
"supportFile": "cypress/support/index.ts", | ||
"videosFolder": "cypress/videos", | ||
"screenshotsFolder": "cypress/screenshots", | ||
"pluginsFile": "cypress/plugins/index.ts", | ||
"fixturesFolder": "cypress/fixtures", | ||
"baseUrl": "http://localhost:4200" | ||
} |
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,4 @@ | ||
import type { ExerciseState } from 'digital-fuesim-manv-shared'; | ||
import { generateExercise } from 'digital-fuesim-manv-shared'; | ||
|
||
export const newExercise: ExerciseState = generateExercise(); |
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,35 @@ | ||
// TODO: this is just a proof of concept on how to test - they should be replaced with real tests | ||
describe('The landing page', () => { | ||
beforeEach(() => { | ||
// TODO: reset the backend database e.g.: | ||
// `cy.exec('npm run db:reset && npm run db:seed')` | ||
// or sending a request to the server to reset the database (set to a fixture?) | ||
// or creating a new exercise | ||
}); | ||
|
||
it('loads the landing page', () => { | ||
cy.visit('/'); | ||
}); | ||
|
||
it('can join an exercise', () => { | ||
cy.visit('/'); | ||
cy.get('.container').should('not.contain', 'Add'); | ||
cy.contains('Join').click(); | ||
cy.get('.container').should('contain', 'Add'); | ||
}); | ||
|
||
// it('can add new patients', () => { | ||
// cy.visit('/'); | ||
// cy.contains('Join').click(); | ||
// cy.get('.container').should('contain', '0'); | ||
// cy.contains('Add').click(); | ||
// cy.get('.container').should('contain', '1'); | ||
// cy.contains('Add').click(); | ||
// cy.get('.container').should('contain', '2'); | ||
// }); | ||
|
||
it('is possible to make visual regression tests (for e.g. a canvas)', () => { | ||
cy.visit('/'); | ||
cy.get('.container').compareSnapshot('landing page', 0.1); | ||
}); | ||
}); |
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 @@ | ||
// @ts-expect-error there is no type definition for this package yet | ||
import * as cypressImageDiffPlugin from 'cypress-image-diff-js/dist/plugin'; | ||
|
||
// eslint-disable-next-line @typescript-eslint/no-empty-function | ||
const pluginConfig: Cypress.PluginConfig = (on, config) => { | ||
cypressImageDiffPlugin.default(on, config); | ||
}; | ||
export default pluginConfig; |
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,47 @@ | ||
// *********************************************** | ||
// This example namespace declaration will help | ||
// with Intellisense and code completion in your | ||
// IDE or Text Editor. | ||
// *********************************************** | ||
// declare namespace Cypress { | ||
// interface Chainable<Subject = any> { | ||
// customCommand(param: any): typeof customCommand; | ||
// } | ||
// } | ||
// | ||
// function customCommand(param: any): void { | ||
// console.warn(param); | ||
// } | ||
// | ||
// NOTE: You can use it like so: | ||
// Cypress.Commands.add('customCommand', customCommand); | ||
// | ||
// *********************************************** | ||
// 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) => { ... }) | ||
// @ts-expect-error there is no type definition for this package yet | ||
import * as cypressImageDiffCommand from 'cypress-image-diff-js/dist/command'; | ||
|
||
cypressImageDiffCommand(); |
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,40 @@ | ||
/* eslint-disable @typescript-eslint/no-namespace */ | ||
/* eslint-disable @typescript-eslint/method-signature-style */ | ||
// *********************************************************** | ||
// 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 | ||
// *********************************************************** | ||
|
||
// When a command from ./commands is ready to use, import with `import './commands'` syntax | ||
import './commands'; | ||
|
||
import type { RecurseDefaults } from 'cypress-recurse'; | ||
|
||
/// <reference types="cypress" /> | ||
declare global { | ||
namespace Cypress { | ||
interface Chainable { | ||
/** | ||
* @param name The name of the snapshots that will be generated | ||
* @param testThreshold @default 0 A number between 0 and 1 that represents the allowed percentage of pixels that can be different between the two snapshots | ||
* @param retryOptions @default { limit: 0, timeout: Cypress.config('defaultCommandTimeout'), delay: Cypress.config('defaultCommandTimeout') / 5 } | ||
* @example cy.compareSnapshot('empty-canvas', 0.1) | ||
*/ | ||
compareSnapshot( | ||
name: string, | ||
testThreshold?: number, | ||
retryOptions?: typeof RecurseDefaults | ||
): Chainable<Element>; | ||
} | ||
} | ||
} |
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 @@ | ||
{ | ||
"extends": "../tsconfig.json", | ||
"include": ["**/*.ts"], | ||
"compilerOptions": { | ||
"sourceMap": false, | ||
"types": ["cypress"] | ||
} | ||
} |
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
Oops, something went wrong.