New Catch Workflow Fault Event, interactive mode in the Lombiq UI Testing Toolbox - This week in Orchard (01/09/2023)

Gábor Domonkos's avatar
Announcement, This week in Orchard, Content field, Workflows

New Catch Workflow Fault Event, add additional text info to the Content Picker Field, and a demo about adding an interactive mode to the Lombiq UI Testing Toolbox! Check out our post for the details!

Orchard Core updates

New Catch Workflow Fault Event

If you have the Workflows feature enabled, you can create workflows by clicking on the Workflows option from the admin menu. Here, you can create workflows and add events to your workflows by clicking on the Add Event button. In the list of available events, you will find a new one, called Catch Workflow Fault Event, that triggers and captures exception information when an exception occurs in any other workflow. If you select this event, you will find a text area called Trigger Condition, and the code inside it is automatically generated when you open the editor of the Catch Workflow Fault Event for the first time.

New Catch Workflow Fault Event

Add additional text info to the Content Picker Field

Let's play around a little bit with a site that we set up using the Blog recipe. First of all, we want to have an option where users can assign pages to blog posts, like "if you need more info, check out this page, or click here for this related content, and so on.". To do that, we can utilize the Content Picker Field. If we navigate to Content -> Content Definition -> Content Types and hit Edit near the Blog Post content type, we can find the Add Field button. By clicking on it, we can set the display name (let it be Related pages in this case) and select the field type (Content Picker Field). Now we can click the Edit button near our new Related pages Content Picker Field and do the magic here. We set up this field to allow multiple elements to be selected and said that we only want to choose from Page content types when working with this field.

But the new stuff is the Title Pattern editor. Here, you can define the pattern used to render the title with Liquid support. Here, you can see that this field renders the Display Text of the content items by default (keeping the current behavior), but you can modify this as you want. This can be a huge help for other users because, for example, using only the display name has become a problem for multilingual sites with pages named "blog" in multiple languages. Here, we modified the pattern to include the display URL too, not just the display text of the content items.

The editable title pattern of the Content Picker Field

And now, the last step is to try this out in action! We will just simply edit the predefined blog post and click on the Related pages Content Picker Field to see what will happen. As you can see, we have two Page content items on our site where we used the sample display name. It's hard to distinguish the content items but by seeing the URL too, we have an idea which Page could be which one. OK, maybe we are not using the best URLs for illustration, but I think you get the point here. :)

Content Picker field with the custom title

Demos

Interactive mode in the Lombiq UI Testing Toolbox

Maybe you have already heard about the Lombiq UI Testing Toolbox, our web UI testing toolbox mostly for Orchard Core applications. Everything you need to do UI testing with Selenium for an Orchard app is here. We wrote about it several times here as well, first when we open-sourced it, when we added some Orchard Core Features tests to it when we added the automated monkey testing feature to it, and when we introduced the Visual verification testing. At the end of last year, we showed you the latest updates about integrating UI testing into Orchard Core and the way you can use WebApplicationFactory or a fake video capture source. This time, we will check out a slightly different topic!

Basically, the Orchard Core process and the UI testing process are running together, you can't actually do testing and continue running the web application itself. So, for that, we have a new method called SwitchToInteractiveAsync, which enables the interactive mode for debugging the app while the test is paused. If you run the test, you are able to pause at that point, like hitting a breakpoint when debugging the code. So, sometimes you want to debug the test session, and assuming direct control would be nice. But you can't just drop a breakpoint in the test, since the Orchard Core web app and the test are the same process so it would pause both. The SwitchToInteractiveAsync extension method opens a new tab with info about the interactive mode and, then causes the test thread to wait until you've clicked on the "Continue Test" button in this tab. During that time, you can interact with OC as if it was a normal execution.

If you open up the InteractiveModeTests.cs file, you will find a demo of the feature with two tests: SampleTest and EnteringInteractiveModeShouldWait that illustrates how you can use the new SwitchToInteractiveAsync extension method.

Interactive mode tests

If you want to know more about this feature, head to YouTube for a recording!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 535 subscribers! We have started this newsletter to inform the community around Orchard of the latest news about the platform. By subscribing to this newsletter, you will get an e-mail whenever a new post is published to Orchard Dojo, including This week in Orchard of course.

Do you know of other Orchard enthusiasts who would like to read our weekly articles? Tell them to subscribe here!

If you are interested in more news about Orchard and the details of the topics above, don't forget to check out the recording of this Orchard meeting!

No Comments

Add a Comment