Skip to content

Commit

Permalink
fix node14 deps
Browse files Browse the repository at this point in the history
  • Loading branch information
mgrinko committed Mar 18, 2024
1 parent b8000b3 commit d69c3b7
Show file tree
Hide file tree
Showing 14 changed files with 1,771 additions and 3,898 deletions.
15 changes: 5 additions & 10 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
module.exports = {
extends: ['@mate-academy/eslint-config-react-typescript', 'plugin:cypress/recommended'],
rules: {
'max-len': ['error', {
ignoreTemplateLiterals: true,
ignoreComments: true,
}],
'jsx-a11y/label-has-associated-control': ["error", {
assert: "either",
}],
},
extends: [
'@mate-academy/eslint-config-react-typescript',
'plugin:cypress/recommended',
],
rules: {},
};
26 changes: 26 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
const { defineConfig } = require('cypress');

module.exports = defineConfig({
e2e: {
baseUrl: 'http://localhost:3000',
specPattern: 'cypress/integration/**/*.spec.{js,ts,jsx,tsx}',
},
video: true,
viewportHeight: 1920,
viewportWidth: 1080,
screenshotOnRunFailure: true,
reporter: 'mochawesome',
reporterOptions: {
reportDir: 'raw_reports',
overwrite: false,
html: false,
json: true,
},
component: {
specPattern: 'src/**/*.spec.{js,ts,jsx,tsx}',
devServer: {
framework: 'create-react-app',
bundler: 'webpack',
},
},
});
18 changes: 0 additions & 18 deletions cypress.json

This file was deleted.

1 change: 0 additions & 1 deletion cypress/plugins/index.js

This file was deleted.

63 changes: 63 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts 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) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }

export {};

declare global {
namespace Cypress {
interface Chainable<Subject> {
getByDataCy(selector: string): Chainable<JQuery<HTMLElement>>;
byDataCy(name: string): Chainable<JQuery<HTMLElement>>;
}
}
}

Cypress.Commands.add('getByDataCy', selector => {
cy.get(`[data-cy="${selector}"]`);
});

Cypress.Commands.add(
'byDataCy',
{ prevSubject: 'optional' },

(subject, name) => {
const selector = `[data-cy="${name}"]`;

return subject ? cy.wrap(subject).find(selector) : cy.get(selector);
},
);
12 changes: 12 additions & 0 deletions cypress/support/component-index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html>
<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>Components App</title>
</head>
<body>
<div data-cy-root></div>
</body>
</html>
39 changes: 39 additions & 0 deletions cypress/support/component.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
// ***********************************************************
// This example support/component.ts 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')

import { mount } from 'cypress/react18';

// Augment the Cypress namespace to include type definitions for
// your custom command.
// Alternatively, can be defined in cypress/support/component.d.ts
// with a <reference path="./component" /> at the top of your spec.
declare global {
namespace Cypress {
interface Chainable {
mount: typeof mount;
}
}
}

Cypress.Commands.add('mount', mount);

// Example use:
// cy.mount(<MyComponent />)
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts 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')
1 change: 0 additions & 1 deletion cypress/support/index.d.ts

This file was deleted.

1 change: 0 additions & 1 deletion cypress/support/index.js

This file was deleted.

6 changes: 6 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"extends": "@mate-academy/students-ts-config",
"compilerOptions": {
"sourceMap": false
}
}
Loading

0 comments on commit d69c3b7

Please sign in to comment.