[go: up one dir, main page]

Page MenuHomePhabricator

Determine how to perform QA testing of Codex components inside a MediaWiki environment
Closed, ResolvedPublicSpike

Description

Overview

We currently develop and test Codex components in a standalone environment (basically, a single-page application / static website built using the Vite build tool). A lot of QA testing can be handled in this environment just fine. However, production use of these components will primarily take place within MediaWiki, where many things work differently.

Some limitations of our current workflow:

  • Our current Codex demo tools currently have very little support for internationalization – no i18n messages defined, no ability to preview components in non-Latin scripts, etc
  • Components that are embedded within a MW skin or extension will need to properly integrate with existing CSS styles, responsive behavior, and non-Vue parts of the page
  • In the future MediaWiki may introduce experimental support for server-side-rendering of Vue.js features; we will need a way to ensure that Codex components work properly in this environment once this happens

Proposal

DST has already developed (and continues to maintain) a simple MediaWiki extension called VueTest: https://gerrit.wikimedia.org/r/admin/repos/mediawiki/extensions/VueTest

This extension was originally created to serve as an example to developers of how to use Vue inside a MediaWiki environment; it has never been deployed anywhere, but developers can set it up within a local MW development environment – or they can just consult the source code as a reference.

With some additional work, we can utilize the VueTest extension as a QA tool for testing out Codex components inside of MediaWiki.

  1. Update the VueTest extension to display a series of sub-pages - one per component. The configurable component demos (from the Codex docs) could be embedded in these sub-pages for testing. There would be no need to include the surrounding Markdown text. However, some work will need to be done to adapt the Wrapper and Controls components for use in MW, and the Codex Demo components will need to be packaged in a way that they can be used inside MW.
  2. Testers can then use https://patchdemo.wmflabs.org/ to stage a test wiki that contains the VueTest extension as wellas the latest version of Codex. Patches can be applied in order to demo unmerged components. This will let QTE folks test components in a production-like environment.
  3. Demos from Codex won't fully support internationalization without being re-written. We should come back to this problem after we get everything else working.

Priority of this work

The current Codex demo pages (standalone) are suitable for about 90% of current manual testing needs, according to @EUdoh-WMF. This work would be an improvement in our testing process (it would allow us to test in a much more production-like environment) but it's not urgently needed right now.

I think that we could identify some follow up tasks here and focus on them as time allows over the next few sprints, at a secondary level of priority.

Questions

There are still some questions that must be resolved before we can settle on this approach. This spike task can be closed when all of these questions have been resolved. Some of these may necessitate the creation of new follow-up tickets.

  • Codex already contains some demo code that is useful for testing each component – both in the documentation as well as in the developer sandbox page. How can we pull in this demo code (which is currently not packaged for distribution in any way) into the VueTest extension? Will we need to manually copy things over each time a new component is added?
  • How should we handle internationalization testing? Codex currently has no concept of internationalization – all content (labels, messages, slot content, etc) is seen as the responsibility of the consumer for now. VueTest can rely on MW's existing internationalization tools – including the Vue i18n plugin which exists in MW core. But to do this we will need to define i18n messages for VueTest, submit them to TranslateWiki, and then write demo code in such a way that it can use these internationalized messages instead of hard-coded strings. Doing this may make it more difficult to just import and re-use existing Codex demo code, since it is not written with any i18n system in mind.
    • Solution: Demos used inside of VueTest should be written to utilize Vue's <slot> feature, so that existing template code can be overridden when they are imported into MW; this will allow for use of MediaWiki's i18n system without having to rewrite Codex to be aware of it.
  • How will QTE testers have access to VueTest? This extension is not deployed anywhere currently. We have a couple of options:
    • Solution: Use Patchdemo (see point 2 above); eventually we also hope to get this up on Beta Labs
  • Can we ensure that VueTest continues to serve as good reference code for developers while making these other changes to benefit testers? Is one or the other use-case more important going forward?
    • Solution: A top level page (Special:VueTest) can remain as an example for developers to reference, while testers can use the subpages for manual testing of individual components.

Follow-up/refinements (9/28/22)

After some discussion we have decided that the best way to proceed here is to create a new sub-package of Codex that packages up component demos for use inside of the VueTest extension. Importantly, this approach will allow us to test WIP or experimental components that are not yet included in Codex public releases (similar to how the Docs site is able to access these components).

This task is tracked here: T318842: Enable embedding of Codex component demos inside of VueTest MediaWiki extension

Acceptance Criteria

  • All "open questions" are answered in this ticket, and any necessary follow-up tasks have been created

Event Timeline

I did something similar to test out different ways to build ResourceModules for use in MW: https://github.com/egardner/mediawiki-extensions-BuildSandbox. I've been using various branches to test out different kinds of tooling (Rollup, Vite, etc).

A more fleshed-out extension would be useful though!

Related, maybe we could set up some kind of feature flag in Core to allow MW to pull in WVUI "unstable" directly from GitHub?

AnneT renamed this task from Create a MediaWiki sandbox for WVUI testing to Develop strategy for testing Codex components in MediaWiki.Oct 12 2021, 1:39 PM
AnneT edited projects, added Codex; removed WVUI.
AnneT updated the task description. (Show Details)
AnneT added a subscriber: Mhurd.

I think a dedicated extension (something like mediawiki-extensions-CodexTest) that would be used on Beta and in local development (but never in production) might be the best approach here. Such an extension could add one or more Special pages, modify an example content page, demonstrate which styles get inherited from the active skin, etc. We could potentially run Selenium tests in CI too (say every time we release a new library version). Visual regression tests could be run against a special page created by this extension on the Beta cluster perhaps.

Maybe this is a crazy idea, but what if this extension also provided a ?uselatestcodex=1 query parameter that substituted the main branch version of Codex for the release version on an arbitrary page? I don't know offhand how you would do that, it would probably require some dark magic, but I think it could be a useful testing tool.

Edit: I just saw that this task also proposes adding a beta wiki that has this for every page, on reflection maybe that would be a more useful way to do it.

Sounds like @Mhurd has some ideas for a dockerized Mediawiki instance that could be used for this purpose. One advantage of this approach is it could be used by human testers but is also scriptable and deployable.

Coming back to this task a year later, I think the best solution is going to be for us to use the VueTest extension for this purpose. The extension was recently updated to showcase all the currently existing Codex components, and we can continue to make improvements to it in order to facilitate usage by QA testers.

VueTest plus @Mhurd's script to build a MW env in Docker with a target Codex patch should do everything we need, as long as testers can spin up a local MW Docker environment.

egardner renamed this task from Develop strategy for testing Codex components in MediaWiki to Improve the VueTest extension so that it is useful for QA-ing Codex components within a MW environment.Jul 20 2022, 7:58 PM
egardner updated the task description. (Show Details)
egardner added a subscriber: EUdoh-WMF.
egardner changed the subtype of this task from "Task" to "Spike".Aug 10 2022, 6:46 PM
egardner renamed this task from Improve the VueTest extension so that it is useful for QA-ing Codex components within a MW environment to Determine how to perform QA testing of Codex components inside a MediaWiki environment.Aug 10 2022, 7:37 PM
egardner triaged this task as Medium priority.
egardner updated the task description. (Show Details)
egardner changed the task status from Open to In Progress.Aug 10 2022, 7:40 PM

Adding https://phabricator.wikimedia.org/T314082 as a parent. We discussed today in engineering enclave and decided this would be a good next scoping task to take on

August 30, 2022 Spike Review w/ Product

    • What would the Cost of Maintenance look like for this proposal?
    • Would version control impact this work at all?
    • Can we outline the high level steps needed to deliver this work?
  • 1 task for embedding configurable demos into mediawiki page and keep in sync
    • Goal have multiple pages that can be internationalization
    • can run it through patchdemo and check a few boxes in a form to spin up your own instance of MW to test an in progress patch
  • Spike on internationalization
      • use translate extension
      • volunteers would submit translations
    • MW has an internationalization plugin but we don't have anything for Codex

Questions:

    • What does this process look like?
      • would do a manual process for new components
      • can test how a component looks in different skins, etc for MW testing, other testing can be done in demo pages easily so no real need to do
      • ultimate test is will this in Mediawiki core
      • current demo site is default but MW site would become default as it is the primary use case
        • part of why the goal is to keep demos in sync is so it is easy to use
      • could eventually use in WMF labs in beta to test visual regressions,
      • keep doc site for repository of knowledge
  • How do we know status of QA by component and environment in MW?
    • potentially create a test repo and do sign off
    • add this stuff to phabricator
    • maybe put release notes somewhere (like Git)

Action Items:

  • @egardner create tiickets for:
    • an Epic for embedding configurable demos into mediawiki
    • Research spike - How to internationalize all of this
    • figure out best way to publish logs for QA

Action Items:

  • @egardner create tiickets for:
    • an Epic for embedding configurable demos into mediawiki
    • Research spike - How to internationalize all of this
    • figure out best way to publish logs for QA

I'll file these new tasks after our team process meeting on Thursday.

egardner updated the task description. (Show Details)

Closing this task because we now have a clear way forward (see updated task description for details). The immediate follow-up is T318842: Enable embedding of Codex component demos inside of VueTest MediaWiki extension.