Skip to content
This repository has been archived by the owner on May 17, 2019. It is now read-only.

Add e2e test for split translations in development with named chunk #754

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
3 changes: 1 addition & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,7 @@
"eslint-plugin-react": "^7.11.1",
"flow-bin": "^0.95.0",
"fusion-core": "^1.10.4-1",
"fusion-plugin-i18n": "^1.2.0",
"fusion-plugin-i18n-react": "^1.2.3",
"fusion-plugin-i18n-react": "1.2.5-0",
"fusion-plugin-react-router": "^1.4.2",
"fusion-plugin-universal-events": "^1.3.2",
"fusion-react": "1.3.7",
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/split-translations/fixture/src/routes.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export default [
path: '/split2',
component: split({
load() {
return import('./split2');
return import(/* webpackChunkName: "named-chunk" */ './split2');
},
LoadingComponent,
ErrorComponent,
Expand Down
30 changes: 26 additions & 4 deletions test/e2e/split-translations/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,18 @@ test('`fusion dev` app with split translations integration', async () => {
'renders first split translation'
);

await Promise.all([
page.click('#split2-link'),
page.waitForSelector('#split2-translation'),
]);
const content3 = await page.content();
t.ok(
content3.includes('__SPLIT2_TRANSLATED__'),
'renders second split translation'
);

await page.goto(`${url}/`, {waitUntil: 'load'});

const reloaded = page.evaluate(() => {
return new Promise(resolve => {
// eslint-disable-next-line
Expand All @@ -128,9 +140,9 @@ test('`fusion dev` app with split translations integration', async () => {
page.click('#split2-link'),
page.waitForSelector('#split2-translation'),
]);
const content3 = await page.content();
const content4 = await page.content();
t.ok(
content3.includes('__HOT_TRANSLATED__'),
content4.includes('__HOT_TRANSLATED__'),
'renders second, hot split translation'
);

Expand All @@ -140,9 +152,9 @@ test('`fusion dev` app with split translations integration', async () => {
page.click('#split1-link'),
page.waitForSelector('#split1-translation'),
]);
const content4 = await page.content();
const content5 = await page.content();
t.ok(
content4.includes('__SPLIT1_TRANSLATED__'),
content5.includes('__SPLIT1_TRANSLATED__'),
'renders translation from unmodified file after rebuild'
);

Expand Down Expand Up @@ -180,5 +192,15 @@ test('`fusion dev` app with split translations integration (cached)', async () =
'renders first split translation'
);

await Promise.all([
page.click('#split2-link'),
page.waitForSelector('#split2-translation'),
]);
const content3 = await page.content();
t.ok(
content3.includes('__SPLIT2_TRANSLATED__'),
'renders second split translation'
);

app.teardown();
}, 100000);
120 changes: 10 additions & 110 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-syntax-json-strings" "^7.2.0"

"@babel/plugin-proposal-object-rest-spread@^7.2.0", "@babel/plugin-proposal-object-rest-spread@^7.3.1":
"@babel/plugin-proposal-object-rest-spread@^7.3.1":
version "7.3.2"
resolved "https://registry.yarnpkg.com/@babel/plugin-proposal-object-rest-spread/-/plugin-proposal-object-rest-spread-7.3.2.tgz#6d1859882d4d778578e41f82cc5d7bf3d5daf6c1"
integrity sha512-DjeMS+J2+lpANkYLLO+m6GjoTMygYglKmRe6cDTbFv3L9i6mmiE8fe6B8MtCSLZpVXscD5kn7s6SgtHrDoBWoA==
Expand Down Expand Up @@ -594,53 +594,6 @@
core-js "^2.5.7"
regenerator-runtime "^0.12.0"

"@babel/[email protected]":
version "7.2.3"
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.2.3.tgz#948c8df4d4609c99c7e0130169f052ea6a7a8933"
integrity sha512-AuHzW7a9rbv5WXmvGaPX7wADxFkZIqKlbBh1dmZUQp4iwiPpkE/Qnrji6SC4UQCQzvWY/cpHET29eUhXS9cLPw==
dependencies:
"@babel/helper-module-imports" "^7.0.0"
"@babel/helper-plugin-utils" "^7.0.0"
"@babel/plugin-proposal-async-generator-functions" "^7.2.0"
"@babel/plugin-proposal-json-strings" "^7.2.0"
"@babel/plugin-proposal-object-rest-spread" "^7.2.0"
"@babel/plugin-proposal-optional-catch-binding" "^7.2.0"
"@babel/plugin-proposal-unicode-property-regex" "^7.2.0"
"@babel/plugin-syntax-async-generators" "^7.2.0"
"@babel/plugin-syntax-object-rest-spread" "^7.2.0"
"@babel/plugin-syntax-optional-catch-binding" "^7.2.0"
"@babel/plugin-transform-arrow-functions" "^7.2.0"
"@babel/plugin-transform-async-to-generator" "^7.2.0"
"@babel/plugin-transform-block-scoped-functions" "^7.2.0"
"@babel/plugin-transform-block-scoping" "^7.2.0"
"@babel/plugin-transform-classes" "^7.2.0"
"@babel/plugin-transform-computed-properties" "^7.2.0"
"@babel/plugin-transform-destructuring" "^7.2.0"
"@babel/plugin-transform-dotall-regex" "^7.2.0"
"@babel/plugin-transform-duplicate-keys" "^7.2.0"
"@babel/plugin-transform-exponentiation-operator" "^7.2.0"
"@babel/plugin-transform-for-of" "^7.2.0"
"@babel/plugin-transform-function-name" "^7.2.0"
"@babel/plugin-transform-literals" "^7.2.0"
"@babel/plugin-transform-modules-amd" "^7.2.0"
"@babel/plugin-transform-modules-commonjs" "^7.2.0"
"@babel/plugin-transform-modules-systemjs" "^7.2.0"
"@babel/plugin-transform-modules-umd" "^7.2.0"
"@babel/plugin-transform-new-target" "^7.0.0"
"@babel/plugin-transform-object-super" "^7.2.0"
"@babel/plugin-transform-parameters" "^7.2.0"
"@babel/plugin-transform-regenerator" "^7.0.0"
"@babel/plugin-transform-shorthand-properties" "^7.2.0"
"@babel/plugin-transform-spread" "^7.2.0"
"@babel/plugin-transform-sticky-regex" "^7.2.0"
"@babel/plugin-transform-template-literals" "^7.2.0"
"@babel/plugin-transform-typeof-symbol" "^7.2.0"
"@babel/plugin-transform-unicode-regex" "^7.2.0"
browserslist "^4.3.4"
invariant "^2.2.2"
js-levenshtein "^1.1.3"
semver "^5.3.0"

"@babel/[email protected]":
version "7.3.1"
resolved "https://registry.yarnpkg.com/@babel/preset-env/-/preset-env-7.3.1.tgz#389e8ca6b17ae67aaf9a2111665030be923515db"
Expand Down Expand Up @@ -3390,57 +3343,6 @@ functional-red-black-tree@^1.0.1:
resolved "https://registry.yarnpkg.com/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz#1b0ab3bd553b2a0d6399d29c0e3ea0b252078327"
integrity sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=

fusion-cli@^1.13.1:
version "1.16.0"
resolved "https://registry.yarnpkg.com/fusion-cli/-/fusion-cli-1.16.0.tgz#aa7641e0dc433f2e265a04ce4aeab64b86a264cc"
integrity sha512-1WKbbIVWm0Sjk9IESD3aU8gx+3lbXCa/kBggPyTBrMp8YzWH5FhW83o+sdnBMFfh/QEYTH95gKxaQSO6bXxutA==
dependencies:
"@babel/core" "^7.1.6"
"@babel/plugin-syntax-dynamic-import" "7.2.0"
"@babel/plugin-transform-flow-strip-types" "7.2.3"
"@babel/polyfill" "^7.0.0"
"@babel/preset-env" "7.2.3"
"@babel/preset-react" "7.0.0"
"@gfx/zopfli" "^1.0.10"
"@rtsao/plugin-proposal-class-properties" "7.0.1-patch.1"
babel-core "^7.0.0-bridge.0"
babel-jest "^24.0.0"
babel-plugin-dynamic-import-node "^2.2.0"
babel-plugin-transform-cup-globals "^1.0.1"
bundle-analyzer "^0.0.6"
case-sensitive-paths-webpack-plugin "^2.1.2"
chalk "^2.4.1"
compression-webpack-plugin "^2.0.0"
enzyme-adapter-react-16 "^1.7.0"
enzyme-to-json "^3.3.4"
get-port "^4.0.0"
graphql-tag "^2.10.1"
http-proxy "^1.17.0"
iltorb "^2.4.1"
imagemin "^6.0.0"
imagemin-svgo "^7.0.0"
istanbul-api "^2.0.6"
istanbul-lib-coverage "^2.0.1"
jest "^24.0.0"
jest-environment-jsdom-global "^1.1.0"
just-snake-case "^1.1.0"
koa-mount "^4.0.0"
koa-static "^5.0.0"
loader-utils "^1.1.0"
make-dir "^1.3.0"
memory-fs "^0.4.1"
progress-bar-webpack-plugin "^1.11.0"
react-dev-utils "^6.1.1"
request "^2.88.0"
resolve-from "^4.0.0"
rimraf "^2.6.2"
sade "^1.4.1"
source-map-support "^0.5.9"
terser-webpack-plugin "^1.1.0"
webpack "4.26.1"
webpack-hot-middleware "^2.24.3"
winston "^3.1.0"

fusion-core@^1.10.4-1:
version "1.10.4-1"
resolved "https://registry.yarnpkg.com/fusion-core/-/fusion-core-1.10.4-1.tgz#edd1946ce4202b8f90436831702965799bc56b2d"
Expand All @@ -3453,21 +3355,19 @@ fusion-core@^1.10.4-1:
ua-parser-js "^0.7.19"
uuid "^3.3.2"

fusion-plugin-i18n-react@^1.2.3:
version "1.2.3"
resolved "https://registry.yarnpkg.com/fusion-plugin-i18n-react/-/fusion-plugin-i18n-react-1.2.3.tgz#d67db49d86560067770f2acd3d63c740811fa1e8"
integrity sha512-mvAZvagcKdLAfnNx2gDqJbDJe/8ayTr+jbCubmg8H1xBkS3uSPdgkKV2nUjV552OFMhJMaQzg18e9F9xtCoivw==
[email protected].5-0:
version "1.2.5-0"
resolved "https://registry.yarnpkg.com/fusion-plugin-i18n-react/-/fusion-plugin-i18n-react-1.2.5-0.tgz#5a68800161dcd299d4d84b3d008e7fabde90b6cc"
integrity sha512-suhTj+ae3CqzhzflHRMPV2irlLepktbcHgVPZboTnO4EI4t4dBDI0OSAI6b4w5a3XnvmCXj4+wRUb7OGeuzqxg==
dependencies:
fusion-cli "^1.13.1"
fusion-plugin-i18n "^1.2.0"
fusion-plugin-i18n "^1.2.2-1"
prop-types "^15.6.2"

fusion-plugin-i18n@^1.2.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/fusion-plugin-i18n/-/fusion-plugin-i18n-1.2.0.tgz#fc54e9637dc842e4f4292779bf20af577ff7b3ed"
integrity sha512-bHBsKlTjXnOStS8HAnwj3tNibRi9cE0AXXBnvvlghi1LAfLg6bAd4Kf0MRQmpaG1v6FT0aP1rnzEJLGP0SlsXw==
fusion-plugin-i18n@^1.2.2-1:
version "1.2.2-1"
resolved "https://registry.yarnpkg.com/fusion-plugin-i18n/-/fusion-plugin-i18n-1.2.2-1.tgz#c171daff506356c40e761195fb20691c9032d06f"
integrity sha512-sWwLinB3qE1dgFMNkW+zx0jaYGiygs2C08KpusvzKPJheidkWS3HuewLaPCoJodQryC9MgrnyVKShI5xYB6GHA==
dependencies:
eslint-plugin-jest "^22.1.0"
locale "^0.1.0"
rollup "^0.67.3"

Expand Down