diff --git a/src/Framework/Framework/Configuration/DotvvmCompilationPageConfiguration.cs b/src/Framework/Framework/Configuration/DotvvmCompilationPageConfiguration.cs index b0296d8334..a08070bc37 100644 --- a/src/Framework/Framework/Configuration/DotvvmCompilationPageConfiguration.cs +++ b/src/Framework/Framework/Configuration/DotvvmCompilationPageConfiguration.cs @@ -125,8 +125,8 @@ public void Apply(DotvvmConfiguration config) url: Url, virtualPath: "embedded://DotVVM.Framework/Diagnostics/CompilationPage.dothtml"); - config.Markup.AddMarkupControl("_dotvvm-internal", "CompilationDiagnostic", "embedded://DotVVM.Framework/Diagnostics/CompilationDiagnostic.dotcontrol"); - config.Markup.AddMarkupControl("_dotvvm-internal", "CompilationDiagnosticRows", "embedded://DotVVM.Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol"); + config.Markup.AddMarkupControl("dotvvm-internal", "CompilationDiagnostic", "embedded://DotVVM.Framework/Diagnostics/CompilationDiagnostic.dotcontrol"); + config.Markup.AddMarkupControl("dotvvm-internal", "CompilationDiagnosticRows", "embedded://DotVVM.Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol"); config.Security.RequireSecFetchHeaders.EnableForRoutes(RouteName); } diff --git a/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol b/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol index 11ebb2548f..34cd0cdc8a 100644 --- a/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol +++ b/src/Framework/Framework/Diagnostics/CompilationDiagnosticRows.dotcontrol @@ -8,7 +8,7 @@ - <_dotvvm-internal:CompilationDiagnostic style="margin-left: 3rem" /> + diff --git a/src/Framework/Framework/Diagnostics/CompilationPage.dothtml b/src/Framework/Framework/Diagnostics/CompilationPage.dothtml index 5ab36ace2d..247a5f40c9 100644 --- a/src/Framework/Framework/Diagnostics/CompilationPage.dothtml +++ b/src/Framework/Framework/Diagnostics/CompilationPage.dothtml @@ -57,12 +57,12 @@ Class-success="{value: Status == 'CompletedSuccessfully' && Warnings.Length == 0}" /> - - <_dotvvm-internal:CompilationDiagnosticRows + + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> - + @@ -108,12 +108,12 @@ - - <_dotvvm-internal:CompilationDiagnosticRows + + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> - + @@ -143,17 +143,16 @@

Master pages

- - - <_dotvvm-internal:CompilationDiagnosticRows + + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> - + @@ -208,7 +207,7 @@ - <_dotvvm-internal:CompilationDiagnosticRows + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> @@ -225,7 +224,7 @@ - <_dotvvm-internal:CompilationDiagnosticRows + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> @@ -240,7 +239,7 @@ - <_dotvvm-internal:CompilationDiagnosticRows + 0} Diagnostics={value: Enumerable.Concat(Errors, Warnings).ToArray()} DisplayLimit={value: _root.DefaultShownDiagnosticLimit} /> diff --git a/src/Samples/Tests/Tests/Base/AppSeleniumTest.cs b/src/Samples/Tests/Tests/Base/AppSeleniumTest.cs index fbaf3b3c66..d8d630fdc8 100644 --- a/src/Samples/Tests/Tests/Base/AppSeleniumTest.cs +++ b/src/Samples/Tests/Tests/Base/AppSeleniumTest.cs @@ -27,6 +27,9 @@ public By SelectByDataUi(string selector) public By SelectByUiTestName(string selector) => SelectBy.CssSelector($"[data-uitest-name='{selector}']"); + public By SelectByButtonText(string text) => + By.XPath($".//button[normalize-space(.)='{text}'] | .//input[(@type='submit' or @type='button') and normalize-space(@value)='{text}']"); + public virtual void RunInAllBrowsers(Action testBody, [CallerMemberName] string callerMemberName = "", [CallerFilePath] string callerFilePath = "", diff --git a/src/Samples/Tests/Tests/Feature/CompilationPageTests.cs b/src/Samples/Tests/Tests/Feature/CompilationPageTests.cs new file mode 100644 index 0000000000..a408d3b97e --- /dev/null +++ b/src/Samples/Tests/Tests/Feature/CompilationPageTests.cs @@ -0,0 +1,59 @@ +using DotVVM.Samples.Tests.Base; +using DotVVM.Testing.Abstractions; +using OpenQA.Selenium; +using Riganti.Selenium.Core; +using Riganti.Selenium.Core.Abstractions; +using Riganti.Selenium.DotVVM; +using Xunit; +using Xunit.Abstractions; + +namespace DotVVM.Samples.Tests.Feature +{ + public class CompilationPageTest : AppSeleniumTest + { + IElementWrapper TableRow(IBrowserWrapper browser, string name) => + browser.Single($"//tr[not(contains(@class, 'row-continues')) and td[normalize-space(.) = '{name}']]", By.XPath); + [Fact] + [Trait("Category", "dev-only")] + public void Feature_CompilationPage_SmokeTest() + { + RunInAllBrowsers(browser => { + browser.NavigateToUrl("/_dotvvm/diagnostics/compilation"); + browser.Single("compile-all-button", By.Id).Click(); + browser.Single("Routes", SelectByButtonText).Click(); + + // shows failed pages + Assert.InRange(browser.FindElements("tbody tr.success").Count, 10, int.MaxValue); + Assert.InRange(browser.FindElements("tbody tr.failure").Count, 10, int.MaxValue); + browser.WaitFor(() => { + AssertUI.HasClass(TableRow(browser, "FeatureSamples_CompilationPage_BindingsTestError"), "failure", waitForOptions: WaitForOptions.Disabled); + }, timeout: 10_000); + AssertUI.HasNotClass(TableRow(browser, "FeatureSamples_CompilationPage_BindingsTest"), "failure"); + + // shows some errors and warnings + Assert.InRange(browser.FindElements(".source-errorLine").Count, 20, int.MaxValue); + Assert.InRange(browser.FindElements(".source-warningLine").Count, 20, int.MaxValue); + + // found master pages + browser.Single("Master pages", SelectByButtonText).Click(); + AssertUI.IsDisplayed(TableRow(browser, "Views/Errors/Master.dotmaster")); + AssertUI.IsDisplayed(TableRow(browser, "Views/ControlSamples/SpaContentPlaceHolder_HistoryApi/SpaMaster.dotmaster")); + + // found controls + browser.Single("Controls", SelectByButtonText).Click(); + AssertUI.IsDisplayed(TableRow(browser, "MarkupControlPropertiesSameName")); + + // filters errors and warnings + browser.Single("Errors", SelectByButtonText).Click(); + browser.FindElements("tbody tr:not(.failure):not(.row-continues)").ThrowIfDifferentCountThan(0); + + browser.Single("Warnings", SelectByButtonText).Click(); + browser.FindElements("tbody tr.success").ThrowIfDifferentCountThan(0); + }); + } + + public CompilationPageTest(ITestOutputHelper output) : base(output) + { + } + } +}