mirror of
https://github.com/inventree/InvenTree.git
synced 2025-08-04 19:11:35 +00:00
Table formatting (#10104)
* Format <BuildLineTable /> * More formatting * Add helper function for running playwright tests * Fix playwright test * Further formatting updates * Adjust order tables
This commit is contained in:
29
tasks.py
29
tasks.py
@@ -1291,6 +1291,7 @@ def test(
|
||||
help={
|
||||
'dev': 'Set up development environment at the end',
|
||||
'validate_files': 'Validate media files are correctly copied',
|
||||
'use_ssh': 'Use SSH protocol for cloning the demo dataset (requires SSH key)',
|
||||
}
|
||||
)
|
||||
def setup_test(
|
||||
@@ -1298,6 +1299,7 @@ def setup_test(
|
||||
ignore_update=False,
|
||||
dev=False,
|
||||
validate_files=False,
|
||||
use_ssh=False,
|
||||
path='inventree-demo-dataset',
|
||||
):
|
||||
"""Setup a testing environment."""
|
||||
@@ -1313,12 +1315,15 @@ def setup_test(
|
||||
info('Removing old data ...')
|
||||
run(c, f'rm {template_dir} -r')
|
||||
|
||||
URL = 'https://github.com/inventree/demo-dataset'
|
||||
|
||||
if use_ssh:
|
||||
# Use SSH protocol for cloning the demo dataset
|
||||
URL = 'git@github.com:inventree/demo-dataset.git'
|
||||
|
||||
# Get test data
|
||||
info('Cloning demo dataset ...')
|
||||
run(
|
||||
c,
|
||||
f'git clone https://github.com/inventree/demo-dataset {template_dir} -v --depth=1',
|
||||
)
|
||||
run(c, f'git clone {URL} {template_dir} -v --depth=1')
|
||||
|
||||
# Make sure migrations are done - might have just deleted sqlite database
|
||||
if not ignore_update:
|
||||
@@ -1590,6 +1595,21 @@ def frontend_server(c):
|
||||
yarn(c, 'yarn run dev --host')
|
||||
|
||||
|
||||
@task
|
||||
def frontend_test(c, host: str = '0.0.0.0'):
|
||||
"""Start the playwright test runner for the frontend code."""
|
||||
info('Starting frontend test runner')
|
||||
|
||||
frontend_path = local_dir().joinpath('src', 'frontend').resolve()
|
||||
|
||||
cmd = 'npx playwright test --ui'
|
||||
|
||||
if host:
|
||||
cmd += f' --ui-host={host}'
|
||||
|
||||
run(c, cmd, path=frontend_path)
|
||||
|
||||
|
||||
@task(
|
||||
help={
|
||||
'ref': 'git ref, default: current git ref',
|
||||
@@ -1874,6 +1894,7 @@ development = Collection(
|
||||
delete_data,
|
||||
docs_server,
|
||||
frontend_server,
|
||||
frontend_test,
|
||||
gunicorn,
|
||||
import_fixtures,
|
||||
schema,
|
||||
|
Reference in New Issue
Block a user