Page MenuHomePhabricator

Use rspec-expectations "expect" syntax instead of "should" syntax
Closed, DeclinedPublic

Description

For list of repositories see https://www.mediawiki.org/wiki/Repositories_with_Ruby_code

For more information see https://www.mediawiki.org/wiki/Manual:Coding_conventions/Selenium#expect_or_should

Still not implemented in:

  • mediawiki/extensions/ArticleFeedbackv5
  • mediawiki/extensions/CirrusSearch
  • mediawiki/extensions/ContentTranslation
  • mediawiki/extensions/Flow
  • mediawiki/extensions/Gather
  • mediawiki/extensions/MultimediaViewer
  • mediawiki/extensions/PdfHandler
  • mediawiki/extensions/Translate
  • mediawiki/extensions/TwnMainPage
  • mediawiki/extensions/UniversalLanguageSelector
  • mediawiki/extensions/UploadWizard
$ grep --include *.rb  -R -F '.should' .

mediawiki/vagrant/mediawiki/extensions/ArticleFeedbackv5/tests/browser/features/step_definitions/aftv5_steps.rb:    page.yes_element.when_present.should be_visible
...
mediawiki/vagrant/mediawiki/extensions/CirrusSearch/tests/browser/features/step_definitions/page_steps.rb:    result.status.should eq 200
...
mediawiki/vagrant/mediawiki/extensions/ContentTranslation/tests/browser/features/step_definitions/basic_mt_steps.rb:  on(ContentTranslationPage).translation_editor_element.text.should == text
...
mediawiki/vagrant/mediawiki/extensions/Flow/tests/browser/features/step_definitions/description_steps.rb:    page.description.content.should eq(content)
...
mediawiki/vagrant/mediawiki/extensions/Gather/tests/browser/features/step_definitions/recent_collections_steps.rb:  on(GatherRecentPage).collection_one_hundred_element.should exist
...
mediawiki/vagrant/mediawiki/extensions/MultimediaViewer/tests/browser/features/step_definitions/mmv_options_steps.rb:  on(E2ETestPage).mmv_options_menu_disable_element.should be_visible
...
mediawiki/vagrant/mediawiki/extensions/PdfHandler/tests/browser/features/step_definitions/pdf_steps.rb:  on(PdfPage).download_as_pdf_element.should exist
...
mediawiki/vagrant/mediawiki/extensions/Translate/tests/browser/features/step_definitions/manage_translator_sandbox_steps.rb:	on(UserPage).babel_box_has_languages?(languages).should be_true
...
mediawiki/vagrant/mediawiki/extensions/TwnMainPage/tests/browser/features/step_definitions/signed_in_and_approved_user_steps.rb:		page.number_of_translators_element.should be_visible
...
mediawiki/vagrant/mediawiki/extensions/UniversalLanguageSelector/tests/browser/features/step_definitions/accept_language_steps.rb:  on(MainPage).main_page_element.text.should == text
...
mediawiki/vagrant/mediawiki/extensions/UploadWizard/tests/browser/features/step_definitions/chunked_upload_steps.rb:  on(UploadPage).continue_element.when_present(300).should be_visible
...

Event Timeline

bzimport raised the priority of this task from to Low.Nov 22 2014, 3:11 AM
bzimport set Reference to bz66369.

@Zeljko: I am not able to assign the bug to myself.Could you please look into it.
I cannot see the "Edit" link.

(In reply to Željko Filipin from comment #1)

Pick a repository:

https://github.com/wikimedia/mediawiki-selenium#links

Replace all expect syntax with should syntax.

Editing the above line to :
 > Replace all should syntax with expect syntax.

Change 146712 had a related patch set uploaded by Jagori79:
WIP [BrowserTest] Use rspec-expectations expect syntax instead of should syntax

https://gerrit.wikimedia.org/r/146712

Change 147423 had a related patch set uploaded by Zfilipin:
Use rspec-expectations expect syntax instead of should syntax

https://gerrit.wikimedia.org/r/147423

Change 147423 merged by jenkins-bot:
Use rspec-expectations expect syntax instead of should syntax

https://gerrit.wikimedia.org/r/147423

Change 146712 abandoned by Zfilipin:
WIP [BrowserTest] Use rspec-expectations expect syntax instead of should syntax

Reason:
No activity on the commit in months. Please restore if you plan to work on this.

https://gerrit.wikimedia.org/r/146712

Change 146712 restored by Jagori79:
WIP [BrowserTest] Use rspec-expectations expect syntax instead of should syntax

Reason:
Restoring

https://gerrit.wikimedia.org/r/146712

Zeljko:I see the changes already implemented for Visual editor code,should I abandon the part which I was working on :https://gerrit.wikimedia.org/r/#/c/146712/

I had restored it .

If the change you were working on is already implemented, it probably makes sense to abandon your commit. We have plenty of other repositories where the change should be implemented. :)

https://github.com/wikimedia/mediawiki-selenium#links

Thanks,Yes,will work on the other repositories.

Change 146712 abandoned by Jagori79:
WIP [BrowserTest] Use rspec-expectations expect syntax instead of should syntax

Reason:
I am abandoning this change as already been implemented for Visual Editor.I will make the expect syntax changes on other codebase as suggested by Chris on the QA mailing list.

https://gerrit.wikimedia.org/r/146712

Change 179072 had a related patch set uploaded (by Physikerwelt):
Refactor code for RSpec3 expect syntax incorporation

https://gerrit.wikimedia.org/r/179072

Patch-For-Review

Change 186947 had a related patch set uploaded (by Jagori79):
RSpec3 expect syntax incorporation

https://gerrit.wikimedia.org/r/186947

Patch-For-Review

Change 186947 had a related patch set uploaded (by Jagori79):
RSpec3 expect syntax incorporation

https://gerrit.wikimedia.org/r/186947

Patch-For-Review

Change 186949 had a related patch set uploaded (by Jagori79):
Changing should to expect syntax

https://gerrit.wikimedia.org/r/186949

Patch-For-Review

Change 187269 had a related patch set uploaded (by Jagori79):
RSpec3 expect syntax incorporation

https://gerrit.wikimedia.org/r/187269

Patch-For-Review

I was not able to test this for the Math Extension:
See my comment in gerrit:
"
I could not test the effects of this change. I tried to run the tests on labs-vagrant instance following the guide at https://www.mediawiki.org/w/index.php?title=Quality_Assurance/Browser_testing/Running_tests#Running_VisualEditor_browser_tests_via_labs-vagrant However, even on master I get the following output https://gist.github.com/physikerwelt/5761056c077c02a8c636
"

Change 179072 merged by jenkins-bot:
Refactor code for RSpec3 expect syntax incorporation

https://gerrit.wikimedia.org/r/179072

Change 187269 merged by jenkins-bot:
RSpec 3 expect syntax incorporation

https://gerrit.wikimedia.org/r/187269

Change 186949 merged by jenkins-bot:
Change RSpec 2 should syntax to RSpec 3 expect syntax

https://gerrit.wikimedia.org/r/186949

zeljkofilipin renamed this task from use rspec-expectations expect syntax instead of should syntax to Use rspec-expectations "expect" syntax instead of "should" syntax.Mar 20 2015, 1:22 PM
zeljkofilipin reopened this task as Open.

Change 186947 merged by jenkins-bot:
Use rspec-expectations "expect" syntax instead of "should" syntax

https://gerrit.wikimedia.org/r/186947

Sorry for closing this bug. I thought it was only about the Math extension, because the project Math was specified. I think in the future it might be better to add subtasks for each extension.

@Physikerwelt: no problem. I think it would be a lot of noise if we created 20 or so subtasks, but it is something to consider for the future tasks.

@Jagori79 are you working on this? If not, please remove yourself from "assigned to". Thanks.

Removed release-engineering, since it does not belong there.
Removed patch-for-review, since all related patches (as far as I can see) are merged or abandoned.