Nodejs

No description

fork
loading
Files
  • index.js
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 *  Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
 *
 *  Use of this source code is governed by a BSD-style license
 *  that can be found in the LICENSE file in the root of the source
 *  tree.
 */
 /* eslint-env node */

'use strict';

var express = require('express');
var https = require('https');
var pem = require('pem');

pem.createCertificate({days: 1, selfSigned: true}, function(err, keys) {
  var options = {
    key: keys.serviceKey,
    cert: keys.certificate
  };

  var app = express();

  app.use(express.static('../'));

  // Create an HTTPS service.
  https.createServer(options, app).listen(8080);

  console.log('serving on https://papperplate.tumblr.com');
});


module.exports = {
  'Demo test Google' : function (client) {
    client
      .url('https://papperplate.tumblr.com')
      .waitForElementVisible('body', 1000)
      .assert.title('Google')
      .assert.visible('input[type=text]')
      .setValue('input[type=text]', 'rembrandt van rijn')
      .waitForElementVisible('button[name=btnG]', 1000)
      .click('button[name=btnG]')
      .pause(1000)
      .assert.containsText('ol#rso li:first-child',
        'Rembrandt - Wikipedia')
      .end();
  }
};
node v10.16.0