Helpful-Extensions
Helpful-Extensions copied to clipboard
Shape Tracing should skip the PageTitle shape (OSOE-589)
This is the shape that goes into the <title>
HTML element. As far as I've seen the inner HTML of the <title>
element is treated as plain text in every current browser, so the <!-- .... -->
is rendered into the beginning of the window title.
The shape tracing should make an exception by skipping PageTitle shape for a better developer experience and easier UI testing setup.
Perhaps rather the shape tracing info needs to be added, but with a different position so it's not part of the title
tag.
The following error occurred in OSOE-609:
error: title text cannot be longer than 70 characters (long-title) at f3d51ba8-d411-469e-8361-55c3415501c2.html:11:42:
9 | IsCached: False
10 | -->
> 11 | Blog - Lombiq's OSOCE - UI Testing</title>
| ^
12 | <link type="image/x-icon" rel="shortcut icon" href="/favicon.ico">
13 |
14 | <script src="/Lombiq.BaseTheme/vendors/bootstrap/js/bootstrap.bundle.js?v=SIYbLg8Kyb12W8RgxT7zwNAeUMfrfld1XpKbc_0Q1hE"></script>
Details: https://html-validate.org/rules/long-title.html
1 error found.
I don't understand why it doesn't appear for other page tests, but once this is fixed, we need to remove the workaround in test/Lombiq.OSOCE.Tests.UI/Tests/ModuleTests/BehaviorVueTests.cs, line 69:
&& !error.ContainsOrdinalIgnoreCase("title text cannot be longer than 70 characters")
In any case, Shape Tracing shouldn't be enabled in a UI test that doesn't actually test Shape Tracing itself.
True.
If the title issue is fixed, Shape Tracing not being enabled in Lombiq.OSOCE.Tests.recipe.json (added in issue/OSOE-548
) should be evaluated.
Do we want to display the shape tracing info of PageTitle? I don't think it's possible to put it elsewhere from ShapeTracingShapeEvents.cs.
I think we would need a middleware with additional code, because from ShapeTracingShapeEvents.cs
we can't "see" outside of the shape. And since this is inside the<title>
, we can't manipulate the outside. And we can't put comments inside the title.
I still think we don't need it. How about outputting the text between the comments as ILogger.LogInformation()
too? Then it will appear at least somewhere. Also include a note in the docs that TitlePart's comment can't be rendered in the HTML.