Lombiq UI Testing Toolbox - Orchard Core Features tests, disable File Content Definition feature by default - This week in Orchard (10/12/2021)

Gábor Domonkos's avatar
Multi-tenancy, Documentation, This week in Orchard, Workflows

The HTTP Response Task now supports the text/html content type, disables the File Content Definition feature by default, prevents confusing usage of IRunningShellTable.Match(HttpContext) and demo about the Orchard Core Features tests in the Lombiq UI Testing Toolbox. Do you want to know more? Then don't forget to check out our current post!

Orchard Core updates

HTTP Response Task supports "text/html" content type

If you are using Workflows in your solution, you have the option to use the HTTP Response task, which writes an HTTP response (to use that task, you need to enable the HTTP Workflows Activities feature). If you are in the editor of your Workflow, you just need to click on the Add Task button and select the HTTP Response from the HTTP category. From now, you will see a new text/html content-type option of the response body, which allows workflow submissions to return web content directly.

Adding new content type of the response body for the Http Response Task

Don't enable the File Content Definition feature by default in the built-in themes

From now the File Content Definition feature will not be enabled by default. This feature is replacing the default behavior to store content type definitions in the database with one that stores the content type definitions in a file in the App_Data folder. Most users prefer to store the content type definitions in the database by default. You can still enable this feature if you prefer your content definitions to be file-based, for instance, if you want them in your source control management. But by default, they will be in the database from now. If you have a distributed theme or site, then you might want it to be in the database by default. And the change is just to remove the feature from the recipes. The corresponding page on the Orchard Core documentation is also updated to inform everybody about the changes.

The updated documentation of the File Content Definition feature

Prevent confusing usage of IRunningShellTable.Match(HttpContext)

You could use this extension method with an HttpContext, but it didn't actually work anywhere where you can do it from a module. So, from now this RunningShellTableExtensions is an internal class, because as you can see from the comment there: not public because it wouldn't match tenants with an URL prefix later in the request pipeline. Mostly to be used from ModularTenantContainerMiddleware.

Making RunningShellTableExtensions class internal


Lombiq UI Testing Toolbox - Orchard Core Features tests

The Lombiq UI Testing Toolbox is a web UI testing toolbox mostly for Orchard Core applications. Everything you need to do UI testing with Selenium for an Orchard app is here.

UI Testing here is an automation that clicks through the web application in a browser. One of the most popular frameworks for that is Selenium, which does exactly that. You get an API to instruct a browser, and every major browser is supported. This UI Testing Toolbox provides a lot of features on top of Selenium for Orchard Core. Basically, allowing you to UI test an Orchard Core application in a safe and parallelized way providing a lot of helpers, a lot of higher-level APIs allowing you to test your application with SQLite, with SQL Server with local media storage, or with Azure Blob Storage. And you can have a test e-mail sending with a local SMTP server too. Everything just works. Check out the highlights of the Readme.md file of this repository to see all of the features and this older This week in Orchard post where you could see a demo about the Toolbox. This time we will focus on the Orchard Core Features tests.

The idea here is that you have an Orchard Core application, and you want to do some basic smoke testing, like trial the application whether it works at its very basics. Now, for that, we have created a TestBasicOrchardFeatures extension method, which will run through a couple of tests that you can run individually.

Using the TestBasicOrchardFeatures extension method

For example, testing whether the setup works, testing whether the registration works, testing whether the login works, and so on. All of these are features of Orchard Core itself, so not your custom application, but these are also all things that you can break from your custom code. So, we figured that it's useful to check whether these basic Orchard features work all the time. And for example, if you manage to break set up with your recipe or if you manage to break the login or the registration features from your code like even implementing an event handler that throws an exception, well then these tests should catch them.

The implementation of the TestBasicOrchardFeatures

Do you want to see these tests in action? Well, in that case, you just have to click on the following recording on YouTube!

News from the community

Orchard Dojo Newsletter

Lombiq's Orchard Dojo Newsletter has 235 subscribers! We have started this newsletter to inform the community around Orchard with 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 you think would like to read our weekly articles? Tell them to subscribe here!

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

No Comments

Add a Comment