0

The protractor configuration and scripts work as expected both on our local development environment and in a continuous integration environment (similar to Codeship).

The project structure is the following (I'm describing the Codeship env. status below):

The AngularJS app requests data from the REST API build with the Ruby on rails app, using AJAX requests.

In our Codeship configuration we set up the rails app, migrate and seed the database so that all necessary data is available.

The AngularJS app is also configured correctly since the login page is rendered as expected (I'm doing a print screen, and the main page is loaded correctly).

The usename and password are filled in by protractor using valid credentials (available in the mysql DB).

But when clicking the 'Log In' button the returned response from the AJAX call is a 405 Method Not Allowed.

As we never encountered this response in our other environments we believe it has something to do with the specific codeship setup.

Any thoughts why the API would return 405 only on Codeship?

The setup is below:

rvm use 2.2.0 --install
cp config/database.codeship.yml config/database.yml
bundle install
export RAILS_ENV="test"
bundle exec rake db:drop RAILS_ENV=test
bundle exec rake db:create RAILS_ENV=test
bundle exec rake db:test:prepare
bundle exec rake db:migrate RAILS_ENV=test
bundle exec rake seed:migrate RAILS_ENV=test
cd frontend && npm install && cd ..
npm install -g grunt-cli
npm install -g http-server
cd frontend && npm install bower && cd ..
cd frontend && bower install && cd ..
cd frontend && grunt build && cd ..
cd frontend && webdriver-manager update --standalone && cd ..
export RAILS_ENV="development"
rake db:structure:load
rake seed:migrate
http-server public -a 127.0.0.1 -p 9000 > /dev/null &
http-server app > /dev/null &
bundle exec rake
cd frontend && grunt test && cd ..

Here is the part of the screenshot that shows the API response: enter image description here

Ioana Cucuruzan
  • 845
  • 1
  • 8
  • 21

1 Answers1

0

In the end, the solution for us was to use protractor-rails - basically using the base url of the rails server instead of trying to run the app on a different URL through grunt. Our setup now looks like this:

rvm use 2.2.0 --install
cp config/database.codeship.yml config/database.yml
bundle install
# protractor tests
export RAILS_ENV="development"
rake db:structure:load
rake seed:migrate
npm install
webdriver-manager update
bundle exec rake protractor:init RAILS_ENV=development
bundle exec rake protractor:spec RAILS_ENV=development
# rails tests
bundle exec rake db:test:prepare
bundle exec rake db:migrate RAILS_ENV=test
bundle exec rake seed:migrate RAILS_ENV=test
bundle exec rake  
Ioana Cucuruzan
  • 845
  • 1
  • 8
  • 21