The problem:
In DMN Boxed Expression Editor, we are using Playwright to write E2E tests, which can be a bit verbose and hard to write new tests with a lot of copy-paste of code.
For example, consider the code below to add a new entry in the Context Expression:
Also, consider that in the example above we can change the name of the Context, so the example will not work without changing the ContextEntry-1 to the new name.
This can become very tricky and annoying in more complex scenarios.
The solution:
We need an API to encapsulate the Playwright details and make it easier and clearer to perform tests in BEE.
The API should follow the fluent pattern, with the current BEE editor being the entry point.
The entry point should be a Playwright's fixture.
Some API examples:
// Select the Decision Table in an empty Boxed Expression Editor
await bee.selectExpressionMenu.selectDecisionTable();
// Adds an output column at the start (the rightmost)
await bee.expression.asDecisionTable().addOutputAtStart();
// Adds a row in the decision table
await bee.expression.asDecisionTable().addRow();
// Fills the cell at row 2 column 1 with the text "this is my text"
await bee.expression.asDecisionTable().cellAt({ row: 2, column: 1 }).fill("this is my text");
On-screen Result:
// Select the Context in an empty Boxed Expression Editor
await bee.selectExpressionMenu.selectContext();
// In the "Select Expression Menu" of the first entry, select Context to add a new nested context
await bee.expression.asContext().entry(0).selectExpressionMenu.selectContext();
// In the firs entry of the nested Context in the first entry of the top-level Context, select Literal
await bee.expression.asContext().entry(0).expression.asContext().entry(0).selectExpressionMenu.selectLiteral()
On-screen Result:
Tests:
We must cover the common and basic functionalities for every expression in the BEE.
Here is a list of the tests that should cover those features:
1. TO ALL EXPRESSIONS:
Copy, Paste, Cut:
[x] a. Copy and Past top-level expression
[x] b. Cut and Past top-level expressions
[x] 2. Change name and type
2. SPECIFIC TESTS
1. Literal
[x] Can fill and change the content
2. Relation
[x] Can add/delete a column
[x] Can add/delete a column at a specific position
[x] Can add/delete a row
[x] Context menu
3. Context
[x] Can add/remove entry
[x] Context menu
4. Decision Table
[x] Can add/delete an input column
[x] Can add/delete an input column at a specific position
[x] Can add/delete an output column
[x] Can add/delete an output column at a specific position
[x] Can add/delete an annotation column
[x] Can add/delete an annotation column at a specific position
[x] Can change the hitpolicy (check every case)
[x] Can add/delete a row
[x] Context menu
5. List
[x] Can add/delete a row
[x] Context menu
6. Invocation
[ ] Can change the Function Name
[ ] Can copy/paste/reset the Function Name
[x] Can add/change/delete a parameter
[ ] Can select/reset parameter expression
7. Conditional
[ ] Can select/change/reset "if"
[ ] Can select/change/reset "then"
[ ] Can select/change/reset "else"
8. For
[ ] Can select/change/reset "for" variable
[ ] Can select/change/reset "in"
[ ] Can select/change/reset "return"
9. Every
[ ] Can select/change/reset "every" variable
[ ] Can select/change/reset "in"
[ ] Can select/change/reset "satisfies"
10. Some
[ ] Can select/change/reset "some" variable
[ ] Can select/change/reset "in"
[ ] Can select/change/reset "satisfies"
11. Filter
[ ] Can select/change/reset the "in" expression
[ ] Can select/change/reset the "match" expression
3. TO EXPRESSION WITH NESTED EXPRESSIONS
Need some more complex tests to mix expressions that allow nested expressions (Filter, Some, Every, For, Conditional, List, Context and Invocation)
The problem: In DMN Boxed Expression Editor, we are using Playwright to write E2E tests, which can be a bit verbose and hard to write new tests with a lot of copy-paste of code.
For example, consider the code below to add a new entry in the Context Expression:
Also, consider that in the example above we can change the name of the Context, so the example will not work without changing the
ContextEntry-1
to the new name.This can become very tricky and annoying in more complex scenarios.
The solution:
We need an API to encapsulate the Playwright details and make it easier and clearer to perform tests in BEE.
The API should follow the fluent pattern, with the current BEE editor being the entry point.
The entry point should be a Playwright's fixture.
Some API examples:
On-screen Result:
On-screen Result:
Tests:
We must cover the common and basic functionalities for every expression in the BEE. Here is a list of the tests that should cover those features:
1. TO ALL EXPRESSIONS:
2. SPECIFIC TESTS
1. Literal
2. Relation
3. Context
4. Decision Table
5. List
6. Invocation
7. Conditional
8. For
9. Every
10. Some
11. Filter
3. TO EXPRESSION WITH NESTED EXPRESSIONS Need some more complex tests to mix expressions that allow nested expressions (Filter, Some, Every, For, Conditional, List, Context and Invocation)