Comments (10)
Tried to setup the TDD infrastructure. Standalone testing via mocha fails for most of the code base, because we currently use the root
feature of webpack as well as imports of .css
in our .js
files.
So basically, we need to use a test runner which accepts webpack as a preprocessor. I've found that Karma works best, and pretty much everyone uses it. Anyway, I am currently stuck at rendering the components into the document with testUtils.renderIntoDocument()
, somehow this fails currently. Thus I cannot assert the rendered elements as well as I/O handlers.
But there is another thing to try, react introduced the shallow rendering method, which works good at the moment. But the problem I am facing here is that this feature is not well documented, and karma can't log the results which are returned of the renderer since it contains Symbols (which cannot be converted to a string).
Another thing to note, since karma needs webpack to preprocess the whole bundle, the test suite needs about 10 seconds to boot currently, this is far from acceptable and will lead to devs ignoring the test suite, not good, not good.
TL;DR This whole topic is a mess and I stopped here, I pushed all my changes into a separate branch and will work on that whole thing in the coming days again. Any help appreciated.
https://github.com/PackageFactory/PackageFactory.Guevara/tree/task/18/testSuite
from neos-ui.
From my experience it's the easiest to start off writing tests for reducers. And those are much more important than component tests.
from neos-ui.
Yeah, you are probably right @dimaip - We should focus on that first.
from neos-ui.
Just FYI, back in the days (September actually) when I was starting with Redux, this tutorial helped me a lot with testing: http://teropa.info/blog/2015/09/10/full-stack-redux-tutorial.html
from neos-ui.
Alrighty mighty, test-suite is done. Now we can begin to write the tests for the reducers/components/functions/whatsoever.
The stack consists of mocha
, chai
and jsdom
.
Any file which ends with .spec.js
will be loaded into mocha and executed. To run the tests, execute npm test
.
Also, regarding the tests for compoennts. There is no other way to test stateless components other than with the recently mentioned shallow rendering, so we might have to wait until react incorporates something for stateless components. Issue here: facebook/react#4972
from neos-ui.
Note: Another thing which @robertlemke pointed out today, we should create a mock server based on express or the like for the whole UI, to separate the testability from the backend services.
from neos-ui.
We might look into testing the behavior with http://www.nightmarejs.org/ & BrowserSync/BrowserStack on CI as well
from neos-ui.
Yesterday i played around with the skin-deep package for tests using the shallowRenderer. It worked, but nevertheless I don't think that unit tests for react components are a big benefit for us. Ideally we should remove all of the logic of out of the react components (basically thats done already), and test them separately. Whats left is the pure rendering output, and I seriously doubt it that we should test markup.
Instead we should focus on behavior tests, in multiple environments using karma/browserstack. Even though I dislike the overhead karma brings, it will be the most practical solution since it offers a good integration with BrowserStack.
Still, the biggest priorities should be, that the UI will be as good as possible test covered, and that the tests are run as fas as possible as well to embrace a culture of writing tests not as a feature, but as a requirement instead.
TL;DR I will focus on writing behavior tests in the upcomming days using Karma/BrowserStack.
from neos-ui.
Note: Behavior test setup is done. Will add behavior tests in the next two days!
from neos-ui.
Alright, setup is pretty much done and kind of "stable", kind of, because you clearly need a good understanding of how the browsers and the setup between CI & SauceLabs works, if that is not the case, you may have trouble setting up user stories because the tests could run without problems locally but may fail due to network problems between the CI & SauceLabs server - This is pretty "meh" and we may need to revisit this later on.
Until then, and until we create bigger user stories together (maybe on one of the following sprints), we should work with the given setup and focus on other tasks.
Alternatives for the future:
- Maybe switch to BrowserStack instead of SauceLabs?
- Or switch the testrunner to http://nightwatchjs.org/ (Though I doubt that this would change the current situation since both of them rely on the WebDriver API)
from neos-ui.
Related Issues (20)
- BUG: Creation dialog cannot be closed after validation threw an error HOT 5
- Improve Workspace Selector Placement for Enhanced User Experience
- Relocate User Menu to Left Drawer for Improved Navigation HOT 1
- WIP: Schnappsidee: Provide alternative for client eval's conditional logic and hidden fields HOT 1
- BUG: Moving Assets in array<Neos\Media\Domain\Model\Asset> breaks the Inspector HOT 1
- BUG: Regexvalidator option throws error on apply HOT 6
- Neos9 Either reimplement or fully remove `presetBaseNodeType`
- FEATURE: Change order of fields in creation dialog (showInCreationDialog) HOT 2
- Creation dialog icons are not shown in Neos installations with subfolder setting
- FEATURE: Make MultiSelectBox drag&drop sorting feature optional HOT 1
- Inconsistent conversion in `CreationDialogPropertiesCreationHandler`
- `neos/content` throws 500 if no site exists and menu drawer is not accessible
- Back button in node creation handler does not work in secondary editor mode HOT 1
- BUG: Horizontal merging of table cells doesn't work when header column is used HOT 1
- BUG: Dont bundle react-dom/server
- FEATURE: Enable table captions in CKEditor HOT 2
- BUG: Unable to add text before or after a table is added to an inline editable
- BUG: reference editor `createNew` only handles hardcoded `title` property but not custom one
- TASK: 9.0 remove leftover manual context path string operations HOT 1
- BUG: Neos9 `ReferenceEditor` `createNew` doesnt work HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from neos-ui.