[go: up one dir, main page]

Page MenuHomePhabricator

MPIC: Frontend web testing
Open, LowPublic3 Estimated Story Points

Description

T360731

Description

Frontend is still consolidating and a lot of big changes are being done. It seems it's no the best time to prepare any test here. But, when consolidation finishes, we should create a solid web test suite that allows us to test all the functionality of MPIC while we keep working on the frontend side.

I have been exploring cypress as a framework to create end-to-end web tests. It seems that creating these tests with this library is not a lot of work and the time we can save is huge. There would be a bit of extra work if we want to prepare the frontend to be more testable ("tagging" properly web componentes somehow to identify them while coding the test cases, for example) but it's worth it.

There are already a couple of test cases working at https://gitlab.wikimedia.org/repos/data-engineering/mpic/-/tree/integration-tests?ref_type=heads (integration-tests branch that is WIP). Web tests can be run with `npx cypress run --spec cypress/e2e/mpic.cy.js'

Acceptance Criteria

  • We agree 'cypress' is the proper framework to use for web testing (of course this discussion is open to other frameworks) << Per T368612#10069663 and discussions with QTE, we opted to go with WebdriverIO
  • We have, at least, test cases for all the positive scenarios:
    • Instruments are listed properly
    • Register a new instrument
    • Modify an existing instrument
    • View an instrument
    • Delete an instrument

Notes

Event Timeline

Sfaci set the point value for this task to 3.

@Jrbranaa we are ready to test this work. Is this something you are ready to start helping us with as early as this week?

Goal is to prevent regressions when developing additional features and enhancements. @Sfaci what frameworks have you been investigating?

FYI @Jrbranaa

@Sfaci I noticed discussion about using Cypress, is there a reason the Selenium isn't being used? I only ask because that's the tooling/framework that we (QTE) support and that would be the quickest path forward for us to engage on it.

We are using mocha and jest to build unit and integration tests for the backend and I was investigating cypress to build web test cases.

There is no real reason to use cypress. I was investigating how to speed up web testing to avoid running manual steps everytime we add a new feature, I found it and I didn't know that Selenium was the supported framework. The work done with cypress was just a proof of concept to see if that framework could be used for MPIC and, as you can see at the ticket description, we left the discussion open to see if other framework could be better or more appropriate. So it seems that Selenium should be the one to use. I'm totally ok with that.

Fwiw I just picked up this task and i'm looking at VueJS recommendations for E2E testing solutions. Per VueJS docs, Cypress is their framework of choice. They do mention other options including one called Nightwatch which is based on Selenium Webdriver - @Jrbranaa would this suffice for QTE?

Or should we go the route of a straight up vanilla Selenium integration?

@cjming let me check with Željko to see if/how Nightwatch would integrate with our current framework.

Hi! I'm working on end-to-end testing here for more than a decade and I'm glad to help! Beware, I have opinions! 😄

QTE developed and is maintaining Selenium-based end-to-end testing framework (documentation). Deep down, the framework is using WebdriverIO. (It's one of the testing tools mentioned in Vue testing docs.)

By maintaining the framework, I mean projects like

I investigated Nightwatch back 2017 when we were switching our end-to-end testing from ruby to javascript (T139740). (Those were the times.) According to the blog post I wrote back then I wasn't impressed with Nightwatch. But, that was many years ago.

Last time I looked at Cypress in Wikimedia (T302489) it was used in several repositories.

We also evaluate Selenium/WebdriverIO alternatives from time to time.

After a few evaluations, the conclusion was that every tool we tried worked fine. (Including our current WebdriverIO.) The only reason we didn't switch to any of the alternatives is that there's an investment in webdriverio (about 30 repositories) and it would take time to rewrite the tests to another tool.

Good news is that our continuous integration should support any tool you choose (we have tested a few). But if you choose another tool, QTE can't help you. We only have experience with WebdriverIO.

QTE has office hours, Monday-Thursday 13:00-15:00 UTC. Let me know if anybody from the team can join the meeting any day next week. That would speed things up, if you need help. (The meeting is in my Google calendar. I can send invitations if that's more convenient.)

thanks @zeljkofilipin ! i will pop by in QTE's next office hours on Monday

The main takeaway that I got from your response is that we should go with WebdriverIO to stay aligned with QTE's workflows.