Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
add integration tests
adds a testmatrix for different magnolia versions to run integration tests based on bash or cheerio. uses a bootstrap.xml to setup the page.
- Loading branch information
1 parent
d2cf96b
commit 9f7339b
Showing
7 changed files
with
256 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,38 @@ | ||
| language: node_js | ||
| node_js: | ||
| - "6" | ||
|
|
||
| env: | ||
| - MAGNOLIA_CE_VERSION=5.5.1 | ||
| - MAGNOLIA_CE_VERSION=5.5 | ||
|
|
||
| sudo: false | ||
| addons: | ||
| apt: | ||
| packages: | ||
| - oracle-java8-installer | ||
| - oracle-java8-set-default | ||
|
|
||
| dist: trusty | ||
|
|
||
| before_script: | ||
|
|
||
| - cd .. && git clone -b proto https://github.com/robertkowalski/magnolia-cli && cd magnolia-cli && npm i -g . && cd .. | ||
This comment has been minimized.
Sorry, something went wrong. |
||
| - mgnl -h | ||
|
|
||
| - mkdir -p magnolia && cd magnolia && mgnl jumpstart --magnolia-version=$MAGNOLIA_CE_VERSION && cd .. | ||
|
|
||
| - cd mgnl-custom && npm run build && cd .. | ||
|
|
||
| - cp -R mgnl-custom magnolia/light-modules/ | ||
| - cp magnolia/light-modules/mgnl-custom/dev/test/fixtures/website.ci-testpage.xml magnolia/apache-tomcat/webapps/magnoliaAuthor/WEB-INF/bootstrap/common | ||
|
|
||
| - mkdir -p magnolia/apache-tomcat/logs/ | ||
| - touch magnolia/apache-tomcat/logs/catalina.out | ||
| - pwd && ls | ||
| - cd magnolia | ||
| - mgnl start & | ||
| - until fgrep -q "Server startup" apache-tomcat/logs/catalina.out; do sleep 1; done | ||
|
|
||
| - cd .. | ||
| - cd mgnl-custom | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,150 @@ | ||
| <?xml version="1.0" encoding="UTF-8"?> | ||
| <sv:node sv:name="ci-testpage" xmlns:sv="http://www.jcp.org/jcr/sv/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> | ||
| <sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
| <sv:value>mgnl:page</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:mixinTypes" sv:type="Name" sv:multiple="true"> | ||
| <sv:value>mgnl:hasVersion</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:uuid" sv:type="String"> | ||
| <sv:value>b8815614-b331-4d15-940b-c37fe80d2b70</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="hideInNav" sv:type="Boolean"> | ||
| <sv:value>false</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:createdBy" sv:type="String"> | ||
| <sv:value>admin</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:activationStatus" sv:type="Boolean"> | ||
| <sv:value>true</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:comment" sv:type="String"> | ||
| <sv:value/> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:created" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:38:38.746Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:createdBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivated" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:40:05.367Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivatedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModified" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:46.658Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModifiedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:template" sv:type="String"> | ||
| <sv:value>mtk:pages/basic</sv:value> | ||
| </sv:property> | ||
| <sv:node sv:name="main"> | ||
| <sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
| <sv:value>mgnl:area</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:uuid" sv:type="String"> | ||
| <sv:value>c342b5e3-934a-40eb-bc8f-2290da580ca8</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:createdBy" sv:type="String"> | ||
| <sv:value>admin</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:activationStatus" sv:type="Boolean"> | ||
| <sv:value>true</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:created" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:06.215Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:createdBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivated" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:40:05.370Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivatedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModified" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:46.658Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModifiedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:node sv:name="0"> | ||
| <sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
| <sv:value>mgnl:component</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:uuid" sv:type="String"> | ||
| <sv:value>16395e0f-768a-47c3-956c-b8c3f87956e3</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="elementClass" sv:type="String"> | ||
| <sv:value>.furbie</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:createdBy" sv:type="String"> | ||
| <sv:value>admin</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:activationStatus" sv:type="Boolean"> | ||
| <sv:value>true</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:created" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:46.659Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:createdBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivated" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:40:05.374Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivatedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModified" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:46.659Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModifiedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:template" sv:type="String"> | ||
| <sv:value>mgnl-custom:components/mgnl-custom</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="option" sv:type="String"> | ||
| <sv:value>a</sv:value> | ||
| </sv:property> | ||
| </sv:node> | ||
| </sv:node> | ||
| <sv:node sv:name="footer"> | ||
| <sv:property sv:name="jcr:primaryType" sv:type="Name"> | ||
| <sv:value>mgnl:area</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:uuid" sv:type="String"> | ||
| <sv:value>11cf10fb-d1c8-4295-86ac-91285788f57c</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="jcr:createdBy" sv:type="String"> | ||
| <sv:value>admin</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:activationStatus" sv:type="Boolean"> | ||
| <sv:value>true</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:created" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:06.281Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:createdBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivated" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:40:05.375Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastActivatedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModified" sv:type="Date"> | ||
| <sv:value>2017-02-03T12:39:06.281Z</sv:value> | ||
| </sv:property> | ||
| <sv:property sv:name="mgnl:lastModifiedBy" sv:type="String"> | ||
| <sv:value>superuser</sv:value> | ||
| </sv:property> | ||
| </sv:node> | ||
| </sv:node> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| // mocha based tests | ||
|
|
||
| const assert = require('assert') | ||
| const request = require('request') | ||
| const cheerio = require('cheerio') | ||
|
|
||
| const URL = 'http://localhost:8080/magnoliaPublic/ci-testpage.html' | ||
|
|
||
| describe('integration test', () => { | ||
|
|
||
| it('renders the template with the css class furbie', (done) => { | ||
| request({ | ||
| headers: { | ||
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0' | ||
| }, | ||
| uri: URL | ||
| }, (err, res, body) => { | ||
| const $ = cheerio.load(body) | ||
| assert.equal($('.furbie').length, 1) | ||
| done() | ||
| }) | ||
| }).timeout(10000) | ||
|
|
||
| it('renders the template variable in the script tag', (done) => { | ||
| request({ | ||
| headers: { | ||
| 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10.12; rv:51.0) Gecko/20100101 Firefox/51.0' | ||
| }, | ||
| uri: URL | ||
| }, (err, res, body) => { | ||
| const $ = cheerio.load(body) | ||
| const scriptTagContent = $('script').text() | ||
| assert.ok(/\.furbie/.test(scriptTagContent), '.furbie in script') | ||
| done() | ||
| }) | ||
| }) | ||
|
|
||
| }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| #!/bin/sh | ||
|
|
||
| curl http://localhost:8080/magnoliaPublic/ci-testpage.html | ||
| curl http://localhost:8080/magnoliaPublic/ci-testpage.html | grep "furbie" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,5 @@ | ||
| // jest based tests | ||
|
|
||
| import Calendar from '../../js/calendar.js' | ||
|
|
||
| describe('calendar', () => { | ||
|
|
||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use latest version which contains
mgnl start