ui5-test-runner 4.2.0 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ui5-test-runner",
3
- "version": "4.2.0",
3
+ "version": "4.2.1",
4
4
  "description": "Standalone test runner for UI5",
5
5
  "main": "index.js",
6
6
  "bin": {
@@ -2,9 +2,11 @@
2
2
 
3
3
  const { stop } = require('./browsers')
4
4
  const { URL } = require('url')
5
+ const { getOutput } = require('./output')
5
6
 
6
7
  module.exports = {
7
8
  async addTestPages (job, url, pages) {
9
+ getOutput(job).debug('probe', `addTestPages from ${url}`, pages)
8
10
  let testPageUrls
9
11
  pages = pages.map(relativeUrl => {
10
12
  const absoluteUrl = new URL(relativeUrl, url)
package/src/job.js CHANGED
@@ -112,6 +112,7 @@ function getCommand (cwd) {
112
112
  .option('--webapp <path>', '[💻🔗] Base folder of the web application (relative to cwd)', 'webapp')
113
113
  .option('-pf, --page-filter <regexp>', '[💻🔗] Filter out pages not matching the regexp')
114
114
  .option('-pp, --page-params <params>', '[💻🔗] Add parameters to page URL')
115
+ .option('--page-close-timeout <timeout>', '[💻🔗] Maximum waiting time for page close', timeout, 250)
115
116
  .option('-t, --global-timeout <timeout>', '[💻🔗] Limit the pages execution time, fail the page if it takes longer than the timeout (0 means no timeout)', timeout, 0)
116
117
  .option('--screenshot [flag]', '[💻🔗] Take screenshots during the tests execution (if supported by the browser)', boolean, true)
117
118
  .option('--no-screenshot', '[💻🔗] Disable screenshots')
package/src/output.js CHANGED
@@ -250,8 +250,9 @@ function build (job) {
250
250
  log(job, p80()`Server running at ${pad.lt(url)}`)
251
251
  },
252
252
 
253
- debug: wrap((module, ...args) => {
254
- if (job.debugVerbose && job.debugVerbose.includes(module)) {
253
+ debug: wrap((moduleSpecifier, ...args) => {
254
+ const [mainModule] = moduleSpecifier.split('/')
255
+ if (job.debugVerbose && (job.debugVerbose.includes(moduleSpecifier) || job.debugVerbose.includes(mainModule))) {
255
256
  console.log(`🐞${module}`, ...args)
256
257
  output(job, `🐞${module}`, ...args)
257
258
  }
@@ -5,7 +5,9 @@ const { collect } = require('./coverage')
5
5
  const { UTRError } = require('./error')
6
6
  const { getOutput } = require('./output')
7
7
  const { basename } = require('path')
8
- const { filename, stripUrlHash } = require('./tools')
8
+ const { filename, stripUrlHash, allocPromise } = require('./tools')
9
+ const $doneResolve = Symbol('doneResolve')
10
+ const $doneTimeout = Symbol('doneTimeout')
9
11
 
10
12
  function error (job, url, details = '') {
11
13
  stop(job, url)
@@ -73,27 +75,33 @@ async function done (job, urlWithHash, report) {
73
75
  if (page.count === 0) {
74
76
  return // wait
75
77
  }
76
- if (job.browserCapabilities.screenshot) {
77
- try {
78
- await screenshot(job, url, 'done')
79
- } catch (error) {
80
- getOutput(job).genericError(error, url)
78
+ const { promise, resolve } = allocPromise()
79
+ page[$doneResolve] = resolve
80
+ page[$doneTimeout] = setTimeout(async () => {
81
+ if (job.browserCapabilities.screenshot) {
82
+ try {
83
+ await screenshot(job, url, 'done')
84
+ } catch (error) {
85
+ getOutput(job).genericError(error, url)
86
+ }
81
87
  }
82
- }
83
- page.end = new Date()
84
- if (report.__coverage__) {
85
- await collect(job, url, report.__coverage__)
86
- delete report.__coverage__
87
- }
88
- page.report = report
89
- stop(job, url)
88
+ page.end = new Date()
89
+ if (report.__coverage__) {
90
+ await collect(job, url, report.__coverage__)
91
+ delete report.__coverage__
92
+ }
93
+ page.report = report
94
+ stop(job, url)
95
+ resolve()
96
+ }, job.pageCloseTimeout)
97
+ return promise
90
98
  }
91
99
 
92
100
  module.exports = {
93
101
  get,
94
102
 
95
103
  async begin (job, urlWithHash, details) {
96
- getOutput(job).debug('qunit', 'begin', urlWithHash, details)
104
+ getOutput(job).debug('qunit/begin', 'begin', urlWithHash, details)
97
105
  const { isOpa, totalTests, modules } = details
98
106
  const url = stripUrlHash(urlWithHash)
99
107
  if (!job.qunitPages) {
@@ -112,13 +120,18 @@ module.exports = {
112
120
  },
113
121
 
114
122
  async testStart (job, urlWithHash, details) {
115
- getOutput(job).debug('qunit', 'testStart', urlWithHash, details)
116
- const { test } = get(job, urlWithHash, details)
123
+ getOutput(job).debug('qunit/testStart', 'testStart', urlWithHash, details)
124
+ const { page, test } = get(job, urlWithHash, details)
125
+ const { [$doneTimeout]: doneTimeout, [$doneResolve]: doneResolve } = page
126
+ if (doneTimeout) {
127
+ clearTimeout(doneTimeout)
128
+ doneResolve()
129
+ }
117
130
  test.start = new Date()
118
131
  },
119
132
 
120
133
  async log (job, urlWithHash, details) {
121
- getOutput(job).debug('qunit', 'log', urlWithHash, details)
134
+ getOutput(job).debug('qunit/log', 'log', urlWithHash, details)
122
135
  const { url, page, test } = get(job, urlWithHash, details)
123
136
  const { isOpa, modules, module, name, testId, ...log } = details
124
137
  if (!test) {
@@ -139,7 +152,7 @@ module.exports = {
139
152
  },
140
153
 
141
154
  async testDone (job, urlWithHash, details) {
142
- getOutput(job).debug('qunit', 'testDone', urlWithHash, details)
155
+ getOutput(job).debug('qunit/testDone', 'testDone', urlWithHash, details)
143
156
  const { name, module, testId, assertions, ...report } = details
144
157
  const { failed } = report
145
158
  const { url, page, test } = get(job, urlWithHash, { testId })
@@ -180,5 +193,8 @@ module.exports = {
180
193
  }
181
194
  },
182
195
 
183
- done
196
+ async done (job, urlWithHash, report) {
197
+ getOutput(job).debug('qunit/done', 'done', urlWithHash, report)
198
+ await done(job, urlWithHash, report)
199
+ }
184
200
  }