DEV Community

Discussion on: Using Cypress with Django and Vue for integration testing in GitLab CI

Collapse
 
aaronm14 profile image
Aaron Mead

@briancaffey Thanks for all of this (even though I am late to the game here).

I'm curious about what your python command recreate_db does. Is that a custom command or a library? What I'm struggling to do is figure out how to handle spinning up the database and shutting it down so that I can seed it from Cypress.

Collapse
 
briancaffey profile image
Brian Caffey

Also, I should mention that I have recently done lots of refactoring on this project and I am actively working on restructuring some of the Cypress-related code. If you are looking at this repo: gitlab.com/verbose-equals-true/dja..., it might be good look at the files from a commit with a date close to the time that this article was published, and keep an eye on it for updates! Hopefully I'll be coming back to the Cypress tests soon.

Collapse
 
briancaffey profile image
Brian Caffey

Hi, it has been a while since I looked at this, but I think that recreate_db is from another repo I was referencing: github.com/testdrivenio/testdriven.... There is another line from my code docker-compose -f docker-compose.ci.yml up -d --build that starts the database and runs migrations.

I think I removed the start_ci.sh file that is referenced by docker-compose.ci.yml, but this is where the database migration command would have been called, as well as any other custom management command used to seed data. In this way, I'm seeding the database from docker-compose commands, not from Cypress. Did you want to seed the database from Cypress itself?

Collapse
 
aaronm14 profile image
Aaron Mead

Ugh, I accidentally reloaded the page after having a more thoughtful response here, ha. But know that your references helped.

I ultimately used a shell script to drop & recreate db, then a custom Django command to seed it using Django test factories already being used by an existing Selenium test suite.