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

Changing jasmine tests to teaspoon-mocha #2997

Merged
merged 27 commits into from
Jul 20, 2018
Merged

Conversation

Souravirus
Copy link
Member

@Souravirus Souravirus commented Jul 6, 2018

Fixes #2967
Make sure these boxes are checked before your pull request (PR) is ready to be reviewed and merged. Thanks!

  • tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR -- or run tests locally with rake test
  • code is in uniquely-named feature branch and has no merge conflicts
  • PR is descriptively titled
  • PR body includes fixes #0000-style reference to original issue #
  • ask @publiclab/reviewers for help, in a comment below

We're happy to help you get this ready -- don't be afraid to ask for help, and don't be discouraged if your tests fail at first!

If tests do fail, click on the red X to learn why by reading the logs.

Please be sure you've reviewed our contribution guidelines at https://publiclab.org/contributing-to-public-lab-software

We have a loose schedule of reviewing and pulling in changes every Tuesday and Friday, and publishing changes on Fridays.

Thanks!

@ghost ghost assigned Souravirus Jul 6, 2018
@ghost ghost added the in progress label Jul 6, 2018
@plotsbot
Copy link
Collaborator

plotsbot commented Jul 6, 2018

2 Messages
📖 @Souravirus Thank you for your pull request! I’m here to help with some tips and recommendations. Please take a look at the list provided and help us review and accept your contribution! And don’t be discouraged if you see errors – we’re here to help.
📖 It looks like you haven’t marked all the checkboxes. Help us review and accept your suggested changes by going through the steps one by one. If it is still a ‘Work in progresss’, please include ‘[WIP]’ in the title.

Generated by 🚫 Danger


});

$('#like-button-1').trigger('click');
Copy link
Member Author

@Souravirus Souravirus Jul 8, 2018

Choose a reason for hiding this comment

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

Hi @jywarren, some help required here. I was trying to make this action work but its not calling the ajax function but in jasmine it was calling the ajax function. So, all the expect statement are failing.


$('#like-button-1').trigger('click');

// should trigger the following and our ajaxSpy should return a fake response of "4":
// jQuery.getJSON("/likes/node/1/create", {}, function() { ...
var response;
jQuery.getJSON("/likes/node/1/create").done(function(data){
Copy link
Member Author

Choose a reason for hiding this comment

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

While this function is calling the ajax function correctly which is being stubbed above.


expect($($('.notes-grid tr')[1]).find('td:first a').html()).toEqual('First post');
expect($($('.notes-grid tr')[1]).find('td:first a').html()).to.eql('First post');

$('table:first th:first a').trigger('click');

setTimeout(0, function() {
Copy link
Member Author

Choose a reason for hiding this comment

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

Hi @jywarren, can I know why we used setTimeout here. Can't we test this without it?

@jywarren
Copy link
Member

jywarren commented Jul 9, 2018 via email

@Souravirus
Copy link
Member Author

oh ok thanks!!

@Souravirus Souravirus force-pushed the mocha branch 2 times, most recently from 6391c8d to 2747ff9 Compare July 10, 2018 16:00
@Souravirus Souravirus closed this Jul 10, 2018
@ghost ghost removed the in progress label Jul 10, 2018
@Souravirus Souravirus reopened this Jul 10, 2018
@ghost ghost added the in progress label Jul 10, 2018
@Souravirus
Copy link
Member Author

Hi @jywarren, I don't know why but the travis tests are not running here. What might be the reason?

@Souravirus
Copy link
Member Author

It was running on the third-last commit.

@Souravirus
Copy link
Member Author

its working now

@Souravirus
Copy link
Member Author

Hi @jywarren this is complete. Please review it

@Souravirus Souravirus requested review from jywarren and a team July 10, 2018 18:35
@jywarren
Copy link
Member

This is great. I'd like to ask if another @publiclab/soc member could try installing this and running tests, as the phantomjs gem has caused me trouble in the past -- does it go smoothly?

Second, let's think about documentation of this in the TESTING docs?

Third, do you want to try introducing a JavaScript error and/or test failure and show what happens, in this PR? We can then resolve it and see that it resolves too. I'm thinking of how it'll be represented -- would Dangerbot be able to see it? Even if not, will it be clearly visible in the Travis log, and we could make an integration later to display it in a comment?

Thank you!!!

@Souravirus
Copy link
Member Author

Souravirus commented Jul 11, 2018

yeah this goes smoothly as far as I have tested it. It would be nice if someone from @publiclab/soc could try installing this.

yeah I would write documentation about it. Any help would be greatly appreciated.

About the representation of the error in Dangerbot. Not Dangerbot doesn't shows any error but travis tests don't pass and it shows red.

@Souravirus
Copy link
Member Author

I guess I have to work for showing the errors in Dangerbot. I have to study about dangerbot to get it working. Thanks!!

@jywarren
Copy link
Member

jywarren commented Jul 11, 2018 via email

@Souravirus
Copy link
Member Author

Yeah just see how it works I have created an intentional error.

@Souravirus
Copy link
Member Author

Hmm dangerbot doesn't shows any error but travis shows an error. That's what I was talking about. What do you think?

.travis.yml Outdated
@@ -27,6 +27,7 @@ install:

script:
- docker-compose exec web bash -c "CI=TRUE GENERATE_REPORT=true rake test:all"
- cat ./spec/TEST-Teaspoon-Result.xml >> output2.xml
Copy link
Member

Choose a reason for hiding this comment

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

Should maybe this be unnecessary since anything starting with TEST and ending with .xml will get compiled into output.xml?

Dangerfile Outdated
@@ -27,8 +27,12 @@ end

message "Pull Request is marked as Work in Progress" if github.pr_title.include? "[WIP]"

junit.parse "output2.xml"
Copy link
Member

Choose a reason for hiding this comment

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

ah ok. But then you could skip this part and have the original tests put in /spec/TEST-Teaspoon-Result.xml right?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ok I will directly parse /spec/TEST-Teaspoon-Result.xml

@jywarren
Copy link
Member

Hi, I think you may need to do puts or cat spec/TEST____.xml in order to read the output manually and see what it generates. I think there is also an issue with Danger reading the failures that has come up from time to time.

Either we should work on getting Danger to properly read and report the Junit tests, OR we should come up with another mechanism (maybe another bot?) to get Junit test reports (or anything from Travis) to be reported back.

If you end up using Jasmine, there are Junit reporters here: https://github.com/larrymyers/jasmine-reporters

There's some on Teaspoon and reports in CI here: https://github.com/jejacks0n/teaspoon#ci-support

@jywarren
Copy link
Member

I guess I think debugging Danger's reading of Junit failures is probably the best route. I think you could try to debug by outputting the compiled junit tests and trying to read them in the logs manually, as painstaking as that sounds.

@Souravirus
Copy link
Member Author

Ok I will try one of these especially the teaspoon ci reporter. Let's see how it works. But currently I am travelling back to my college. So, I will be fully available tomorrow.

@jywarren
Copy link
Member

jywarren commented Jul 18, 2018 via email

@Souravirus
Copy link
Member Author

Hi @jywarren, I have reverted all the changes related to reporting of the failures. Review this once. I will be submitting the reporting fix in another PR. Thanks!!

@jywarren
Copy link
Member

Great - so if a test fails, this will show a failure, but just as an X, without reporting, right? Or will JavaScript errors not trigger a Travis failure? Thanks!

@Souravirus
Copy link
Member Author

No travis will show a X, without reporting

@jywarren jywarren merged commit 1d6f21e into publiclab:master Jul 20, 2018
@ghost ghost removed the ready label Jul 20, 2018
@jywarren
Copy link
Member

Perfect! Merged! 🎉

@Souravirus Souravirus deleted the mocha branch July 20, 2018 21:00
SrinandanPai pushed a commit to SrinandanPai/plots2 that referenced this pull request May 5, 2019
* Changed jasmine tests to teaspoon-mocha

* Few corrections

* Corrected inline_grids_spec.js

* Some changes in first test of plots2_spec.js

* Made the first expect work

* made the click function above the jquery function in plots_spec

* Corrected the wikis_spec.js

* Corrected all tests in plots2_spec.js

* Corrected the Gemfile

* Running the rake test:all in Rakefile

* Corrected the rubocop offenses

* Corrected some identation problem in .travis.yml

* Passing the reports to dangerbot

* removed jasmine tasks from Rakefile and other modifications

* Modified the Dangerfile

* Modified the travis.yml

* Changed the Dangerfile

* Shortened test for js failure

* Some mistake while updation

* Some changes in .travis.yml

* Added junit-danger to Gemfile

* Modified the Dangerfile

* modification in Dangerfile

* Modified Dangerfile

* Modified the Dangerfile

* Written only junit.failures

* Reverted the changes required for Dangerbot reporting
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.

Jasmine tests not running
3 participants