Skip to content

add arduino_functions block restriction and improvement of board-spec… #453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: development
Choose a base branch
from

Conversation

georgi-s
Copy link
Contributor

@georgi-s georgi-s commented Apr 15, 2025

…ific instance limits

Adds security measures for the arduino_functions block:

  • Prevents adding to the backpack (isBackpackable)
  • Prevents dragging the block (onDragStart)
  • Prevents deleting the block (isDeletable)
  • Prevents duplicating the block (isDuplicatable)
  • Prevents copying the block (isCopyable)
  • Prevents pasting the block (isPasteable)
  • Prevents moving the block (isMovable)
  • Prevents editing the block (isEditable)

These changes ensure that the arduino_functions block, which contains the setup() and loop() functions, can only exist once in the workspace and cannot be accidentally tampered with.

Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 1.0s
Blockly Editor Page Tests [Blockly] visits the tutorial page 179ms
Blockly Editor Page Tests [Blockly] visits the gallery page 137ms
Blockly Editor Page Tests [Blockly] visits the faq page 131ms
Blockly Editor Page Tests [Blockly] visits the settings page 126ms
Blockly Editor Page Tests [Blockly] visits the login page 126ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 13.9s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 716ms
Blockly Editor Page Tests [Blockly] selects senseBox MCU 806ms
Blockly Editor Page Tests [Blockly] selects senseBox Mini 655ms
Blockly Editor Page Tests [Blockly] compiles code 9.2s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.3s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 469ms
Code Editor Page Tests [CodeEditor] compiles code 632ms
Code Editor Page Tests [CodeEditor] opens reset dialog 630ms
Code Editor Page Tests [CodeEditor] fetches libraries 1.4s

Github Test Reporter by CTRF 💚

Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 1.0s
Blockly Editor Page Tests [Blockly] visits the tutorial page 171ms
Blockly Editor Page Tests [Blockly] visits the gallery page 141ms
Blockly Editor Page Tests [Blockly] visits the faq page 130ms
Blockly Editor Page Tests [Blockly] visits the settings page 125ms
Blockly Editor Page Tests [Blockly] visits the login page 122ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 3.8s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 791ms
Blockly Editor Page Tests [Blockly] selects senseBox MCU 625ms
Blockly Editor Page Tests [Blockly] selects senseBox Mini 556ms
Blockly Editor Page Tests [Blockly] compiles code 10.1s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.4s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 456ms
Code Editor Page Tests [CodeEditor] compiles code 615ms
Code Editor Page Tests [CodeEditor] opens reset dialog 597ms
Code Editor Page Tests [CodeEditor] fetches libraries 1.4s

Github Test Reporter by CTRF 💚

Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 970ms
Blockly Editor Page Tests [Blockly] visits the tutorial page 175ms
Blockly Editor Page Tests [Blockly] visits the gallery page 140ms
Blockly Editor Page Tests [Blockly] visits the faq page 123ms
Blockly Editor Page Tests [Blockly] visits the settings page 125ms
Blockly Editor Page Tests [Blockly] visits the login page 120ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 13.9s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 657ms
Blockly Editor Page Tests [Blockly] selects senseBox MCU 633ms
Blockly Editor Page Tests [Blockly] selects senseBox Mini 609ms
Blockly Editor Page Tests [Blockly] compiles code 11.0s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.4s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 473ms
Code Editor Page Tests [CodeEditor] compiles code 608ms
Code Editor Page Tests [CodeEditor] opens reset dialog 613ms
Code Editor Page Tests [CodeEditor] fetches libraries 1.4s

Github Test Reporter by CTRF 💚

@georgi-s
Copy link
Contributor Author

– Implementation of detailed backpack configuration with custom options and event handlers.
– Addition of logic for validating and managing blocks, especially for "arduino_functions" type blocks.
– Improvement of translation management and UI updates based on the selected language.
– Introduction of logging statements that are only output in development mode to reduce debugging information.
– Improvement of code structure and readability by adding comments and separating logic into different methods.

Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 942ms
Blockly Editor Page Tests [Blockly] visits the tutorial page 160ms
Blockly Editor Page Tests [Blockly] visits the gallery page 130ms
Blockly Editor Page Tests [Blockly] visits the faq page 119ms
Blockly Editor Page Tests [Blockly] visits the settings page 120ms
Blockly Editor Page Tests [Blockly] visits the login page 122ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 14.0s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 822ms
Blockly Editor Page Tests [Blockly] selects senseBox MCU 808ms
Blockly Editor Page Tests [Blockly] selects senseBox Mini 711ms
Blockly Editor Page Tests [Blockly] compiles code 10.1s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.3s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 470ms
Code Editor Page Tests [CodeEditor] compiles code 625ms
Code Editor Page Tests [CodeEditor] opens reset dialog 625ms
Code Editor Page Tests [CodeEditor] fetches libraries 1.8s

Github Test Reporter by CTRF 💚

Copy link
Contributor

@Thiemann96 Thiemann96 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ein paar kleinere Änderungen bitte noch machen, aber sieht ansonsten gut aus und funktioniert 👍

cy.get("button").contains("Reset code").click();
cy.get("button").contains("Zurücksetzen").should("exist");
cy.get("button").contains(/Reset code|Code zurücksetzen/).click();
cy.get("button").contains(/Reset|Zurücksetzen/).should("exist");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Warum diese Änderung?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nach meinem Gewissen war es sinnvoll, statt harter String Regex-Matches zu benutzen.
Denn mit harten Strings wäre der Test bei einer minimalen Veränderung durchgefallen. Somit wird zum Beispiel der Fall abgedeckt, wenn der Button nur Reset woanders im Projekt heißen würde.


this.isEditable = function() {
return false;
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was hält dich davon ab einfach this.isEditable = false zu schreiben? Warum brauch es diesen Funktionsaufruf?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weil ich es für sinnvoll hielt, isEditable als Methode zu schreiben wegen des dynamischen Verhaltens bzw. der Eigenschaft, statt statisch. Warum wäre statisches Verhalten besser?

Blockly.Msg.REMOVE_FROM_BACKPACK = "Entfernen aus Rucksack";
Blockly.Msg.COPY_TO_BACKPACK = "Kopieren in Rucksack";
Blockly.Msg.COPY_ALL_TO_BACKPACK = "Alle Kopieren in Rucksack";
Blockly.Msg.PASTE_ALL_FROM_BACKPACK = "Alle Einfügen aus Rucksack";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Die Texte müssen nicht in die ..old.js Dateien geschrieben werden ;) (ich weiß hatte ich dir mal anders gesagt, aber vergiss das)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wip

georgi-s added 6 commits May 16, 2025 14:24
- Test now searches for both possible reset button texts
- Supports both English ("Reset code") and German ("Code zurücksetzen") translations
- Uses regular expressions for flexible text searches
- Improves the robustness of the test across different language settings
- Test now searches for both possible reset button texts
- Supports both English ("Reset code") and German ("Code zurücksetzen") translations
- Uses regular expressions for flexible text searches
- Improves the robustness of the test across different language settings
@georgi-s georgi-s force-pushed the fix/backpack-usage-#346 branch from 5f68eb8 to dab5f29 Compare May 16, 2025 12:29
Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 986ms
Blockly Editor Page Tests [Blockly] visits the tutorial page 166ms
Blockly Editor Page Tests [Blockly] visits the gallery page 128ms
Blockly Editor Page Tests [Blockly] visits the faq page 119ms
Blockly Editor Page Tests [Blockly] visits the settings page 121ms
Blockly Editor Page Tests [Blockly] visits the login page 120ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 4.3s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 8.2s
Blockly Editor Page Tests [Blockly] selects senseBox MCU 8.3s
Blockly Editor Page Tests [Blockly] selects senseBox Mini 8.3s
Blockly Editor Page Tests [Blockly] compiles code 4.3s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.5s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 480ms
Code Editor Page Tests [CodeEditor] compiles code 624ms
Code Editor Page Tests [CodeEditor] opens reset dialog 4.8s
Code Editor Page Tests [CodeEditor] fetches libraries 1.6s

Github Test Reporter by CTRF 💚

Copy link

Tests

Test Name Status Flaky Duration
Blockly Editor Page Tests [Blockly] visits the editor page 957ms
Blockly Editor Page Tests [Blockly] visits the tutorial page 167ms
Blockly Editor Page Tests [Blockly] visits the gallery page 130ms
Blockly Editor Page Tests [Blockly] visits the faq page 119ms
Blockly Editor Page Tests [Blockly] visits the settings page 119ms
Blockly Editor Page Tests [Blockly] visits the login page 117ms
Blockly Editor Page Tests [Blockly] navigates to tutorial and back 3.9s
Blockly Editor Page Tests [Blockly] selects senseBox ESP 850ms
Blockly Editor Page Tests [Blockly] selects senseBox MCU 590ms
Blockly Editor Page Tests [Blockly] selects senseBox Mini 609ms
Blockly Editor Page Tests [Blockly] compiles code 19.0s
Code Editor Page Tests [CodeEditor] visits the code editor page 1.4s
Code Editor Page Tests [CodeEditor] selects senseBox ESP 465ms
Code Editor Page Tests [CodeEditor] compiles code 611ms
Code Editor Page Tests [CodeEditor] opens reset dialog 4.7s
Code Editor Page Tests [CodeEditor] fetches libraries 1.8s

Github Test Reporter by CTRF 💚

Thiemann96 pushed a commit that referenced this pull request Jun 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants