openreplay/api/chalicelib/core/usability_testing/routes.py
Rajesh Rajendran 4c7f2edd57
Api v1.16.0 (#1730)
* feat(api): usability testing (#1686)

* feat(api): usability testing - wip

* feat(db): usabiity testing

* feat(api): usability testing - api

* feat(api): usability testing - api

* feat(api): usability testing - db change

* feat(api): usability testing - db change

* feat(api): usability testing - unit tests update

* feat(api): usability testing - test and tasks stats

* feat(api): usability testing - sessions list fix, return zeros if test id is not having signals

* Api v1.16.0 (#1698)

* feat: canvas support [assist] (#1641)

* feat(tracker/ui): start canvas support

* feat(tracker): slpeer -> peerjs for canvas streams

* fix(ui): fix agent canvas peer id

* fix(ui): fix agent canvas peer id

* fix(ui): fix peer removal

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(tracker): canvas recorder

* feat(ui): canvas support for ui

* fix(tracker): fix falling tests

* feat(ui): replay canvas in video

* feat(ui): refactor video streaming to draw on canvas

* feat(ui): 10hz check for canvas replay

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests

* feat(ui): fix for tests cov

* feat(ui): mroe test coverage

* fix(ui): styling

* fix(tracker): support backend settings for canvas

* feat(ui): allow devtools to be resizeable (#1605)

* fix(ui): console redux tab null check

* Api v1.15.0 (#1689)

* fix(chalice): fix create alert with MS Teams notification channel
closes openreplay/openreplay#1677

* fix(chalice): fix MS Teams notifications
* refactor(chalice): enhanced MS Teams notifications
closes openreplay/openreplay#1681

(cherry picked from commit 265897f509)

* fix(ui): filter keys conflcit with metadata, path analysis 4 col

* fix(ui): clear the filers and series on card type change

* fix(player): fix msg reader bug

* fix(DB): fix CH wrong version (#1692)

(cherry picked from commit 48dbbb55db)

* fix(ui): filter keys conflcit with metadata

* fix(tracker): unique broadcast channel name

* fix(chalice): fixed delete cards (#1697)

(cherry picked from commit 92fedd310c)

* fix(tracker): add trycatch to ignore iframe errors

* feat(backend): added ARM arch support to backend services [Dockerfile]

* feat(backend): removed userAgent from sessions and unstarted-sessions tables

* fix(DB): change path-analysis card size

---------

Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>

* refactor(chalice): cleaned code (#1699)

* feat(api): usability testing - added start_path to the resposne, remove count from the list

* feat(api): usability testing - test to have response count and live count

* feat(api): usability testing - test to have additional data

* Revert "refactor(chalice): cleaned code (#1699)" (#1702)

This reverts commit 83f2b0c12c.

* feat(api): usability testing - responses with total and other improvements

* change(api): vulnerability whitelist udpate

* feat(api): usability testing - create added missing columns, and sessions with user_id search

* feat(api): usability testing - update test with responseCount

* feat(api): usability testing - timestamps in unix

* feat(api): usability testing - request with proper case change

* feat(api): usability testing - task.description nullable

* feat(api): usability testing - check deleted status

* Api v1.16.0 (#1707)

* fix(chalice): fixed search sessions

* fix(chalice): fixed search sessions
* refactor(chalice): upgraded dependencies
* refactor(crons): upgraded dependencies
* refactor(alerts): upgraded dependencies

* Api v1.16.0 (#1712)

* feat(DB): user-testing support

* feat(chalice): user testing support

* feat(chalice): support utxVideo (#1726)

* feat(chalice): changed bucket name for ux testing webcamera videos

---------

Co-authored-by: Shekar Siri <sshekarsiri@gmail.com>
Co-authored-by: Kraiem Taha Yassine <tahayk2@gmail.com>
Co-authored-by: Delirium <nikita@openreplay.com>
Co-authored-by: Alexander <zavorotynskiy@pm.me>
2023-11-30 10:53:31 +01:00

124 lines
4.2 KiB
Python

from fastapi import Body, Depends
from chalicelib.core.usability_testing.schema import UTTestCreate, UTTestRead, UTTestUpdate, UTTestDelete, SearchResult, \
UTTestSearch, UTTestSessionsSearch, UTTestResponsesSearch, StatusEnum, UTTestStatusUpdate
from chalicelib.core.usability_testing import service
from or_dependencies import OR_context
from routers.base import get_routers
from schemas import schemas
public_app, app, app_apikey = get_routers()
tags = ["usability-tests"]
@app.post("/{projectId}/usability-tests/search", tags=tags)
async def search_ui_tests(
projectId: int,
search: UTTestSearch = Body(...,
description="The search parameters including the query, page, limit, sort_by, "
"and sort_order.")
):
"""
Search for UT tests within a given project with pagination and optional sorting.
- **projectId**: The unique identifier of the project to search within.
- **search**: The search parameters including the query, page, limit, sort_by, and sort_order.
"""
return service.search_ui_tests(projectId, search)
@app.post("/{projectId}/usability-tests", tags=tags)
async def create_ut_test(projectId: int, test_data: UTTestCreate,
context: schemas.CurrentContext = Depends(OR_context)):
"""
Create a new UT test in the specified project.
- **projectId**: The unique identifier of the project.
- **test_data**: The data for the new UT test.
"""
test_data.project_id = projectId
test_data.created_by = context.user_id
return service.create_ut_test(test_data)
@app.get("/{projectId}/usability-tests/{test_id}", tags=tags)
async def get_ut_test(projectId: int, test_id: int):
"""
Retrieve a specific UT test by its ID.
- **projectId**: The unique identifier of the project.
- **test_id**: The unique identifier of the UT test.
"""
return service.get_ut_test(projectId, test_id)
@app.delete("/{projectId}/usability-tests/{test_id}", tags=tags)
async def delete_ut_test(projectId: int, test_id: int):
"""
Delete a specific UT test by its ID.
- **projectId**: The unique identifier of the project.
- **test_id**: The unique identifier of the UT test to be deleted.
"""
return service.delete_ut_test(projectId, test_id)
@app.put("/{projectId}/usability-tests/{test_id}", tags=tags)
async def update_ut_test(projectId: int, test_id: int, test_update: UTTestUpdate):
"""
Update a specific UT test by its ID.
- **project_id**: The unique identifier of the project.
- **test_id**: The unique identifier of the UT test to be updated.
- **test_update**: The updated data for the UT test.
"""
return service.update_ut_test(projectId, test_id, test_update)
@app.get("/{projectId}/usability-tests/{test_id}/sessions", tags=tags)
async def get_sessions(projectId: int, test_id: int, page: int = 1, limit: int = 10,
live: bool = False,
user_id: str = None):
"""
Get sessions related to a specific UT test.
- **projectId**: The unique identifier of the project.
- **test_id**: The unique identifier of the UT test.
"""
return service.ut_tests_sessions(projectId, test_id, page, limit, user_id, live)
@app.get("/{projectId}/usability-tests/{test_id}/responses/{task_id}", tags=tags)
async def get_responses(test_id: int, task_id: int, page: int = 1, limit: int = 10, query: str = None):
"""
Get responses related to a specific UT test.
- **project_id**: The unique identifier of the project.
- **test_id**: The unique identifier of the UT test.
"""
return service.get_responses(test_id, task_id, page, limit, query)
@app.get("/{projectId}/usability-tests/{test_id}/statistics", tags=tags)
async def get_statistics(test_id: int):
"""
Get statistics related to a specific UT test.
:param test_id:
:return:
"""
return service.get_statistics(test_id=test_id)
@app.get("/{projectId}/usability-tests/{test_id}/task-statistics", tags=tags)
async def get_task_statistics(test_id: int):
"""
Get statistics related to a specific UT test.
:param test_id:
:return:
"""
return service.get_task_statistics(test_id=test_id)