jenkins-bot has submitted this change and it was merged.

Change subject: Bug 31876: Add an html validation test to Makefile
......................................................................


Bug 31876: Add an html validation test to Makefile

This shows we have 3 errors in main namespace and 2 in special
namespace. Both appear to be core issues which would be great to fix.

Made naming more consistent, moved comment in Makefile to a separate
line (jgonera)

Bug: 31876

Change-Id: I1414e2fbc71b090e07d4a1073ee3b6f3159f3759
---
M Makefile
A scripts/validatehtml.sh
2 files changed, 24 insertions(+), 0 deletions(-)

Approvals:
  JGonera: Looks good to me, but someone else must approve
  awjrichards: Verified; Looks good to me, approved
  jenkins-bot: Verified



diff --git a/Makefile b/Makefile
index 156ead4..1a2a47f 100644
--- a/Makefile
+++ b/Makefile
@@ -26,3 +26,7 @@
        ln -sf ${PWD}/scripts/pre-commit .git/hooks/pre-commit
        ln -sf ${PWD}/scripts/pre-rebase .git/hooks/pre-rebase
        ln -sf ${PWD}/scripts/post-rewrite .git/hooks/post-rewrite
+
+# user must create W3CValidationTest wiki page with text 'Hello world' for 
this to work
+validatehtml:
+       @scripts/validatehtml.sh
diff --git a/scripts/validatehtml.sh b/scripts/validatehtml.sh
new file mode 100755
index 0000000..c66de8f
--- /dev/null
+++ b/scripts/validatehtml.sh
@@ -0,0 +1,20 @@
+#!/usr/bin/env bash
+mkdir -p tmp
+URL=${MEDIAWIKI_URL:-"http://127.0.0.1:80"}
+curl -sG "$URL/index.php/W3CValidationTest?useformat=mobile" > 
tmp/validate.html
+curl -sG "$URL/index.php/Special:MobileOptions?useformat=mobile" > 
tmp/validate_special.html
+curl -sF "uploaded_file=@tmp/validate.html;type=text/html" -F output=json 
http://validator.w3.org/check > tmp/validate.json
+curl -sF "uploaded_file=@tmp/validate_special.html;type=text/html" -F 
output=json http://validator.w3.org/check > tmp/validate_special.json
+
+#check the validation results of a page in the main namespace
+if grep -q '"type": "error"' tmp/validate_page.json
+then
+       num=`grep -c '"type": "error"' tmp/validate.json`
+       echo $num validation errors found in main namespace page [see 
tmp/validate.json]
+fi
+#check the validation results of a page in the special namespace
+if grep -q '"type": "error"' tmp/validate_special.json
+then
+       num=`grep -c '"type": "error"' tmp/validate_special.json`
+       echo $num validation errors found in special page html markup [see 
tmp/validate_special.json]
+fi

-- 
To view, visit https://gerrit.wikimedia.org/r/61775
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I1414e2fbc71b090e07d4a1073ee3b6f3159f3759
Gerrit-PatchSet: 4
Gerrit-Project: mediawiki/extensions/MobileFrontend
Gerrit-Branch: master
Gerrit-Owner: Jdlrobson <[email protected]>
Gerrit-Reviewer: JGonera <[email protected]>
Gerrit-Reviewer: Jdlrobson <[email protected]>
Gerrit-Reviewer: MaxSem <[email protected]>
Gerrit-Reviewer: awjrichards <[email protected]>
Gerrit-Reviewer: jenkins-bot

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to