Repository: robocorp/rpaframework

Issue:
Wizard-like forms in RPA.Dialogs
Add support for:

- [x]  New keyword `Add dialog next page button`

This keyword will support a `label` argument and will add a button that separates dialog content between multiple views, like a wizard.


Discussion:

Resolving patch:
diff --git a/packages/dialogs/src/RPA/Dialogs/library.py b/packages/dialogs/src/RPA/Dialogs/library.py
--- a/packages/dialogs/src/RPA/Dialogs/library.py
+++ b/packages/dialogs/src/RPA/Dialogs/library.py
@@ -821,6 +821,48 @@ def add_checkbox(
 
         self.add_element(element)
 
+    @keyword
+    def add_dialog_next_page_button(
+        self,
+        label: str,
+    ) -> None:
+        """Add a next page button
+
+        :param label: The text displayed on the button
+
+        The next page button will delimit the next elements of
+        the dialog in a separate view, so that they will only be displayed after
+        pressing the button, creating a wizard experience in the dialog.
+
+        Example:
+
+        .. code-block:: robotframework
+
+            Add heading       Send feedback
+            Add text input    email             label=E-mail address
+            Add dialog next page button         label=next
+            Add text input    name              label=Name
+            Add dialog next page button         label=next
+            Add checkbox      name=contact
+            ...     label=Do you want us to contact you?
+            ...     default=True
+            Add dialog next page button         label=next
+            Add text input    message
+            ...    label=Feedback
+            ...    placeholder=Enter feedback here
+            ...    rows=5
+            Add submit buttons  buttons=submit
+            ${result}=    Run dialog
+            Send feedback message    ${result.email}  ${result.message}
+            Run dialog
+        """
+        element = {
+            "type": "next",
+            "label": str(label),
+        }
+
+        self.add_element(element)
+
     @keyword("Add submit buttons", tags=["input"])
     def add_submit_buttons(
         self,


Test patch:
diff --git a/packages/dialogs/tests/test_dialogs.robot b/packages/dialogs/tests/test_dialogs.robot
--- a/packages/dialogs/tests/test_dialogs.robot
+++ b/packages/dialogs/tests/test_dialogs.robot
@@ -72,6 +72,22 @@ All elements
     &{result}=    Run dialog
     Log many    &{result}
 
+Multiple dialogs with next button
+    Add heading    1/3
+    Add text input      text-field-1
+    Add dialog next page button         label=next1
+
+    Add heading    2/3
+    Add text input      text-field-2
+    Add dialog next page button         label=next2
+
+    Add heading    3/3
+    Add text input      text-field-3
+    Add submit buttons  submit
+
+    ${result}=  Run dialog
+    Log many    &{result}
+
 Multiple dialogs
     Add heading    1/3
     Add hidden input    index  1
diff --git a/packages/dialogs/tests/test_elements.py b/packages/dialogs/tests/test_elements.py
--- a/packages/dialogs/tests/test_elements.py
+++ b/packages/dialogs/tests/test_elements.py
@@ -233,6 +233,13 @@ def test_add_submit_buttons(library):
         "default": None,
     }
 
+def test_add_dialog_next_page_button(library):
+    library.add_dialog_next_page_button(label="next button")
+    assert len(library.elements) == 1
+    assert library.elements[0] == {
+        "type": "next",
+        "label": "next button"
+    }
 
 def test_clear_elements(library):
     library.add_heading("Whatever")