From f3bf5b6b89f0b2fbcfabbacde55ea70fa84a35a8 Mon Sep 17 00:00:00 2001 From: Ramon Wenger Date: Sun, 14 Mar 2021 21:51:02 +0100 Subject: [PATCH] Add some code help to cypress folder --- client/cypress/.eslintrc.js | 5 +++++ client/cypress/support/index.d.ts | 26 ++++++++++++++++++++++++++ client/cypress/tsconfig.json | 13 +++++++++++++ 3 files changed, 44 insertions(+) create mode 100644 client/cypress/.eslintrc.js create mode 100644 client/cypress/support/index.d.ts create mode 100644 client/cypress/tsconfig.json diff --git a/client/cypress/.eslintrc.js b/client/cypress/.eslintrc.js new file mode 100644 index 00000000..33c8fd31 --- /dev/null +++ b/client/cypress/.eslintrc.js @@ -0,0 +1,5 @@ +module.exports = { + "extends": [ + "plugin:cypress/recommended" + ] +} diff --git a/client/cypress/support/index.d.ts b/client/cypress/support/index.d.ts new file mode 100644 index 00000000..8f237b52 --- /dev/null +++ b/client/cypress/support/index.d.ts @@ -0,0 +1,26 @@ +// Intellisense for custom Commands: https://github.com/cypress-io/cypress-example-todomvc#cypress-intellisense +declare namespace Cypress { + interface Chainable { + /** + * Login via API call to the GraphQL endpoint, without calling the frontend. Faster than the other login. + * @param username + * @param password + * @example + * cy.apolloLogin('nico.zickgraf', 'test') + */ + apolloLogin(username: string, password: string): Chainable + + /** + * Selects an element based on the `data-cy=xxx` attribute + * @param selector - The value of the data-cy attribute to select + * @example + * cy.dataCy('my-new-button') + */ + dataCy(selector: string): Chainable + + selectClass(schoolClass: string): void + + login(username:string, password:string, visitLogin?: boolean): void + fakeLogin(username:string, password:string): void + } +} diff --git a/client/cypress/tsconfig.json b/client/cypress/tsconfig.json new file mode 100644 index 00000000..3dcd08d5 --- /dev/null +++ b/client/cypress/tsconfig.json @@ -0,0 +1,13 @@ +{ + "compilerOptions": { + "allowJs": true, + "checkJs": true, + "resolveJsonModule": true, + "types": [ + "cypress" + ] + }, + "include": [ + "**/*.*" + ] +}