Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nick/lesson25 #49

Merged
merged 11 commits into from
Jul 3, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
.history
.vscode
node_modules
coverage
reports
storybook-static
dist
presa
7 changes: 5 additions & 2 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,20 @@
"plugin:@typescript-eslint/recommended",
"prettier/@typescript-eslint",
"plugin:prettier/recommended",
"plugin:react/recommended"
"plugin:react/recommended",
"plugin:jest/recommended"
],
"plugins": [
"react-hooks"
"react-hooks",
"jest"
],
"settings": {
"react": {
"version": "detect"
}
},
"rules": {
"jest/expect-expect": 0,
"prettier/prettier": [
"error",
{
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,7 @@ node_modules
dist
storybook-static
.idea
coverage
reports
# stryker temp files
.stryker-tmp
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -226,3 +226,12 @@ React Patterns
* Конфигурация приложения

[Presentation](https://docs.google.com/presentation/d/1YP-MPF1THPrzu7boQbknr1zzGaGBxp7pIiOJ41Ze3CI/edit?usp=sharing) <br>


## Lesson 25

* Test quality tools
* E2E

[Pull request](https://github.com/nickovchinnikov/react-js-tutorial/pull/49) <br>
[Presentation](https://docs.google.com/presentation/d/1ox8hQ2Hw2TXKGnlbG4pHoXdgeZ7NKXQ8ev9qryQC448/edit?usp=sharing) <br>
12 changes: 12 additions & 0 deletions e2e/app.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import "expect-puppeteer";

describe("TicTacToeGame", () => {
beforeAll(async () => {
await page.goto("http://localhost:8080");
});

it('should display "Nice to see you!" text on page', async () => {
const text = await page.evaluate(() => document.body.textContent);
expect(text).toContain("Nice to see you! Lets ");
});
});
1 change: 1 addition & 0 deletions internals/jestSettingsE2E.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
jest.setTimeout(20000);
10 changes: 10 additions & 0 deletions jest-puppeteer.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module.exports = {
launch: {
headless: true,
},
browser: "chromium",
server: {
command: "npm run start",
debug: true,
},
};
9 changes: 9 additions & 0 deletions jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,14 @@ module.exports = {
"\\.(css|less)$": "<rootDir>/internals/__mocks__/styleMock.js",
"^@/(.*)$": "<rootDir>/src/$1",
},
testPathIgnorePatterns: ["e2e"],
moduleDirectories: ["node_modules", "src"],
coverageThreshold: {
global: {
branches: 75,
functions: 75,
lines: 75,
statements: -85,
},
},
};
16 changes: 16 additions & 0 deletions jest.e2e.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
// For a detailed explanation regarding each configuration property, visit:
// https://jestjs.io/docs/en/configuration.html

module.exports = {
preset: "jest-puppeteer",
clearMocks: true,
globalSetup: "jest-environment-puppeteer/setup",
globalTeardown: "jest-environment-puppeteer/teardown",
testEnvironment: "jest-environment-puppeteer",
setupFilesAfterEnv: ["<rootDir>/internals/jestSettingsE2E.js"],
transform: {
"^.+\\.(js|jsx|ts|tsx)$": "<rootDir>/node_modules/babel-jest",
},
testPathIgnorePatterns: ["src"],
moduleDirectories: ["node_modules", "src"],
};
Loading