Skip to content

Commit

Permalink
Merge 2.10-beta1.1+spring2024 release into main (project-chip#34)
Browse files Browse the repository at this point in the history
* Fix prblem with sdk_tests collection using hardcoded paths

* Enable github workflows for main branch (project-chip#17)

* Enable github workflows for main branch

* Ignore Dockerfile

* mypy: ignore python_testing in sdk_collection

* minor linting issues fixed

* ignore .devcontainer in spell checker

* move .env file back in root

* Update reference to fetch_sdk_tests_and_runner.sh

* Use `pull_request_target` event to support forks

* Update yaml_test_folder.py (project-chip#21)

* Update yaml_test_folder.py

* Update test_sdk_yaml_collection.py

* Update unittests.yml

Don't run old code for unit tests

* [Fix] remove TestRunConfig usage from TH Backend (#581) (project-chip#6)

* Add the repeat endpoint, deprecate the test_run_config endpoints and

force the test run execution creation to use selected tests, and not test_run_config_id.

* Deprecating unit tests related with
test_run_config, creating new endpoint with required selected_tests
parameter and ignoring the test_run_config reference, renaming the
repeat endpoint method and adding comments.

* Updating select_tests logic, moving to a utils
file, and adding unit test for the repeat endpoint

* Updating comments and adding missing attribution to
None for test_run_config_id

* Adding missing TODO comment.

* Fixing selected_tests logic

* Updating the 'repeat' unit test to use more
suites to cover more cases.

* Removing "/new" endpoint, updating logic of the
default test run execution endpoint and updating unit tests, "repeat"
endpoint and utils

* Adding the new DB column "collection_id" to the
TestSuiteExecution table. A DB revision file was created and the code
was refactored to use this new info.

* Removing unnecessary import

* Set default log level to info, to eliminate chatter from python runner (project-chip#23)

* Update SDK SHA (project-chip#25)

* Added support to reset db for test (project-chip#28)

* Missing submit button (project-chip#30)

* Updates MessageTypeEnum to include options and message types

* Update app/user_prompt_support/user_prompt_manager.py

Co-authored-by: antonio-amjr <[email protected]>

* Update app/constants/websockets_constants.py

Co-authored-by: hiltonlima <[email protected]>

* Update app/user_prompt_support/user_prompt_manager.py

---------

Co-authored-by: Romulo Quidute Filho <[email protected]>
Co-authored-by: antonio-amjr <[email protected]>
Co-authored-by: hiltonlima <[email protected]>
Co-authored-by: Carolina Lopes <[email protected]>

* Update version

* Prompt request refactor (project-chip#31)

* Refactor to use only 1 enum

* Removed unsed import

* Fix isort

* Adds a new Message prompt request

---------

Co-authored-by: raul-marquez-csa <[email protected]>

* update backend version in FE (project-chip#32)

* update backend version in FE

* Update .version_information

* Update .version_information

* change ssh to https (project-chip#33)

* Undo version information update

---------

Co-authored-by: Mikael H. Moeller <[email protected]>
Co-authored-by: Mikael Møller <[email protected]>
Co-authored-by: antonio-amjr <[email protected]>
Co-authored-by: Romulo Quidute Filho <[email protected]>
Co-authored-by: Raul Marquez <[email protected]>
Co-authored-by: hiltonlima <[email protected]>
Co-authored-by: raul-marquez-csa <[email protected]>
  • Loading branch information
8 people authored Nov 29, 2023
1 parent 83958eb commit 30f7d99
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 30 deletions.
4 changes: 2 additions & 2 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "test_collections/python_tests"]
[submodule "python_tests"]
path = test_collections/python_tests
url = git@github.com:project-chip/matter-test-scripts.git
url = https://github.com/project-chip/matter-test-scripts.git
6 changes: 2 additions & 4 deletions app/chip_tool/test_case.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
ManualLogUploadStep,
ManualVerificationTestStep,
)
from app.user_prompt_support import OptionsSelectPromptRequest
from app.user_prompt_support.prompt_request import MessagePromptRequest
from app.user_prompt_support.uploaded_file_support import UploadFile
from app.user_prompt_support.user_prompt_manager import user_prompt_manager
from app.user_prompt_support.user_prompt_support import UserPromptSupport
Expand Down Expand Up @@ -256,9 +256,7 @@ async def __prompt_user_for_controller_action(self, action: str) -> None:
"""

prompt = f"Please do the following action on the Controller: {action}"
prompt_request = OptionsSelectPromptRequest(
prompt=prompt, options={}, timeout=60
)
prompt_request = MessagePromptRequest(prompt=prompt, timeout=60)
await self.send_prompt_request(prompt_request)

def __handle_logs(self, logs: Any) -> None:
Expand Down
1 change: 1 addition & 0 deletions app/constants/websockets_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class MessageTypeEnum(str, Enum):
PROMPT_REQUEST = "prompt_request"
OPTIONS_REQUEST = "options_request"
MESSAGE_REQUEST = "message_request"
FILE_UPLOAD_REQUEST = "file_upload_request"
PROMPT_RESPONSE = "prompt_response"
TEST_UPDATE = "test_update"
TIME_OUT_NOTIFICATION = "time_out_notification"
Expand Down
36 changes: 22 additions & 14 deletions app/user_prompt_support/prompt_request.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,43 +13,51 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
from enum import Enum
from typing import Dict, Optional

from pydantic import BaseModel

default_timeout_s = 60 # Seconds

from app.constants.websockets_constants import MessageTypeEnum

class PromptRequestType(str, Enum):
BASE = "base"
OPTIONS = "options"
TEXT = "text"
FILE = "file"
default_timeout_s = 60 # Seconds


class PromptRequest(BaseModel):
prompt: Optional[str]
timeout: int = default_timeout_s
__type: PromptRequestType = PromptRequestType.BASE

@property
def type(self) -> PromptRequestType:
return self.__type
def messageType(self) -> MessageTypeEnum:
return MessageTypeEnum.INVALID_MESSAGE


class OptionsSelectPromptRequest(PromptRequest):
__type = PromptRequestType.OPTIONS
options: Dict[str, int]

@property
def messageType(self) -> MessageTypeEnum:
return MessageTypeEnum.OPTIONS_REQUEST


class TextInputPromptRequest(PromptRequest):
__type = PromptRequestType.TEXT
placeholder_text: Optional[str]
default_value: Optional[str]
regex_pattern: Optional[str]

@property
def messageType(self) -> MessageTypeEnum:
return MessageTypeEnum.PROMPT_REQUEST


class UploadFilePromptRequest(PromptRequest):
__type = PromptRequestType.FILE
path: str = "api/v1/test_run_execution/file_upload/"

@property
def messageType(self) -> MessageTypeEnum:
return MessageTypeEnum.FILE_UPLOAD_REQUEST


class MessagePromptRequest(PromptRequest):
@property
def messageType(self) -> MessageTypeEnum:
return MessageTypeEnum.MESSAGE_REQUEST
13 changes: 3 additions & 10 deletions app/user_prompt_support/user_prompt_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,9 @@ def __init__(self, prompt: PromptRequest, message_id: int) -> None:
def as_dictionary(self) -> Dict[MessageKeysEnum, Any]:
prompt_dict = self.prompt.dict()
prompt_dict[MESSAGE_ID_KEY] = self.message_id
message_type = MessageTypeEnum.PROMPT_REQUEST

# Check if options exist
if "options" in prompt_dict:
if prompt_dict["options"]:
message_type = MessageTypeEnum.OPTIONS_REQUEST
else:
message_type = MessageTypeEnum.MESSAGE_REQUEST

message_dict = {
MessageKeysEnum.TYPE: message_type,
MessageKeysEnum.TYPE: self.prompt.messageType,
MessageKeysEnum.PAYLOAD: prompt_dict,
}
return message_dict
Expand Down Expand Up @@ -227,4 +220,4 @@ def __prompt_exchange_for_message(
)


user_prompt_manager = UserPromptManager()
user_prompt_manager: UserPromptManager = UserPromptManager()

0 comments on commit 30f7d99

Please sign in to comment.