Add static page with app banner
MODIFY
lib/express/server.js
lib/express/server.js
@@ -8,7 +8,7 @@ import log from './logger';
import { startLogFormatter, endLogFormatter } from './express-logging';
import { allowCrossDomain, fixPythonContentType, defaultToJSONContentType,
catchAllHandler, catch404Handler, catch4XXHandler } from './middleware';
-import { guineaPig, guineaPigScrollable, welcome, STATIC_DIR } from './static';
+import { guineaPig, guineaPigScrollable, guineaPigAppBanner, welcome, STATIC_DIR } from './static';
import { produceError, produceCrash } from './crash';
import B from 'bluebird';
@@ -94,6 +94,7 @@ function configureServer (app, configureRoutes) {
app.all('/welcome', welcome);
app.all('/test/guinea-pig', guineaPig);
app.all('/test/guinea-pig-scrollable', guineaPigScrollable);
+ app.all('/test/guinea-pig-app-banner', guineaPigAppBanner);
// catch this last, so anything that falls through is 404ed
app.use(catch404Handler);

MODIFY
lib/express/static.js
lib/express/static.js
@@ -45,12 +45,19 @@ async function guineaPig (req, res) {
}
/*
- * Dynamic page mapped to /test/guinea-pig
+ * Dynamic page mapped to /test/guinea-pig-scrollable
*/
async function guineaPigScrollable (req, res) {
return await guineaPigTemplate(req, res, 'guinea-pig-scrollable.html');
}
+/*
+ * Dynamic page mapped to /test/guinea-pig-app-banner
+ */
+async function guineaPigAppBanner (req, res) {
+ return await guineaPigTemplate(req, res, 'guinea-pig-app-banner.html');
+}
+
/*
* Dynamic page mapped to /welcome
*/
@@ -65,4 +72,4 @@ async function getTemplate (templateName) {
return _.template(content.toString());
}
-export { guineaPig, guineaPigScrollable, welcome, STATIC_DIR };
+export { guineaPig, guineaPigScrollable, guineaPigAppBanner, welcome, STATIC_DIR };

MODIFY
package.json
package.json
"coverage": "gulp coveralls",
"mocha": "mocha",
"e2e-test": "gulp e2e-test",
+ "build": "gulp transpile",
"precommit-msg": "echo 'Pre-commit checks...' && exit 0",
"precommit-test": "REPORTER=dot gulp once"
},

ADD
static/test/guinea-pig-app-banner.html
+
+<!DOCTYPE html>
+<html>
+<head>
+ <meta name="apple-itunes-app" content="app-id=myAppStoreID, affiliate-data=myAffiliateData, app-argument=myURL">
+ <title>I am a page title</title>
+ <script type="text/javascript" src="/js/jquery.min.js"></script>
+</head>
+<body>
+
+<h1>This page is a Selenium sandbox</h1>
+
+I am some page content
+<div id="i_am_an_id" class="i_am_a_class">I am a div</div>
+<a href="/test/guinea-pig2.html" id="i am a link">i am a link</a><br/>
+<a href="#anchor" id="i am an anchor link">i am an anchor link</a><br/>
+<a href="/test/guinea-pig2.html" id="blanklink" target="_blank">i am a new window link</a>
+<a href="/test/guinea-pig3.html" id="guinea pig 3 link">i am a link to page 3</a><br/>
+<a href="/test/guinea-pig4.html" id="guinea pig 4 blank link" target="_blank">i am a new window link to page 4</a>
+<div>i appear 3 times</div>
+<div>i appear 3 times</div>
+<div>i appear 3 times</div>
+<div id="popuplink" onclick="setTimeout(function() { window.open('/test/guinea-pig2.html', 'popupwin'); }, 500);">i cause a popup window</div>
+<div id="guinea pig 5 popup link" onclick="setTimeout(function() { window.open('/test/guinea-pig5.html', 'popupwin'); }, 500);">i cause a popup window with page 5</div>
+<div id="invisible div" style="display:none;">i am invisible</div>
+<div>
+ <a id="alert1" href="javascript:void(0);" onclick="alert('I am an alert')">I cause an alert</a>
+ <a id="prompt1" href="javascript:void(0);" onclick="$('#promptVal').val(prompt('Do you like javascript?'));">I cause a prompt</a>
+ <input type="text" value="" id="promptVal" /></div>
+<form id="the_forms_id">
+<p>
+<input id="i_am_a_textbox" name="i_am_a_textbox" type="text" value="i has no focus" />
+</p>
+<input type="checkbox" id="unchecked_checkbox" name="unchecked_checkbox"/>
+<input type="checkbox" id="checked_checkbox" name="checked_checkbox" checked="checked"/>
+<select name="selectbox">
+ <option value="value1">First option</option>
+ <option value="value2">Second option</option>
+ <option value="value3">Third option</option>
+</select>
+
+</form>
+<span id="your_comments">
+ Your comments: <%= comment %><br/>
+</span>
+&#x00F1;&#x2603;
+<script type="text/javascript">
+ $(document).ready(function(){
+ $("#i_am_a_textbox").focus(function(){$(this).val("");})
+ .blur(function(){$(this).val("i has no focus");});
+ });
+</script>
+
+ <div class="border">
+
+ <form id="jumpContact" method="post">
+ <p>
+ <label for="fbemail">Email:</label><br>
+ <input id="fbemail" type="text" size="50" name="fbemail" placeholder="We would really like to follow up!"></input>
+ </p>
+ <p>
+ <label for="comments">Comments:</label><br>
+ <textarea id="comments" style="width:400px;height:100px" name="comments" placeholder="Thanks in advance, this is really helpful."></textarea>
+ </p>
+ <div style="float:right">
+ <input class="jumpButton" type="submit" name="submit" id="submit" value="send" />
+ </div>
+ </form>
+ </div>
+
+ <p>Server time: <span id="servertime"><%= serverTime %></span></p>
+ <p>Client time: <span id="clienttime"><%= parseInt(new Date().getTime() / 1000, 10) %></span></p>
+ <script type="text/javascript">
+ var uuid;
+ try {uuid = window.location.toString().match(/\?(.*)$/)[1]; } catch (ign) {}
+ if (uuid) document.title = document.title + " - " + uuid;
+ </script>
+
+ <p id="useragent"><%= userAgent %></p>
+
+</body>
+</html>

MODIFY
test/express/server-specs.js
test/express/server-specs.js
@@ -19,7 +19,7 @@ describe('server configuration', () => {
let configureRoutes = () => {};
configureServer(app, configureRoutes);
app.use.callCount.should.equal(15);
- app.all.callCount.should.equal(3);
+ app.all.callCount.should.equal(4);
});
it('should reject if error thrown in configureRoutes parameter', async () => {

Add static page with app banner (#138)