Not yet learned, but I'm trying to add some FE testing with Cypress to my Flask app.
I'm getting stuck a lot, as I didn't use npm before, and I'm not really undestanding GitHub Action workflows (where I want my tests to run).
This is one of these moment where 10min chat with someone who knows things would save me hours of frustration, and hours of refactoring later.
however, I made the tests run in local easily, and I love how I can test my app interactively, so looking forward to time when it will be integrated and I will feel much safer about changing my code.
I'm a fan of Open Source and have a growing interest in serverless and edge computing. I'm not a big fan of spiders, but they're doing good work eating bugs. I also stream on Twitch.
Yeah, I'm still sort of stuck, on multiple levels. Basically, I'm unsure how the whole testing should be build around my app. More specifically:
1) I have unit tests in pytest, which uses some fixtures to set right database.
How do I somewhat integrate these two testing environments? Or how do I even think about them?
1b) Whats best practice -> recreating database data before every test?
2) It seems like I need to package.json on root of my app. however, in flask apps, I need to have normal js packages in /static folder to be usable (as i'm not using webpacker or something like that). so, i need to have two separate nmp projects inside my app? or I'm missing something?
3) I tried some way to create testing environment in Github Action, but I'm running into problems with pipenv/flask not working with correct env variables (thus not creating database). but thats sort of different issue.
2) If you want to keep inside one repository, you can create a directory just for Cypress inside. Inside that directory you can have a package.json and act like its a separate repo(or actually separate it to another repo).
Here is my cypress-template project with already split environments(dev, staging, prod)
You can definitely setup Github actions for any above mentioned structure.
1) When a commit occurs I would run(on both production and test/staging):
Lint
Unit tests
App build
e2e(cypress) test
Additionally, I would set up the project to Lint and unit test locally on every change before even commiting/pushing.
Not yet learned, but I'm trying to add some FE testing with Cypress to my Flask app.
I'm getting stuck a lot, as I didn't use
npm
before, and I'm not really undestanding GitHub Action workflows (where I want my tests to run).This is one of these moment where 10min chat with someone who knows things would save me hours of frustration, and hours of refactoring later.
however, I made the tests run in local easily, and I love how I can test my app interactively, so looking forward to time when it will be integrated and I will feel much safer about changing my code.
Jan, you can chat with me if you still feel stuck with npm and cypress?
Thanks for your kind offer!
Yeah, I'm still sort of stuck, on multiple levels. Basically, I'm unsure how the whole testing should be build around my app. More specifically:
1) I have unit tests in pytest, which uses some fixtures to set right database.
How do I somewhat integrate these two testing environments? Or how do I even think about them?
1b) Whats best practice -> recreating database data before every test?
2) It seems like I need to package.json on root of my app. however, in flask apps, I need to have normal js packages in /static folder to be usable (as i'm not using webpacker or something like that). so, i need to have two separate nmp projects inside my app? or I'm missing something?
3) I tried some way to create testing environment in Github Action, but I'm running into problems with pipenv/flask not working with correct env variables (thus not creating database). but thats sort of different issue.
Thanks for any pointers :)
2) If you want to keep inside one repository, you can create a directory just for Cypress inside. Inside that directory you can have a package.json and act like its a separate repo(or actually separate it to another repo).
Here is my cypress-template project with already split environments(dev, staging, prod)
You can definitely setup Github actions for any above mentioned structure.
1) When a commit occurs I would run(on both production and test/staging):
Additionally, I would set up the project to Lint and unit test locally on every change before even commiting/pushing.
1b) Sure.
3) I do not have any experience with Github Actions, sorry :/
I managed to make it working for now. It's for sure not the greatest, but I will hopefully improve it later, with more tests and so.
Thank you for your help and support!