Security News
Input Validation Vulnerabilities Dominate MITRE's 2024 CWE Top 25 List
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
@4tw/vue-cli-plugin-cypress-django
Advanced tools
Integration testing with cypress and django.
yarn add --dev @4tw/vue-cli-plugin-cypress-django
The plugin requires the cypress binary. https://www.npmjs.com/package/cypress
The plugin is able to interact with the django server and database. Therefore it is important to provide the djangopath when executing the tests. The djangopath should be the root directory of your project. The plugin assumes to have a manage.py
to interact with the django server.
The following database script need to be provided so the plugin can properly interact with the database:
bin/e2e_setup_db
(create and fill database before tests are executed)bin/e2e_reload_db
(reset database for isolation)bin/e2e_teardown_db
(cleanup database)What the script are doing is up to you but the goal they should achieve is described on the list above.
The databasename is provided during the execution as the first parameter $1
.
The management command load_e2e_data
is required if specific data should be loaded on a 'per test' basis. The command should accept an optional parameter: --datasets
.
The interactive mode enables you to run the e2e tests in the cypress electron app. This is best for development because you have hot reload when the production or test code is updated. You are also able to interact with the application after the tests are done.
vue-cli-service test:django:e2e --djangopath=/path/to/django/root
The headless mode runs the tests in the background. This is best for running the tests in a pipeline on an integration server.
vue-cli-service test:django:e2e --djangopath=/path/to/django/root --headless
.env
fileYou may specify a mode, which loads a corresponding .env.[mode]
file that allows you to specify environment variables.
vue-cli-service test:django:e2e --djangopath=/path/to/django/root --mode testing_e2e
Above example will look for a file called .env.testing_e2e
and pick up the environment variables specified in this file.
Following (optional) environment variables can be made use of:
DJANGO_E2E_DATABASE_NAME
: The name of the database used by django. Defaults to E2E_TESTING_34000
DJANGO_PYTHON_PATH
: The path to the python binary used by django. Defaults to 'bin/python', '.tox/py36/bin/python', 'python'
DJANGO_CONFIGURATION
: The name of the django settings class. Defaults to 'TestingE2E'
PORT1
: The port used by django. Defaults to 34000
PORT2
: The port used by vue. Defaults to 35000
PORT3
: The port used by cypress. Defaults to 36000
HEARTBEAT_PATH
: The frontend server will only start once the backend server is ready. A relative URL is requested repeatedly to check if the backend server is ready yet, using a HTTP HEAD method and waiting for a 200 or 302 status code. Defaults to /
CYPRESS_CONFIG
: Override Cypress options, passed as a string as --config
when running Cypress (https://docs.cypress.io/guides/references/configuration.html#Overriding-Options). Defaults to ''
(baseUrl=http://localhost:[PORT2]
is always passed)FAQs
Integration testing with cypress and django
The npm package @4tw/vue-cli-plugin-cypress-django receives a total of 4 weekly downloads. As such, @4tw/vue-cli-plugin-cypress-django popularity was classified as not popular.
We found that @4tw/vue-cli-plugin-cypress-django demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.
Research
Security News
A threat actor's playbook for exploiting the npm ecosystem was exposed on the dark web, detailing how to build a blockchain-powered botnet.