arizona-linguistics / colrc-v2

COLRC version 2.0
5 stars 2 forks source link

Build unit tests for deployment workflow #242

Open amyfou opened 1 year ago

Mills-Josh commented 10 months ago

I've spent a good amount of time researching our options and testing jest with simpler mock projects. After spending hours trying to debug jest within the frontend side of the repo, this is my conclusion.

Current Status:

  1. Exact location for testing between containers unknown. Current best idea involves testing individually within each container, and executing npm run test from the frontend container (or the otherwise last container to start up) after a delay for any integration tests.
  2. Testing in Frontend faces dependency issues due to higher level react-scripts installed in project root
  3. If ignoring preflight checks and manually reinstalling valid jest version in /frontend, it fails to transpile Typescript components.
  4. Using .jsx components, it is still unable to transpile to files jest accepts.
  5. Either 3 or 4 is required in order to be able to test React components and hierarchy, props, etc.

My current assessment of this issue is that it currently not feasible to implement proper testing under our current architecture without a lot of fighting with npm or the hopeful integration of updated versions of core packages with unknown breaking changes.

I am going to confirm the functionality (or failure) of the test suite within the previous project configuration to ensure that these issues are not something introduced by my attempts to install additional packages for more features. It is possible that we can maintain some level of basic testing which may still be worthwhile, or that we can prepare a new container designed to start after other containers in the dev build and specifically run tests across all containers.

Mills-Josh commented 10 months ago

I have confirmed that, at least as of commit #5c13654 (the one before typescript was added) with a fresh install of node modules, the default app.test.js made with create-react-app still fails to compile (on my remote host).

We now need to come to a decision for this issue since the current method appears non-viable.

Mills-Josh commented 4 months ago

I saw some additional options we could use while working towards a professional certification.

It looks like one testing framework we can use for tests on the final webpage is the 'Behave' Python framework, which can enable you to use the 'Selenium' web driver to check for valid responses from various actions taken 'as a user would' and write assertions about behavior from a more layperson clear way (but with some potentially messy code to implement that beneath)

I'll have to look more into this to see how well these systems interact with a web page rendering via React, as well as what testing/integration it can have with a JS codebase, but this might be a decent option to try and get some tests with.