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

Change to a more performant system test setup #27

Closed
wants to merge 2 commits into from

Conversation

mhenrixon
Copy link
Contributor

Cuprite is way faster and I really like this setup, let me know if you are interested and I'll adapt the changes so that it works for you.


# Configure bundler
ENV LANG=C.UTF-8 \
BUNDLE_JOBS=4 \
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 have 8 cores and since bundler now handles that automatically in newer versions, there is no need to limit me to 4 simultaneous downloads.


sidekiq:
<<: *backend
command: bundle exec sidekiq -C config/sidekiq.yml

postgres:
image: postgres:13
image: postgres:13-alpine
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Way smaller in size which I believe is fine for everything except the app. Preferably I'd use alpine all the way (I have slow internet).

@@ -86,7 +93,7 @@ services:
interval: 5s

redis:
image: "redis:6.2.5-buster"
image: redis:6.2.6-alpine
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same here with the download size. Saves me a ton of time when I've cleared up all lingering docker images.

@@ -5,6 +5,7 @@
"requires": true,
"packages": {
"": {
"name": "app",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

npm added this on its own

Capybara.server_port = 3000
}
end
Capybara.server_host = "0.0.0.0"
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 had some problems with the IPSocket. I use both LAN and Wi-Fi so it gets messed up when switching around. I figured it is better to just use 0.0.0.0

end

# Drop #debug anywhere in a test to open a Chrome inspector and pause the execution
def debug(*args)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This one is really useful to me when debugging sometimes.

Copy link
Owner

Choose a reason for hiding this comment

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

Yeah, would love to use this!

@@ -14,7 +14,7 @@
begin
# Silence NPM build output
$stdout.reopen(File.new("/dev/null", "w"))
system("npm build")
system("npm run build")
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The command was broken, I know you are changing to CSS bundling and JS bundling but the tailwind-build.css was never built when I tested this.

@peterberkenbosch
Copy link
Owner

Awesome @mhenrixon. Was on my list to move to cuprite, definitly interested! Checking this locally now, since I had some challenges making cuprite work on Docker with M1.

image: seleniarm/standalone-firefox:4.0.0-beta-1-20210215
volumes:
- /dev/shm:/dev/shm
image: browserless/chrome
Copy link
Owner

Choose a reason for hiding this comment

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

This image is not working with Docker on M1. Chrome and Docker on M1 is not fixed yet :(

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah the M1 situation, I'll see about alternatives then. Thanks for the feedback.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The latest version (released yesterday) had something about ARM in the change notes.

Haven't had time to dig in detail but maybe soon...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

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'll bump the image and address the other feedback tomorrow.

Copy link
Owner

Choose a reason for hiding this comment

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

Oh, awesome! That would be awesome to use!

RSpec.configure do |config|
# Add #dom_id support
config.include ActionView::RecordIdentifier, type: :system
config.include BetterRailsSystemTests, type: :system
config.include CapybaraInlineScreenshot::Minitest, type: :system
Copy link
Owner

Choose a reason for hiding this comment

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

would this work for the RSpec setup we have here? I'm exploring minitest as a default, but not there yet :)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gah sloppy paste 🤪 I was confused about setting all this up for mini test (not my preference) at work.

Personally I am an avid RSpec user.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

If you are interested I can show case a mini test setup too.

It isn't that different to be honest. Not sure if app templates work with dual setups but I could explore both now that I know how to do both.

Copy link
Owner

Choose a reason for hiding this comment

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

I guess the the main reason of a template are the default setups and samples. Might be fun to have a spinoff perhaps with minitest. Right now I would be totally happy with just RSpec setup.

rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* && \
truncate -s 0 /var/log/*log
truncate -s 0 /var/log/*log &&
Copy link
Owner

Choose a reason for hiding this comment

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

I think && should not be here actually, there is nothing after it.

@peterberkenbosch
Copy link
Owner

Thanks again @mhenrixon, I have cherry-picked the Docker related updates in the the js-css builders PR that just got merged into main. Closing this for now. Will look at using the better-systems specs with Cuprite soon.

@mhenrixon mhenrixon deleted the feature/cuprite branch October 31, 2021 20:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants