Merge branch 'feature/3518-define-placeholder' into feature/3598-binding
This commit is contained in:
commit
49ee618a6a
|
@ -16,10 +16,10 @@ on:
|
||||||
branches: [master, testing]
|
branches: [master, testing]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- uses: actions/setup-node@v1
|
- uses: actions/setup-node@v1
|
||||||
with:
|
with:
|
||||||
node-version: '16'
|
node-version: '16'
|
||||||
|
|
|
@ -32,12 +32,12 @@ jobs:
|
||||||
strategy:
|
strategy:
|
||||||
max-parallel: 4
|
max-parallel: 4
|
||||||
matrix:
|
matrix:
|
||||||
python-version: [3.7]
|
python-version: [3.9]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v3
|
||||||
- name: Set up Python ${{ matrix.python-version }}
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
uses: actions/setup-python@v2
|
uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: ${{ matrix.python-version }}
|
python-version: ${{ matrix.python-version }}
|
||||||
cache: 'pip'
|
cache: 'pip'
|
||||||
|
@ -49,10 +49,6 @@ jobs:
|
||||||
python -m pip install --upgrade pip
|
python -m pip install --upgrade pip
|
||||||
pip install flake8 pytest coverage
|
pip install flake8 pytest coverage
|
||||||
pip install -r requirements.txt
|
pip install -r requirements.txt
|
||||||
pip install -e .
|
|
||||||
mkdir bin
|
|
||||||
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
|
|
||||||
tar xf geckodriver-v0.30.0-linux64.tar.gz -C bin/
|
|
||||||
|
|
||||||
- name: Prepare database
|
- name: Prepare database
|
||||||
env:
|
env:
|
||||||
|
@ -66,17 +62,6 @@ jobs:
|
||||||
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION citext SCHEMA public;"
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION citext SCHEMA public;"
|
||||||
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm SCHEMA public;"
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm SCHEMA public;"
|
||||||
|
|
||||||
- name: Selenium tests
|
|
||||||
env:
|
|
||||||
SECRET_KEY: 'f00046306835001b55c230092e3a7990485beda0bc3bf732088d1ba1b5b74110e22e3f9ec3a24890272554b37d4'
|
|
||||||
DB_DATABASE: dh_test
|
|
||||||
FLASK_APP: examples/app.py
|
|
||||||
dhi: dbtest
|
|
||||||
run: |
|
|
||||||
alembic -x inventory=dbtest upgrade head
|
|
||||||
dh dummy --yes
|
|
||||||
flask run & pytest tests/test_selenium.py
|
|
||||||
|
|
||||||
- name: Lint with flake8
|
- name: Lint with flake8
|
||||||
run: |
|
run: |
|
||||||
# stop the build if:
|
# stop the build if:
|
||||||
|
|
|
@ -0,0 +1,78 @@
|
||||||
|
name: Selenium
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [master, testing]
|
||||||
|
pull_request:
|
||||||
|
branches: [master, testing]
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
# Service containers to run with `container-job`
|
||||||
|
services:
|
||||||
|
# Label used to access the service container
|
||||||
|
postgres:
|
||||||
|
# Docker Hub image
|
||||||
|
image: postgres:11
|
||||||
|
ports:
|
||||||
|
- 5432:5432
|
||||||
|
# Set health checks to wait until postgres has started
|
||||||
|
options: >-
|
||||||
|
--health-cmd pg_isready
|
||||||
|
--health-interval 10s
|
||||||
|
--health-timeout 5s
|
||||||
|
--health-retries 5
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: dh_test
|
||||||
|
POSTGRES_USER: dhub
|
||||||
|
POSTGRES_PASSWORD: ereuse
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
max-parallel: 4
|
||||||
|
matrix:
|
||||||
|
python-version: [3.9]
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v3
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
uses: actions/setup-python@v4
|
||||||
|
with:
|
||||||
|
python-version: ${{ matrix.python-version }}
|
||||||
|
cache: 'pip'
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
sudo apt-get update -qy
|
||||||
|
sudo apt-get -y install postgresql-client --no-install-recommends
|
||||||
|
python -m pip install --upgrade pip
|
||||||
|
pip install flake8 pytest coverage
|
||||||
|
pip install -r requirements.txt
|
||||||
|
pip install -e .
|
||||||
|
mkdir bin
|
||||||
|
wget https://github.com/mozilla/geckodriver/releases/download/v0.30.0/geckodriver-v0.30.0-linux64.tar.gz
|
||||||
|
tar xf geckodriver-v0.30.0-linux64.tar.gz -C bin/
|
||||||
|
|
||||||
|
- name: Prepare database
|
||||||
|
env:
|
||||||
|
POSTGRES_DB: dh_test
|
||||||
|
POSTGRES_USER: dhub
|
||||||
|
POSTGRES_PASSWORD: ereuse
|
||||||
|
run: |
|
||||||
|
export PGPASSWORD=$POSTGRES_PASSWORD
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pgcrypto SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION ltree SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION citext SCHEMA public;"
|
||||||
|
psql -h "localhost" -U "$POSTGRES_USER" -d "$POSTGRES_DB" -c "CREATE EXTENSION pg_trgm SCHEMA public;"
|
||||||
|
|
||||||
|
- name: Selenium tests
|
||||||
|
env:
|
||||||
|
SECRET_KEY: 'f00046306835001b55c230092e3a7990485beda0bc3bf732088d1ba1b5b74110e22e3f9ec3a24890272554b37d4'
|
||||||
|
DB_DATABASE: dh_test
|
||||||
|
FLASK_APP: examples/app.py
|
||||||
|
dhi: dbtest
|
||||||
|
run: |
|
||||||
|
alembic -x inventory=dbtest upgrade head
|
||||||
|
dh dummy --yes
|
||||||
|
flask run & pytest tests/test_selenium.py
|
44
CHANGELOG.md
44
CHANGELOG.md
|
@ -5,21 +5,33 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
|
||||||
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.ht
|
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.ht
|
||||||
ml).
|
ml).
|
||||||
|
|
||||||
## master
|
|
||||||
|
|
||||||
## testing
|
## testing
|
||||||
- [add] #281 add selenium test.
|
- [added] #312 Placeholder: new, edit, update. (manually and with excel).
|
||||||
- [add] #305 add button download iso Workbench.
|
|
||||||
- [add] #306 add link for download json snapshot.
|
## [2.3.0] - 2022-07-12
|
||||||
- [add] #308 add sentry.
|
- [added] #281 Add selenium test.
|
||||||
- [changed] #302 add system uuid for check the identity of one device.
|
- [added] #305 Add button to download ISO Workbench.
|
||||||
- [fixed] #309 column lifecycle status is always empty.
|
- [added] #306 Add link to download JSON snapshot.
|
||||||
|
- [added] #308 Add sentry.
|
||||||
|
- [changed] #302 Add system uuid to check the identity of one device.
|
||||||
|
- [fixed] #309 Column lifecycle status is always empty.
|
||||||
|
|
||||||
|
**IMPORTANT**: PR #302 involves some changes in the deployment process:
|
||||||
|
```bash
|
||||||
|
# First, run script `extract_uuids.sh` before applying alembic migrations (e.g. with schema `dbtest`)
|
||||||
|
sh scripts/extract_uuids.sh
|
||||||
|
|
||||||
|
# Then, apply alembic migrations
|
||||||
|
alembic -x inventory=dbtest upgrade head
|
||||||
|
```
|
||||||
|
|
||||||
|
**NOTE**: If you forget (or don't need) to run this script before applying new migration it will work but any device will be updated.
|
||||||
|
|
||||||
## [2.2.0] - 2022-06-24
|
## [2.2.0] - 2022-06-24
|
||||||
- [changed] #304 change anchor of link devices lots.
|
- [changed] #304 change anchor of link devices lots.
|
||||||
|
|
||||||
## [2.2.0 rc2] - 2022-06-22
|
## [2.2.0 rc2] - 2022-06-22
|
||||||
- [added] #299 Multy select with Shift.
|
- [added] #299 Multiselect with Shift.
|
||||||
- [added] #300 Add Sid in label.
|
- [added] #300 Add Sid in label.
|
||||||
- [added] #301 Add logo in label.
|
- [added] #301 Add logo in label.
|
||||||
- [added] #303 Add export Lots.
|
- [added] #303 Add export Lots.
|
||||||
|
@ -160,17 +172,3 @@ First server render HTML version. Completely rewrites views of angular JS client
|
||||||
- [added] #83 add owner_id in all kind of device
|
- [added] #83 add owner_id in all kind of device
|
||||||
- [fixed] #89 save json on disk only for shapshots
|
- [fixed] #89 save json on disk only for shapshots
|
||||||
- [fixed] #91 The most old time allow is 1970-01-01
|
- [fixed] #91 The most old time allow is 1970-01-01
|
||||||
|
|
||||||
|
|
||||||
# Release notes
|
|
||||||
|
|
||||||
## [2.2.1]
|
|
||||||
The pr #302 involves some changes in the deployment process
|
|
||||||
For to do the deployment you need to do run the script extract_uuids.sh before to run alembic.
|
|
||||||
This is the correct secuence if the schema of you proyect is *dbtest*
|
|
||||||
```
|
|
||||||
git pull
|
|
||||||
sh examples/extract_uuids.sh
|
|
||||||
alembic -x inventory=dbtest upgrade head
|
|
||||||
```
|
|
||||||
If you forget to run this script the migration is do it but not modify any device data.
|
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
__version__ = "2.2.0"
|
__version__ = "2.3.0"
|
||||||
|
|
|
@ -94,7 +94,7 @@ class Processor(Component):
|
||||||
assert not hasattr(self, 'cores') or 1 <= self.cores <= 16
|
assert not hasattr(self, 'cores') or 1 <= self.cores <= 16
|
||||||
|
|
||||||
@staticmethod # noqa: C901
|
@staticmethod # noqa: C901
|
||||||
def processor_brand_generation(model: str):
|
def processor_brand_generation(model: str): # noqa: C901
|
||||||
"""Generates the ``brand`` and ``generation`` fields for the given model.
|
"""Generates the ``brand`` and ``generation`` fields for the given model.
|
||||||
|
|
||||||
This returns a tuple with:
|
This returns a tuple with:
|
||||||
|
|
|
@ -5,9 +5,9 @@ Use this as a starting point.
|
||||||
"""
|
"""
|
||||||
import sentry_sdk
|
import sentry_sdk
|
||||||
from decouple import config
|
from decouple import config
|
||||||
from flask_wtf.csrf import CSRFProtect
|
|
||||||
|
# from flask_wtf.csrf import CSRFProtect
|
||||||
from sentry_sdk.integrations.flask import FlaskIntegration
|
from sentry_sdk.integrations.flask import FlaskIntegration
|
||||||
from werkzeug.contrib.profiler import ProfilerMiddleware
|
|
||||||
|
|
||||||
from ereuse_devicehub.api.views import api
|
from ereuse_devicehub.api.views import api
|
||||||
from ereuse_devicehub.config import DevicehubConfig
|
from ereuse_devicehub.config import DevicehubConfig
|
||||||
|
@ -17,6 +17,9 @@ from ereuse_devicehub.labels.views import labels
|
||||||
from ereuse_devicehub.views import core
|
from ereuse_devicehub.views import core
|
||||||
from ereuse_devicehub.workbench.views import workbench
|
from ereuse_devicehub.workbench.views import workbench
|
||||||
|
|
||||||
|
# from werkzeug.contrib.profiler import ProfilerMiddleware
|
||||||
|
|
||||||
|
|
||||||
SENTRY_DSN = config('SENTRY_DSN', None)
|
SENTRY_DSN = config('SENTRY_DSN', None)
|
||||||
if SENTRY_DSN:
|
if SENTRY_DSN:
|
||||||
sentry_sdk.init(
|
sentry_sdk.init(
|
||||||
|
@ -41,10 +44,10 @@ app.register_blueprint(workbench)
|
||||||
# configure & enable CSRF of Flask-WTF
|
# configure & enable CSRF of Flask-WTF
|
||||||
# NOTE: enable by blueprint to exclude API views
|
# NOTE: enable by blueprint to exclude API views
|
||||||
# TODO(@slamora: enable by default & exclude API views when decouple of Teal is completed
|
# TODO(@slamora: enable by default & exclude API views when decouple of Teal is completed
|
||||||
csrf = CSRFProtect(app)
|
# csrf = CSRFProtect(app)
|
||||||
# csrf.protect(core)
|
# csrf.protect(core)
|
||||||
# csrf.protect(devices)
|
# csrf.protect(devices)
|
||||||
app.config["SQLALCHEMY_RECORD_QUERIES"] = True
|
# app.config["SQLALCHEMY_RECORD_QUERIES"] = True
|
||||||
app.config['PROFILE'] = True
|
# app.config['PROFILE'] = True
|
||||||
app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
|
# app.wsgi_app = ProfilerMiddleware(app.wsgi_app, restrictions=[30])
|
||||||
app.run(debug=True)
|
# app.run(debug=True)
|
||||||
|
|
|
@ -72,6 +72,10 @@ def test_api_docs(client: Client):
|
||||||
'/inventory/tag/devices/add/',
|
'/inventory/tag/devices/add/',
|
||||||
'/inventory/tag/devices/{id}/del/',
|
'/inventory/tag/devices/{id}/del/',
|
||||||
'/inventory/upload-snapshot/',
|
'/inventory/upload-snapshot/',
|
||||||
|
'/inventory/device/edit/{id}/',
|
||||||
|
'/inventory/upload-placeholder/',
|
||||||
|
'/inventory/lot/{lot_id}/upload-placeholder/',
|
||||||
|
'/inventory/placeholder-logs/',
|
||||||
'/labels/',
|
'/labels/',
|
||||||
'/labels/add/',
|
'/labels/add/',
|
||||||
'/labels/print',
|
'/labels/print',
|
||||||
|
|
|
@ -42,10 +42,12 @@ class TestSelenium:
|
||||||
lot_id = self.driver.current_url.split("/")[5]
|
lot_id = self.driver.current_url.split("/")[5]
|
||||||
|
|
||||||
# go to unassigned
|
# go to unassigned
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
# self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
||||||
|
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(7) span").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
|
|
||||||
# select the first device
|
# select the first device
|
||||||
|
|
||||||
self.driver.find_element(
|
self.driver.find_element(
|
||||||
By.CSS_SELECTOR, "tr:nth-child(1) .deviceSelect"
|
By.CSS_SELECTOR, "tr:nth-child(1) .deviceSelect"
|
||||||
).click()
|
).click()
|
||||||
|
@ -95,10 +97,14 @@ class TestSelenium:
|
||||||
self.driver.find_element(By.ID, "SaveAllActions").click()
|
self.driver.find_element(By.ID, "SaveAllActions").click()
|
||||||
time.sleep(3)
|
time.sleep(3)
|
||||||
|
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
# self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(5) span").click()
|
||||||
|
self.driver.find_element(By.CSS_SELECTOR, ".nav-item:nth-child(7) span").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.implicitly_wait(3)
|
||||||
|
|
||||||
# logout
|
# logout
|
||||||
|
# self.driver.find_element(By.CSS_SELECTOR, ".d-md-block:nth-child(2)").click()
|
||||||
self.driver.find_element(By.CSS_SELECTOR, ".d-md-block:nth-child(2)").click()
|
self.driver.find_element(By.CSS_SELECTOR, ".d-md-block:nth-child(2)").click()
|
||||||
self.driver.implicitly_wait(3)
|
self.driver.find_element(By.CSS_SELECTOR, "li:nth-child(9) > .dropdown-item > span").click()
|
||||||
self.driver.find_element(By.LINK_TEXT, "Sign Out").click()
|
# self.driver.find_element(By.CSS_SELECTOR, ".d-md-block").click()
|
||||||
|
# self.driver.implicitly_wait(3)
|
||||||
|
# self.driver.find_element(By.LINK_TEXT, "Sign Out").click()
|
||||||
|
|
Reference in New Issue