Skip to content

Kafka Mock Tests

The MR is !825 (closed)

Automatic Publishing tests for Book Components

The Cypress tests will take a Book, and Book Component, from the Status of 'Converting' (straight after upload and 'Submit'ing) through 'Loading Preview', 'Publishing' to 'Published'

The test works by calling custom tasks (cypress/plugins/index.js) to fake incoming Kafka notifications (normally sent via NCBI servers).

These notifications are the following

  1. convert_word_book_chapter_receipt to go from 'Converting' to 'Loading Preview'
  2. ingest_book_chapter_receipt to go from 'Loading Preview' to 'Previewing'
  3. A graphQL call is made here to simulate the user 'Publishing' the book component.
  4. ingest_book_chapter_receipt to go from 'Publishing' to 'Published'

Assumptions

That a book has been created, and book component created within that, a known DocX file uploaded, and submitted for conversion.

You have uploaded a DocX file corresponding to the correct Zip file configured in the fake Kakfa notification, since this will be downloaded, and has the right converted file for the DocX.

The BCMS should be configured to use the ftp server in docker-compose.yml You should use the name from the docker-compose.yml as the NCBI_FTP_HOST (currently ftpd_server) as this is setup automatically to work within the docker containers.

The pure-ftpd server uses the ncbi_project_directory/ftp-setup/data as the root directory of the ftp server. You should put converted file ZIPs for docx chapter processed components inside convert/word/out/ ie ncbi_project_directory/ftp-setup/data/convert/word/out/

Development To Do

Automate the following things, via the Cypress UI scripting, or back-end GraphQL process:

  1. Book creation
  2. Book Component creation
  3. DocX uploading
  4. Book Component submit for Conversion
  5. There is a hard-coded ZIP file for download in these scripts, corresponding to a particular docX -- this should probably be generalised. The converted file Zips live in the local pureFTPd server locations : ncbi_src_dir / ftp-setup / data / convert / word / out
  6. The hard-coded auth for GraphQL will need to be figured out - ie by scripting a login of an admin, and grabbing the token, or some other way.
  7. Assert that the book Component is actually in the "Published" state , if not FAIL.
Edited by Andy Nicholson