[Wikitech-l] Re: Fwd: Re: Code coverage for JavaScript testing?

2021-10-27 Thread Siddharth VP
There's also the https://github.com/wikimedia-gadgets/mock-mediawiki
project which provides a more comprehensive mock mediawiki environment,
best used with Jest (though it can be used with any test runner).

On Thu, 28 Oct 2021 at 06:00, Jon Robson  wrote:

> I recommend using Jest  for
> unit testing with code coverage.
>
> In various Vue.js extensions including NearbyPages
>  we use
> Jest which is recommended by the Vue.js migration team.
>
> An alternative approach is to use QUnit. In MobileFrontend and Popups we
> use a command line version of QUnit. It’s not tied to Webpack in any way
> despite the title (it would work with packageFiles these days). (
> https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports
> )
>
> When using command line unit testing you'll need to use
> @wikimedia/mw-node-qunit  for
> providing a mock MediaWiki environment. Despite the name this library can
> be used with Jest (see NearbyPages for an example).
>
> Hope this is helpful!
>
> On Wed, Oct 27, 2021 at 7:51 AM planetenxin  wrote:
>
>>
>> Hi Greg,
>>
>> actually I'm more interested in creating the coverage reports on a local
>> dev box in the context of extension development / local CI (checking the
>> coverage of newly created JS tests). I did find info about running JS tests
>> but little to nothing about coverage. Maybe I missed something.
>>
>> /Alexander
>>
>> Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
>> > On Tue, Oct 26, 2021 at 2:31 AM planetenxin > > wrote:
>> >
>> > Is there a generic approach, how to get some coverage reports for
>> the JavaScript parts of MW and MW extensions?
>> >
>> >
>> > Is https://doc.wikimedia.org/cover/ 
>> helpful in your case?
>> >
>> > --
>> > | Greg Grossmeier  GPG: B2FA 27B1 F7EB D327 6B8E |
>> > | Dir. Engineering Productivity A18D 1138 8E47 FAC8 1C7D |
>> ___
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
>>
>> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
> ___
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Fwd: Re: Code coverage for JavaScript testing?

2021-10-27 Thread Jon Robson
I recommend using Jest  for unit
testing with code coverage.

In various Vue.js extensions including NearbyPages
 we use Jest
which is recommended by the Vue.js migration team.

An alternative approach is to use QUnit. In MobileFrontend and Popups we
use a command line version of QUnit. It’s not tied to Webpack in any way
despite the title (it would work with packageFiles these days). (
https://mediawiki.org/wiki/User:Jdlrobson/Developing_with_Webpack_and_ResourceLoader#Writing_unit_tests_and_getting_code_coverage_reports
)

When using command line unit testing you'll need to use
@wikimedia/mw-node-qunit  for
providing a mock MediaWiki environment. Despite the name this library can
be used with Jest (see NearbyPages for an example).

Hope this is helpful!

On Wed, Oct 27, 2021 at 7:51 AM planetenxin  wrote:

>
> Hi Greg,
>
> actually I'm more interested in creating the coverage reports on a local
> dev box in the context of extension development / local CI (checking the
> coverage of newly created JS tests). I did find info about running JS tests
> but little to nothing about coverage. Maybe I missed something.
>
> /Alexander
>
> Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:
> > On Tue, Oct 26, 2021 at 2:31 AM planetenxin  planeten...@web.de>> wrote:
> >
> > Is there a generic approach, how to get some coverage reports for
> the JavaScript parts of MW and MW extensions?
> >
> >
> > Is https://doc.wikimedia.org/cover/ 
> helpful in your case?
> >
> > --
> > | Greg Grossmeier  GPG: B2FA 27B1 F7EB D327 6B8E |
> > | Dir. Engineering Productivity A18D 1138 8E47 FAC8 1C7D |
> ___
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Selenium tests are getting failed for EntitySchema extension

2021-10-27 Thread agha . saad04
Sorry pasted wrong link.

I am following this document 
https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/EntitySchema.
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Selenium tests are getting failed for EntitySchema extension

2021-10-27 Thread agha . saad04
Hi,
I am trying to run selenium test suite for EntitySchema extension. I have 
followed this
https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/Popups. Some of the 
test cases
are getting failed. 

Logs:
$ npm run selenium-test

> selenium-test
> wdio tests/selenium/wdio.conf.js


Execution of 5 spec files started at 2021-10-27T21:45:50.128Z

[0-0] RUNNING in chrome - /tests/selenium/specs/editSchema.js
[0-0] Error in "Schema Edit Page.given that a user is allowed.returns to schema 
view page on submit"
Error: element (".entityschema-label") still not displayed after 5000ms
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at ViewSchemaPage.getId 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/pageobjects/view.schema.page.js:66:56)
at Context. 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/specs/editSchema.js:44:19)
[0-0] FAILED in chrome - /tests/selenium/specs/editSchema.js
[0-1] RUNNING in chrome - /tests/selenium/specs/helloworld.js
[0-1] PASSED in chrome - /tests/selenium/specs/helloworld.js
[0-2] RUNNING in chrome - /tests/selenium/specs/special/new.js
[0-2] PASSED in chrome - /tests/selenium/specs/special/new.js
[0-3] RUNNING in chrome - 
/tests/selenium/specs/special/setEntitySchemaLabelDescriptionAliases.js
[0-3] Error in "SetEntitySchemaLabelDescriptionAliasesPage:Page.is possible to 
edit Schema identifying information"
Error: element (".entityschema-description[lang=en]") still not existing after 
5000ms
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at ViewSchemaPage.getDescription 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/pageobjects/view.schema.page.js:33:85)
at Context. 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/specs/special/setEntitySchemaLabelDescriptionAliases.js:48:38)
[0-3] Error in "SetEntitySchemaLabelDescriptionAliasesPage:Page.is possible to 
edit Schema in another language"
Error: element (".entityschema-description[lang=de]") still not existing after 
5000ms
at processTicksAndRejections (internal/process/task_queues.js:95:5)
at ViewSchemaPage.getDescription 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/pageobjects/view.schema.page.js:33:85)
at Context. 
(/media/saad/sda9/Outreachy-2021-Dec/Wikimedia/mediawiki/extensions/EntitySchema/tests/selenium/specs/special/setEntitySchemaLabelDescriptionAliases.js:64:38)
[0-3] FAILED in chrome - 
/tests/selenium/specs/special/setEntitySchemaLabelDescriptionAliases.js
[0-4] RUNNING in chrome - /tests/selenium/specs/viewSchema.js
[0-4] PASSED in chrome - /tests/selenium/specs/viewSchema.js

 "dot" Reporter:
..F..FF...

Spec Files:  3 passed, 2 failed, 5 total (100% completed) in 00:01:14 

Any dependencies that I need to add? Any leads would be helpful.

#selenium #EntitySchema #extensions #testsuite #testcases
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Re: How do I make VE *not* save/recover my changes?

2021-10-27 Thread Strainu
Thanks David. I just tried this and it only seems to work if I go back to
the article via the tabs. Any other tab or link doesn't work. I've logged
https://phabricator.wikimedia.org/T294463 so the team can check if this is
intended or not.

Have a good day,
Strainu

Pe miercuri, 27 octombrie 2021, David Lynch  a scris:
> Leave the editing mode "cleanly" -- saving, navigating back to the
article via the tabs, following a sidebar link to another page, hitting
escape, whatever. If you stop editing in a way that we can tell is
intentional, you'll be asked if you want to discard your changes, and if
you say that you do then it'll all get cleaned up. (We can't tell the
difference between "I deliberately closed this tab because I want to get
rid of this" and "I accidentally closed the wrong tab and I'll be very
upset if my changes are lost", unfortunately...)
> If you want it to never autosave your changes, you could disable local
session storage for the wikis you use at the browser level. But that might
have side-effects outside of VE.
> We don't have any preferences that'd control the autosave, and I don't
think that we have any current plans to implement something like that.
> ~David
> On Wed, Oct 27, 2021 at 11:14 AM Strainu  wrote:
>>
>> Hi,
>>
>> I've been searching quite a bit on MediaWiki.org but I can't find how
>> to tell the VisualEditor to stop saving and (especially) recovering
>> changes that I haven't explicitly saved. Is there a method?
>>
>> Thanks,
>> Strainu
>> ___
>> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
>> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
>>
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: How do I make VE *not* save/recover my changes?

2021-10-27 Thread David Lynch
Leave the editing mode "cleanly" -- saving, navigating back to the article
via the tabs, following a sidebar link to another page, hitting escape,
whatever. If you stop editing in a way that we can tell is intentional,
you'll be asked if you want to discard your changes, and if you say that
you do then it'll all get cleaned up. (We can't tell the difference between
"I deliberately closed this tab because I want to get rid of this" and "I
accidentally closed the wrong tab and I'll be very upset if my changes are
lost", unfortunately...)

If you want it to never autosave your changes, you could disable local
session storage for the wikis you use at the browser level. But that might
have side-effects outside of VE.

We don't have any preferences that'd control the autosave, and I don't
think that we have any current plans to implement something like that.

~David

On Wed, Oct 27, 2021 at 11:14 AM Strainu  wrote:

> Hi,
>
> I've been searching quite a bit on MediaWiki.org but I can't find how
> to tell the VisualEditor to stop saving and (especially) recovering
> changes that I haven't explicitly saved. Is there a method?
>
> Thanks,
> Strainu
> ___
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] How do I make VE *not* save/recover my changes?

2021-10-27 Thread Strainu
Hi,

I've been searching quite a bit on MediaWiki.org but I can't find how
to tell the VisualEditor to stop saving and (especially) recovering
changes that I haven't explicitly saved. Is there a method?

Thanks,
Strainu
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Fwd: Re: Code coverage for JavaScript testing?

2021-10-27 Thread planetenxin


Hi Greg,

actually I'm more interested in creating the coverage reports on a local dev 
box in the context of extension development / local CI (checking the coverage 
of newly created JS tests). I did find info about running JS tests but little 
to nothing about coverage. Maybe I missed something.

/Alexander

Am 27.10.2021 um 01:37 schrieb Greg Grossmeier:

On Tue, Oct 26, 2021 at 2:31 AM planetenxin mailto:planeten...@web.de>> wrote:

Is there a generic approach, how to get some coverage reports for the 
JavaScript parts of MW and MW extensions?


Is https://doc.wikimedia.org/cover/  helpful 
in your case?

--
| Greg Grossmeier              GPG: B2FA 27B1 F7EB D327 6B8E |
| Dir. Engineering Productivity     A18D 1138 8E47 FAC8 1C7D |

___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/

[Wikitech-l] Re: Getting CirrusSearch full-text search to incorporate a new field?

2021-10-27 Thread Matto Marjanovic

On 10/25/21 9:23 AM, Matto Marjanovic wrote:
...

   o  SearchDataForIndexHook is run by getDataForSearchIndex() in each
  ContentHandler, but the design ensures that it is run at some
  ambiguous place in the middle of getDataForSearchIndex(), instead
  of resolutely at the end.

   o  SearchIndexFieldsHook *is not* run by getFieldsForSearchIndex() of a
  ContentHandler.  This means that CirrusSearch\BuildDocument never
  sees the definitions for any fields added by the hook.  The only code
  in CirrusSearch that does see the definitions is MappingConfigBuilder
  (maintenance code).

I suppose I should figure out how to file a bug report somewhere.


Follow-up for anyone following this thread: with thanks to all the
good documentation (and those who wrote/write it), I did indeed file a
bug report and a (first) patch.

https://phabricator.wikimedia.org/T294405

-mm
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Re: Selenium tests are getting failed for Popups extension

2021-10-27 Thread agha . saad04
Hi,

I have made a few more changes and now test cases are getting passed.

$ npm run selenium-test

> selenium-test
> wdio tests/selenium/wdio.conf.js


Execution of 2 spec files started at 2021-10-27T11:43:14.577Z

[0-0] RUNNING in chrome - /tests/selenium/specs/page_previews.js
[0-0] PASSED in chrome - /tests/selenium/specs/page_previews.js
[0-1] RUNNING in chrome - /tests/selenium/specs/reference_previews.js
[0-1] PASSED in chrome - /tests/selenium/specs/reference_previews.js

 "dot" Reporter:
...

Spec Files:  2 passed, 2 total (100% completed) in 00:00:18.

Thanks for your help. I have also updated the docs 
https://www.mediawiki.org/w/index.php?title=MediaWiki-Docker/Extension/Popups=4887193.

Cheers,
Agha Saad
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Re: Selenium tests are getting failed for Popups extension

2021-10-27 Thread agha . saad04
Hi Christopher, Thanks for the quick response.
I have installed the two dependencies that are PageImages and TextExtracts and 
also added them in LocalSettings.php file but still facing the same. 

Execution of 2 spec files started at 2021-10-27T09:03:43.737Z

[0-0] RUNNING in chrome - /tests/selenium/specs/page_previews.js
[0-0] AssertionError in "Dwelling on a valid page link I should see a page 
preview"
AssertionError [ERR_ASSERTION]: Page preview is shown.
at Context. 
(/mediawiki/extensions/Popups/tests/selenium/specs/page_previews.js:18:3)
[0-0] AssertionError in "Dwelling on a valid page link Quickly hovering, 
abandoning and re-hovering a link shows page preview"
AssertionError [ERR_ASSERTION]: Page preview is shown.
at Context. 
(/mediawiki/extensions/Popups/tests/selenium/specs/page_previews.js:31:3)
[0-0] FAILED in chrome - /tests/selenium/specs/page_previews.js
[0-1] RUNNING in chrome - /tests/selenium/specs/reference_previews.js
[0-1] PASSED in chrome - /tests/selenium/specs/reference_previews.js

 "dot" Reporter:
F.F

Spec Files:  1 passed, 1 failed, 2 total (100% completed) in 00:00:21.

Let me know If I need to update anything else. Thanks
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/


[Wikitech-l] Re: Selenium tests are getting failed for Popups extension

2021-10-27 Thread Christoph Jauera
Hi,

it seems that the instructions on the docker page a incomplete. I think you
also need Extension:TextExtracts

and Extension:PageImages

installed see Extension:Popups#Dependencies
.

So clone these two to your extension directory and load them in the
LocalSettings.php - I think they must be added there before you load the
Popups extension.

Hope that helps, if it works you could update the docker help page. ( or
just poke and I do it ;-) )

best
Fisch


Am Di., 26. Okt. 2021 um 16:27 Uhr schrieb :

> Hi,
>
> I am trying to run selenium test suite for Popups extension. I have
> followed this
> https://www.mediawiki.org/wiki/MediaWiki-Docker/Extension/Popups. Some of
> the test cases are getting failed.
>
> [0-0] RUNNING in chrome - /tests/selenium/specs/page_previews.js
> [0-0] AssertionError [ERR_ASSERTION] in "Dwelling on a valid page link I
> should see a page preview"
> AssertionError [ERR_ASSERTION]: Page preview is shown.
> at Context.
> (/core/extensions/Popups/tests/selenium/specs/page_previews.js:18:3)
> [0-0] AssertionError [ERR_ASSERTION] in "Dwelling on a valid page link
> Quickly hovering, abandoning and re-hovering a link shows page preview"
> AssertionError [ERR_ASSERTION]: Page preview is shown.
> at Context.
> (/core/extensions/Popups/tests/selenium/specs/page_previews.js:31:3)
> [0-0] FAILED in chrome - /tests/selenium/specs/page_previews.js
> [0-1] (node:6255) ExperimentalWarning: The dns.promises API is experimental
> [0-1] (node:6255) ExperimentalWarning: The fs.promises API is experimental
> [0-1] RUNNING in chrome - /tests/selenium/specs/reference_previews.js
> [0-1] PASSED in chrome - /tests/selenium/specs/reference_previews.js
>
>  "dot" Reporter:
> F.F
>
> Spec Files:  1 passed, 1 failed, 2 total (100% completed) in 00:00:55
>
> Any dependencies that I need to add?
>
> #selenium #Popups #extensions #testsuite #testcases
> ___
> Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
> To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
> https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/
>


-- 
Christoph Jauera
Software Developer

Wikimedia Deutschland e. V. | Tempelhofer Ufer 23-24 | 10963 Berlin
Phone: +49 (0)30 219 158 26-0
https://wikimedia.de

Imagine a world in which every single human being can freely share in the
sum of all knowledge. Help us to achieve our vision!
https://spenden.wikimedia.de

Wikimedia Deutschland – Gesellschaft zur Förderung Freien Wissens e. V.
Eingetragen im Vereinsregister des Amtsgerichts Berlin-Charlottenburg unter
der Nummer 23855 B. Als gemeinnützig anerkannt durch das Finanzamt für
Körperschaften I Berlin, Steuernummer 27/029/42207.
___
Wikitech-l mailing list -- wikitech-l@lists.wikimedia.org
To unsubscribe send an email to wikitech-l-le...@lists.wikimedia.org
https://lists.wikimedia.org/postorius/lists/wikitech-l.lists.wikimedia.org/