Skip to content

Commit fea2faa

Browse files
committed
add circleci tests
1 parent 9132a21 commit fea2faa

File tree

103 files changed

+736
-798
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

103 files changed

+736
-798
lines changed

.circleci/config.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
version: 2
2+
jobs:
3+
test-template:
4+
docker:
5+
- image: circleci/node:8.11.3-browsers
6+
working_directory: ~/template
7+
steps:
8+
- checkout
9+
- run: npm pack
10+
- run: npx create-react-app ~/template/test-template --scripts-version=/home/circleci/template/jpavon-react-scripts-ts-0.6.6.tgz
11+
- run: cd ~/template/test-template && yarn test
12+
13+
test-kitchensink:
14+
docker:
15+
- image: circleci/node:8.11.3-browsers
16+
working_directory: ~/kitchensink
17+
steps:
18+
- checkout
19+
- run: npm pack
20+
- run: E2E_TEST='true' npx create-react-app ~/kitchensink/test-kitchensink --scripts-version=/home/circleci/kitchensink/jpavon-react-scripts-ts-0.6.6.tgz --internal-testing-template=/home/circleci/kitchensink/fixtures/kitchensink
21+
- run: cd ~/kitchensink/test-kitchensink && yarn test
22+
- run: cd ~/kitchensink/test-kitchensink && yarn e2e:dev
23+
- run: cd ~/kitchensink/test-kitchensink && yarn e2e:build
24+
25+
workflows:
26+
version: 2
27+
tests:
28+
jobs:
29+
- test-template
30+
- test-kitchensink

fixtures/kitchensink/.babelrc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
{
2-
"presets": ["react-app"],
32
"plugins": ["babel-plugin-transform-es2015-modules-commonjs"]
43
}

fixtures/kitchensink/.env

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
11
REACT_APP_X = x-from-original-env
22
REACT_APP_ORIGINAL_1 = from-original-env-1
33
REACT_APP_ORIGINAL_2 = from-original-env-2
4+
REACT_APP_SHELL_ENV_MESSAGE = shell
5+
BROWSER=none
Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
22
"dependencies": {
3-
"babel-register": "6.22.0",
4-
"babel-plugin-transform-es2015-modules-commonjs": "6.22.0",
5-
"babel-polyfill": "6.20.0",
6-
"chai": "3.5.0",
7-
"jsdom": "9.8.3",
8-
"mocha": "3.2.0",
3+
"@babel/plugin-transform-modules-commonjs": "7.0.0-beta.46",
4+
"@babel/polyfill": "7.0.0-beta.46",
5+
"@babel/register": "7.0.0-beta.46",
6+
"bootstrap": "4.1.0",
97
"normalize.css": "7.0.0",
8+
"@types/prop-types": "15.5.3",
109
"prop-types": "15.5.6",
11-
"test-integrity": "1.0.0"
10+
"test-integrity": "2.0.1",
11+
"start-server-and-test": "1.5.0",
12+
"serve": "9.2.0",
13+
"puppeteer": "1.5.0",
14+
"jest": "23.3.0",
15+
"jest-puppeteer": "3.2.1"
1216
}
1317
}

fixtures/kitchensink/integration/env.test.js

Lines changed: 0 additions & 70 deletions
This file was deleted.
Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
const expectSelectorToHaveColor = async (page, selector, style) => {
2+
await page.waitForSelector(selector);
3+
const selectorColor = await page.evaluate((providedSelector) => {
4+
const el = document.querySelector(providedSelector);
5+
const computedStyle = window.getComputedStyle(el);
6+
return computedStyle.getPropertyValue('color');
7+
}, selector);
8+
expect(selectorColor).toBe(style);
9+
};
10+
11+
const expectImageToLoad = async (page, selector) => {
12+
await page.waitForSelector(selector);
13+
const imageLoaded = await page.evaluate((providedSelector) => {
14+
const el = document.querySelector(providedSelector);
15+
return el.complete && el.naturalHeight !== 0;
16+
}, selector);
17+
expect(imageLoaded).toBeTruthy();
18+
};
19+
20+
const isProduction = process.env.TEST_URL === 'http://localhost:5000'
21+
22+
describe('integration', () => {
23+
beforeAll(async () => {
24+
await page.goto(process.env.TEST_URL);
25+
});
26+
27+
it('FileEnvVariables', async () => {
28+
if (isProduction) {
29+
await expect(page).toMatch('production');
30+
} else {
31+
await expect(page).toMatch('development');
32+
}
33+
});
34+
35+
it('CssInclusion', async () => {
36+
await expectSelectorToHaveColor(
37+
page,
38+
'#feature-css-inclusion',
39+
'rgb(219, 112, 147)'
40+
);
41+
});
42+
43+
it('CssModuleInclusion', async () => {
44+
await expectSelectorToHaveColor(
45+
page,
46+
'[class*="cssModulesInclusion"]',
47+
'rgb(173, 216, 230)'
48+
);
49+
await expectSelectorToHaveColor(
50+
page,
51+
'[class*="cssModulesIndexInclusion"]',
52+
'rgb(173, 216, 230)'
53+
);
54+
});
55+
56+
it('ImageInclusion', async () => {
57+
await expectImageToLoad(page, '#feature-image-inclusion');
58+
});
59+
60+
it('JsonInclusion', async () => {
61+
await expect(page).toMatch('This is an abstract.');
62+
});
63+
64+
it('LinkedModules', async () => {
65+
await expect(page).toMatch('2.0.0');
66+
});
67+
68+
it('SassInclusion', async () => {
69+
await expectSelectorToHaveColor(
70+
page,
71+
'#feature-sass-inclusion',
72+
'rgb(220, 20, 60)'
73+
);
74+
});
75+
76+
it('SassModulesInclusion', async () => {
77+
await expectSelectorToHaveColor(
78+
page,
79+
'[class*="sassModulesInclusion"]',
80+
'rgb(173, 216, 230)'
81+
);
82+
await expectSelectorToHaveColor(
83+
page,
84+
'[class*="sassModulesIndexInclusion"]',
85+
'rgb(173, 216, 230)'
86+
);
87+
});
88+
89+
it('ScssInclusion', async () => {
90+
await expectSelectorToHaveColor(
91+
page,
92+
'#feature-scss-inclusion',
93+
'rgb(220, 20, 60)'
94+
);
95+
});
96+
97+
it('ScssModulesInclusion', async () => {
98+
await expectSelectorToHaveColor(
99+
page,
100+
'[class*="scssModulesInclusion"]',
101+
'rgb(173, 216, 230)'
102+
);
103+
await expectSelectorToHaveColor(
104+
page,
105+
'[class*="scssModulesIndexInclusion"]',
106+
'rgb(173, 216, 230)'
107+
);
108+
});
109+
110+
it('SvgComponent', async () => {
111+
await expect(page).toMatch('Svg Title');
112+
});
113+
114+
it('JsxInclusion', async () => {
115+
await expect(page).toMatch('Jsx is included.');
116+
});
117+
118+
it('TsxInclusion', async () => {
119+
await expect(page).toMatch('Tsx is included.');
120+
});
121+
122+
it('TsInclusion', async () => {
123+
await expect(page).toMatch('Ts is included.');
124+
});
125+
});

fixtures/kitchensink/integration/initDOM.js

Lines changed: 0 additions & 76 deletions
This file was deleted.

0 commit comments

Comments
 (0)