Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify IT verification with more Groovy features #46

Merged
merged 1 commit into from
Jan 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/it/mskins-10/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 1 == index.getText().count( 'Generated by Apache Maven Doxia ' )
assert index.text.contains( 'Generated by Apache Maven Doxia ' )
2 changes: 1 addition & 1 deletion src/it/mskins-107/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,4 @@
File index = new File( basedir, "target/site/index.html" )

assert index.exists()
assert 1 == index.getText().count("<meta name=\"generator\" content=\"Apache Maven Doxia Site Renderer 2.0.0-M4\" />")
assert index.text.contains("<meta name=\"generator\" content=\"Apache Maven Doxia Site Renderer 2.0.0-M4\" />")
2 changes: 1 addition & 1 deletion src/it/mskins-13/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 0 == index.getText().count( 'Generated by Apache Maven Doxia at' )
assert !index.text.contains( 'Generated by Apache Maven Doxia at' )
8 changes: 4 additions & 4 deletions src/it/mskins-143_default/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert 1 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
assert 1 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
assert !index.text.contains( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert index.text.contains( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert index.text.contains( 'ga(\'set\', \'anonymizeIp\', true);' )
assert index.text.contains( 'ga(\'set\', \'forceSSL\', true);' )
8 changes: 4 additions & 4 deletions src/it/mskins-143_false/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert 0 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
assert 0 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
assert !index.text.contains( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert index.text.contains( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert !index.text.contains( 'ga(\'set\', \'anonymizeIp\', true);' )
assert !index.text.contains( 'ga(\'set\', \'forceSSL\', true);' )
8 changes: 4 additions & 4 deletions src/it/mskins-143_true/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 0 == index.getText().count( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert 1 == index.getText().count( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert 1 == index.getText().count( 'ga(\'set\', \'anonymizeIp\', true);' )
assert 1 == index.getText().count( 'ga(\'set\', \'forceSSL\', true);' )
assert !index.text.contains( '_gaq.push([\'_setAccount\', \'FOO-BAR\']);' )
assert index.text.contains( 'ga(\'create\', \'FOO-BAR\', \'auto\');' )
assert index.text.contains( 'ga(\'set\', \'anonymizeIp\', true);' )
assert index.text.contains( 'ga(\'set\', \'forceSSL\', true);' )
2 changes: 1 addition & 1 deletion src/it/mskins-17/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert 1 == index.getText().count( '<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 1970-01-01</li>' )
assert index.text.contains( '<li id="publishDate" class="pull-right"><span class="divider">|</span> Last Published: 1970-01-01</li>' )
2 changes: 1 addition & 1 deletion src/it/mskins-174/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert !index.getText().contains( '<div id="breadcrumbs">')
assert !index.text.contains( '<div id="breadcrumbs">')
14 changes: 7 additions & 7 deletions src/it/mskins-177-apache-analytics/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert index.getText().contains( 'var u=\"https://analytics.apache.org\";')
assert index.getText().contains( '_paq.push([\'setSiteId\', \'3\']);')
assert index.getText().contains( '_paq.push([\'setTrackerUrl\', u+\'/matomo.php\']');
assert index.getText().contains( '_paq.push([\'disableCookies\']);')
assert index.getText().contains( '_paq.push([\'trackPageView\']);')
assert index.getText().contains( '_paq.push([\'enableLinkTracking\']);')
assert index.getText().contains( '_paq.push([\'foo\', \'Bar\']);')
assert index.text.contains( 'var u=\"https://analytics.apache.org\";')
assert index.text.contains( '_paq.push([\'setSiteId\', \'3\']);')
assert index.text.contains( '_paq.push([\'setTrackerUrl\', u+\'/matomo.php\']');
assert index.text.contains( '_paq.push([\'disableCookies\']);')
assert index.text.contains( '_paq.push([\'trackPageView\']);')
assert index.text.contains( '_paq.push([\'enableLinkTracking\']);')
assert index.text.contains( '_paq.push([\'foo\', \'Bar\']);')
14 changes: 7 additions & 7 deletions src/it/mskins-177-matomo-no-options/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert index.getText().contains( 'var u=\"https://analytics.apache.org\";')
assert index.getText().contains( '_paq.push([\'setSiteId\', \'3\']);')
assert index.getText().contains( '_paq.push([\'setTrackerUrl\', u+\'/matomo.php\']');
assert !index.getText().contains( '_paq.push([\'disableCookies\']);')
assert !index.getText().contains( '_paq.push([\'trackPageView\']);')
assert !index.getText().contains( '_paq.push([\'enableLinkTracking\']);')
assert !index.getText().contains( '_paq.push([\'foo\', \'Bar\']);')
assert index.text.contains( 'var u=\"https://analytics.apache.org\";')
assert index.text.contains( '_paq.push([\'setSiteId\', \'3\']);')
assert index.text.contains( '_paq.push([\'setTrackerUrl\', u+\'/matomo.php\']');
assert !index.text.contains( '_paq.push([\'disableCookies\']);')
assert !index.text.contains( '_paq.push([\'trackPageView\']);')
assert !index.text.contains( '_paq.push([\'enableLinkTracking\']);')
assert !index.text.contains( '_paq.push([\'foo\', \'Bar\']);')
2 changes: 1 addition & 1 deletion src/it/mskins-47/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
assert !index.getText().contains( '$headContent' )
assert !index.text.contains( '$headContent' )
2 changes: 1 addition & 1 deletion src/it/mskins-72/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ File index = new File( basedir, "target/site/index.html" )
int inceptionYear = 2002
int currentYear = Calendar.getInstance().get(Calendar.YEAR)
assert index.exists()
assert 1 == index.getText().count( "<p class=\"pull-right\">&#169;" )
assert index.text.contains( "<p class=\"pull-right\">&#169;" )
10 changes: 5 additions & 5 deletions src/it/mskins-76/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
String text = index.getText().replaceAll( "\r?\n", System.lineSeparator() )
assert 1 == text.count( '''\
String text = index.text.normalize()
assert text.contains( '''\
<script>
/* <![CDATA[ */
(function() {
Expand All @@ -29,9 +29,9 @@ assert 1 == text.count( '''\
s.src = 'https://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */</script>'''.replaceAll( "\r?\n", System.lineSeparator() ) )
/* ]]> */</script>'''.normalize() )

assert 1 == text.count( '''\
assert text.contains( '''\
<a class="FlattrButton" style="display:none;" href="http://opensource.org/"></a>
<noscript><a href="https://flattr.com/thing/448050/Open-Source-Initiative-OSI" target="_blank">
<img src="https://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" style="border: 0;" /></a></noscript>'''.replaceAll( "\r?\n", System.lineSeparator() ) )
<img src="https://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" style="border: 0;" /></a></noscript>'''.normalize() )
10 changes: 5 additions & 5 deletions src/it/mskins-76_topbar/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@

File index = new File( basedir, "target/site/index.html" )
assert index.exists()
String text = index.getText().replaceAll( "\r?\n", System.lineSeparator() )
assert 1 == text.count( '''\
String text = index.text.normalize()
assert text.contains( '''\
<script>
/* <![CDATA[ */
(function() {
Expand All @@ -29,9 +29,9 @@ assert 1 == text.count( '''\
s.src = 'https://api.flattr.com/js/0.6/load.js?mode=auto';
t.parentNode.insertBefore(s, t);
})();
/* ]]> */</script>'''.replaceAll( "\r?\n", System.lineSeparator() ) )
/* ]]> */</script>'''.normalize() )

assert 1 == text.count( '''\
assert text.contains( '''\
<a class="FlattrButton" style="display:none;" rev="flattr;button:compact;" href="http://opensource.org/"></a>
<noscript><a href="https://flattr.com/thing/448050/Open-Source-Initiative-OSI" target="_blank">
<img src="https://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" style="border: 0;" /></a></noscript>'''.replaceAll( "\r?\n", System.lineSeparator() ) )
<img src="https://api.flattr.com/button/flattr-badge-large.png" alt="Flattr this" title="Flattr this" style="border: 0;" /></a></noscript>'''.normalize() )
2 changes: 1 addition & 1 deletion src/it/sidebar/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ File index = new File( basedir, "target/site/index.html" )
assert index.exists()

// MSKINS-130 check that html structure is as clean as possible
String html = index.getText()
String html = index.text
// active menu
assert html.contains( '<li class="active"><a><span class="none"></span>About</a>' )
// inactive menu
Expand Down
2 changes: 1 addition & 1 deletion src/it/topbar/verify.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ File index = new File( basedir, "target/site/index.html" )
assert index.exists()

// MSKINS-130 check that html structure is as clean as possible
String html = index.getText()
String html = index.text
// active menu
assert html.contains( '<li><a title="About">About</a></li>' )
// inactive menu
Expand Down