Skip to content
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

Add ability for components to have dependent states #213

Open
zmknox opened this issue Nov 5, 2019 · 0 comments
Open

Add ability for components to have dependent states #213

zmknox opened this issue Nov 5, 2019 · 0 comments
Labels
enhancement New feature or request

Comments

@zmknox
Copy link
Contributor

zmknox commented Nov 5, 2019

In order to better model sites with Simulato models, it would be quite helpful for models to provide dependent state conditions for a component to be created or modified. This would make modeling easier by

  • Allowing for multiple dependent states to be required for a component to be created.
  • Removal of conditional statements checking for a state to create a component, replaced by a smaller, far more manageable syntax.

Proposed Syntax:

A dependency would look similar to an action precondition (using term 'dependencies' for these states to differentiate from 'preconditions' for actions):

 [ 'isGreaterThan', 'pageState.exampleTextBox.exampleInputField.value.length', 0 ]

The first parameter would specify what comparison should be checked (only allowing ===, >, <, >==, and <==).
The second parameter specified the state that should be checked.
The third parameter is what the state parameter should be compared to.

In the example above, we are verifying that the exampleInputField value's length is greater than 0, thus stating that the input field should have contents.

Creating a Component

When creating a component, a new option could, optionally, be provided to specify dependencies:

expectedState.createAndAddComponent({
    type: 'ComponentType',
    name: 'componentName',
    state: {},
    dynamicArea: 'dynamicArea',
    dependencies: [
        [ 'isGreaterThan', 'pageState.exampleTextBox.exampleInputField.length', 0 ]
    ]
});

Modifying a Component

When modifying a component, a new parameter could, optionally, be provided to specify dependencies:

expectedState.modify(`componentName`, (component) => {
    // completion handler block
}, [
    [ 'isGreaterThan', 'pageState.exampleTextBox.exampleInputField.length', 0 ]
]);

Effects on the Planner

With this information provided, the planner can better understand the structure of a webpage, specifically when multiple actions are required for a particular element to appear. This can then be user to better order actions within plans (especially in replanning).

Acceptance Criteria:

  • Added logic to parse dependencies within expected-state.js, and other files as needed
  • Provide unit tests for updated files
  • Documentation for new syntax in Simulato documentation website

Future Work

  • Update planning algorithms to understand dependencies
@zmknox zmknox added the enhancement New feature or request label Nov 5, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant