hsac-fitnesse-fixtures
hsac-fitnesse-fixtures copied to clipboard
validate HTML code for a page
The nu HTML validator has a respectable embedded HTML validation library.
This can be made into an inline Browser Test command:
|validate page source |
or
|validate page source | ignoring_errors_map |
Or it could be made into a completely different Fixture that 'knows' where savePageSource() saves its files, or even can decompose the link returned by savePageSource() to handle duplicate name resolution.
Thoughts?
save page source
returns a reference to a file in the wiki's 'files' section. You can store this in a Slim symbol and pass this symbol to another fixture. I do this extensively to combine browser (or http) test downloads and file fixture (the method SlimFixture.getFilePathFromWikiUrl()
does what is needed in the receiving fixture).
I do believe that a HTML validating fixture might be nice. Maybe you could make a PR to add this functionality to HtmlFixture?
I don't believe HTML validation should be a feature of BrowserTest. Browser's don't warn a user if HTML is not valid: BrowserTest is about validating whether a site can accomplish the functional goals. If the HTML is invalid but works in the browser test should be green ;-)
Side note: Selenium (or the webdriver) injects an invalid tag in the HTML, which is always reported by the validator with a message: "vAttribute \u201Cwebdriver\u201D not allowed on element \u201Chtml\u201D in this context."
This feature will have to come with an easy way to ignore common errors like this, despite errors being defined by their message text, which contains special characters.
I'm curious to find out where that invalid HTML tag comes from? I don't see it on my mac with chrome when I run HsacAcceptanceTests.SlimTests.BrowserTest.PageSourceTest
. Do you see it there also, or only with different browser, or more complex page?