You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[WIP] start upgrade to symfony encore => webpack 4 (#116)
* start upgrade to symfony encore => webpack 4
* add styling for menu with devextrem
* fix phpunit tests fails (by removing phpunit project and keeping the one from symfony)
* fix test over angular home route
* Start to replace testcafe with Panther
* add 2 e2e tests with panther and removed testcafe
* upgrade karma* => run it in debug mode to chec what's wrong in debug devtools
* Karma: the problem is that *.vue are not loaded correctly: the test breaks on import Movie from '../components/Movie.vue' => but the vueLoader is used in webpack, so what ?
* disable karma test for travis
Copy file name to clipboardExpand all lines: .travis.yml
+8-10
Original file line number
Diff line number
Diff line change
@@ -2,7 +2,7 @@ dist: trusty
2
2
sudo: required
3
3
4
4
addons:
5
-
# chrome: stable
5
+
chrome: stable
6
6
firefox: latest
7
7
apt:
8
8
sources:
@@ -51,18 +51,16 @@ before_script:
51
51
# - sudo service php7.1-fpm restart
52
52
# - sudo service nginx restart
53
53
- npm run sf-dev &
54
-
# see http://devexpress.github.io/testcafe/documentation/recipes/integrating-testcafe-with-ci-systems/travis.html
55
-
- "export DISPLAY=:99.0"
56
-
- "sh -e /etc/init.d/xvfb start"
57
-
- sleep 3
58
-
- fluxbox >/dev/null 2>&1 &
54
+
# For chrome usage
55
+
- export CHROME_BIN=chromium-browser
56
+
- export DISPLAY=:99.0
57
+
- sh -e /etc/init.d/xvfb start
59
58
60
59
script:
61
-
# until this issue is open i disable npm test and use test-php and test-karma in place (issue:https://github.com/DevExpress/testcafe/issues/2195, original post: https://testcafe-discuss.devexpress.com/t/role-sometime-it-doesnt-seem-to-be-played/875/9)
62
-
# - npm test
63
-
# - npm run test-cafe
60
+
#disable karma test coz it fails to launch chrome or firefox, (scrutinizer doesn't have this problem)
Then some php controllers has been created on following routes :
@@ -85,7 +85,7 @@ You can also change the web server port and the asset server port in the same co
85
85
},
86
86
```
87
87
88
-
The test_browser section represent all the browsers you want to use with the testcafe testing tool.
88
+
The test_browser section represent all the browsers you want to use with the Panther testing tool (we previously used testcafe, but it changes toot much and results was not so satisfying).
89
89
90
90
## components
91
91
@@ -109,8 +109,9 @@ The test_browser section represent all the browsers you want to use with the tes
109
109
* security-checker: a tool to check known securities vulnerabilities, to use it, run `php bin/console security:check`
110
110
*[roave/security-advisories](https://www.websec.io/2018/03/10/Package-Protection-Roave-SecurityAdvisories.html): a tool that prevent the install of PHP package from composer with known vulnerabilities
111
111
*[phpunit](https://phpunit.de/), crawler, browserkit, css-selector: php/symfony task for testing (@todo ll last 3 should be a recipe)
112
-
* babel-preset-es2017: do you really need explanation ?
113
-
*[testcafe](https://testcafe.devexpress.com/): an e2e test framework (might be changed with chimp or anything else, gimme better idea)
112
+
*[panther](https://github.com/symfony/panther): the symfony toolkit to manage testing throught a browser (before this compoennt, we had to use npm libraries to control browser)
113
+
* babel-preset-env: do you really need explanation ? this is just for Babel7
114
+
*~~[testcafe](https://testcafe.devexpress.com/): an e2e test framework (might be changed with chimp or anything else, gimme better idea)~~
114
115
*[jasmine](https://jasmine.github.io/) & [karma](https://karma-runner.github.io/2.0/index.html): a stack for unit & e2e tests (a more standard stack to replace testcafé)
115
116
* sass: hey, we are not in nineties, we don't write css now
116
117
*[bootstrap](https://getbootstrap.com/): the 4th version of the first class css framework (not used with quasar)
@@ -219,13 +220,17 @@ a mock !
219
220
**JWT Certificates** in test mode, we don't use pem files from your dev/prod env. In fact we use pem files generated specifically for tests and copied from var/travis/config to var/cache/config
220
221
221
222
On Javascript we have unit and e2 tests. Units tests are managed by jasmine and karma. It allows to test function, class, component.
222
-
For e2e tests we use testcafe from devExpress. It allows to launch browsers and drive them by code to reproduce a human behavior.
223
-
Here the tests runs on a chrome headless, and firefox but you can configure it in the package.json file in the config.test_browser node.
223
+
~~For e2e tests we use testcafe from devExpress. It allows to launch browsers and drive them by code to reproduce a human behavior.
224
+
Here the tests runs on a chrome headless, and firefox but you can configure it in the package.json file in the config.test_browser node.~~
225
+
We now use Panther to run e2e tests. It's automatically ran when we run phpunit commands.
224
226
225
-
`npm run test-cafe && npm run test-karma` will run js test and will generate a testcafe.xunit.xml and karma_report.xml files in the following folder `/var/report/`.
227
+
`npm run test-karma` will run js test and will generate a karma_report.xml files in the following folder `/var/report/`.
226
228
227
229
If you wonder how to tests your VueJS components, you can hae a look at [this website which describe a lot of tests](https://blog.octo.com/vue-js-en-tdd/). Sadly it's in french !
228
230
231
+
In this application i used Karma for one application with VueJS (in /assets/js/vuejs). And i used Panther to test pages fully generated by Symfony.
232
+
Karma is configured with assets/tests/units/karma.conf.js !
233
+
229
234
## Security
230
235
231
236
On PHP i use those 2 packages to prevent the use of deprecated packages or with vulnerabilities:
@@ -515,7 +520,7 @@ It takes the following JSON string as Body:
515
520
-[x] quality: write some JS units tests
516
521
-[x] quality: write some JS e2e tests
517
522
-[x] quality: write some PHP tests
518
-
-[ ] quality: fix testcafe role where sometimes they are not played: https://testcafe-discuss.devexpress.com/t/role-sometime-it-doesnt-seem-to-be-played/875
523
+
-[ ]~~quality: fix testcafe role where sometimes they are not played: https://testcafe-discuss.devexpress.com/t/role-sometime-it-doesnt-seem-to-be-played/875~~
519
524
-[x] quality: setup tests reports
520
525
-[x] security: setup security with Symfony (ticket open coz i get 500 instead of 403: https://github.com/symfony/symfony/issues/25806 Still WIP at this time) and choose between cookie (stateful), JWT (with Lexik bundle) or ApiKey (https://symfony.com/doc/current/security/guard_authentication.html) : I implement both statefull and JWT samples, but i didn't take the time for ApiKey
521
526
-[x] back: setup EasyAdminBundle
@@ -532,7 +537,7 @@ It takes the following JSON string as Body:
532
537
-[ ] db: have a lookAt the HauteLookAliceBundle to help in the creation of real fixtures during tests (instead of generating a new test.db which could be long)
533
538
-[ ] api: try https://github.com/overblog/GraphQLBundle instead of ApiPlatform to try nested query/mutations (resolver are not auto-generated)
534
539
-[ ] quality: use a server logger for both JS and PHP (and also maybe HTTP, DB, MessageQueuing, ...), it will helps to improve quality of the app by identifing users system/browser and most current errors (Sentry or other service must be tested https://www.slant.co/options/964/alternatives/~sentry-alternatives)
535
-
-[] front: move on babel 7 with babel-preset-env (remove all related babel from readme and read babeljs.io for more info on update)
540
+
-[x] front: move on babel 7 with babel-preset-env (remove all related babel from readme and read babeljs.io for more info on update)
536
541
537
542
* improve this tutorial with ~~an API Route built with Api platform (without DB)~~ and install the vue-generator from api-platform for a crud sample
538
543
* manage Entity orphanRemoval / CASCADE onDelete
@@ -597,6 +602,7 @@ I wrote some articles on medium to explain some practices setup in this project:
0 commit comments