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

TASK: Add another way to run tests locally with a system under test in docker #3369

Merged
merged 4 commits into from
Feb 20, 2023

Conversation

JamesAlias
Copy link
Contributor

@JamesAlias JamesAlias commented Feb 15, 2023

What I did
I made it possible to start a neos test instance as system under test (SUT) via docker. You are able to run testcafe tests on your machine to faster implement tests and features.

How I did it
Add a shell script to start the SUT.
Add a make command to do it fast.
Add some configs to make it possible.

We Mount the NeosUi root into the SUT.
Then we symlink the [...]/Packages/Application/Neos.Ui to this mounted volume.
We do the same for [...]/Packages/Application/Neos.TestNodeTypes -> [...]/Tests/IntegrationTests/SharedNodeTypesPackage.

This way we can build tests, features and bugfixes without the need to restart the SUT (in 99% of cases).
This speeds up the feedback loop by at least an order of magnitude. It's insane.

We don't even need to have a Neos Instance to develop the UI! I think this could be huge for new contributors.
Just start the SUT and you have a running Neos 🚀

If you have to nuke it, just re-run the make command.

Why I did it
It's extremely slow to run tests on my local machine via docker because it completely wipes and reinstalls neos and all the things everytime I want to run 1 or 2 tests.
I decoupled the SUT and "running the tests". This makes writing tests and features so much faster for me.

How to verify it

  • make e2e-start-system-under-test
  • yarn run testcafe chrome Tests/IntegrationTests/Fixtures -T 'sidebars' - tests should not fail
  • change something that breaks that feature (I just broke the LeftSideBar reducer)
  • make build-e2e-testing - rebuild Ui
  • yarn run testcafe chrome Tests/IntegrationTests/Fixtures -T 'sidebars' - tests should fail

@JamesAlias
Copy link
Contributor Author

If $someone is able to come up with a better name for the make command e2e-start-system-under-test I would appreciate it 😃

Something like start-dev-neos-instance-docker or start-test-neos-instance-docker..
I'm not sure ^^ "naming things", right 😆

@mhsdesign mhsdesign self-requested a review February 18, 2023 22:22
@mhsdesign
Copy link
Member

I just asked bing ki to fix this setup for linux lets see :D

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this ❤️ i had some small issues running this on linux at first but that is fixed now ;)

After linking the neos-ui again the Host.js is found and i could continue to actually run a test.

For some reason the tests dindt work though ... nothing happened (besides opening the publish button dropdown ... and it failed)

Comment on lines 55 to 57
# WHY: We want changes of dev to appear in system under test without rebuilding the whole system
rm -rf Packages/Application/Neos.Neos.Ui
ln -s /usr/src/neos-ui/ /usr/src/app/TestDistribution/Packages/Application/Neos.Neos.Ui
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works in generally, but not in this flow. Later i think due to the composer reinstall neos/test-site this linking will be gone and we have the original composer neos ui... so this step should come later?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used this setup and it worked for me.

Thanks for fixing the issues on Linux ❤️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well this is not fixed yet ... and I don't know why it would work on your machine ... I mean the problem is within docker after all

dc exec -T php bash <<-'BASH'
rm -rf /usr/src/app/*
BASH
docker cp "$(pwd)"/Tests/IntegrationTests/. "$(dc ps -q php)":/usr/src/app
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Todo: Lets use paths relative to the shellscript?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fine by me, I didn't want to put too much time into it and copy pasted the most stuff.

It's clear, that we could build a better system for all of this but I needed a faster feedback loop fast 😬
I want to build tests for Bugs I fix and wasting 2h just for building the test and another 2 for running them to see if the fix works and we don't mess up something else ist just too much ^^

Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

github is buggy ^^

@github-actions github-actions bot added the Task label Feb 20, 2023
@JamesAlias JamesAlias force-pushed the add-system-under-test-docker branch from c3527e4 to d93c3cf Compare February 20, 2023 14:44
Copy link
Member

@mhsdesign mhsdesign left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works *

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants