-
-
Notifications
You must be signed in to change notification settings - Fork 30
Conversation
lib/mjpeg.js
Outdated
|
||
// use the deferred pattern so we can wait for the start of the stream | ||
// based on what comes in from an external pipe | ||
let startPromise = new B((res, rej) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const
lib/mjpeg.js
Outdated
* Start reading the MJpeg stream and storing the last image | ||
*/ | ||
async start (serverTimeout = MJPEG_SERVER_TIMEOUT_MS) { | ||
this.consumer = new MJpegConsumer(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we call stop
here first ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
doesn't hurt to be safe
* it closes the connection | ||
* @returns {http.Server} | ||
*/ | ||
function initMJpegServer (port, intMs = 300, times = 20) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd rather put this helper method into tests
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it will be used by the drivers though, so it needs to be exported from appium-support
test/mjpeg-specs.js
Outdated
it('should error out if the server does not send any images before a timeout', async function () { | ||
let stream = new MJpegStream(MJPEG_SERVER_URL, _.noop); | ||
await stream.start(0).should.eventually.be.rejectedWith(/never sent/); | ||
stream.stop(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
stop
might not always be called if a test fails.
@mykola-mokhnach added png translation support |
lib/mjpeg.js
Outdated
null; | ||
} | ||
|
||
async lastChunkPNG () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
a docstring might be useful
@imurchie any thoughts or comments on this before i merge? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
One concern. Otherwise looks good.
lib/mjpeg.js
Outdated
import { Writable } from 'stream'; | ||
import { fs } from 'appium-support'; | ||
|
||
const IMAGE_PATH = path.resolve(__dirname, '..', '..', 'test', 'images', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
test/
is currently not included in the npm release, so this won't exist (fine for declaration, since path.resolve
doesn't do anything to the contents, but not for the usage later).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah yes, good point. i'll find somewhere else for it to go.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you could encode the simplest one-pixel-like image into base64-string and put it directly there
ok @mykola-mokhnach @imurchie changes made, what do you think now? |
published as 2.18.0 |
the new version of appium/appium-base-driver#230