From a4001fbc550239722240e17a67cd95e334912ad5 Mon Sep 17 00:00:00 2001 From: Kevin Sawicki Date: Thu, 14 Jul 2016 09:37:09 -0700 Subject: [PATCH] Sort contents by id for consistent ordering --- spec/api-web-contents-spec.js | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/spec/api-web-contents-spec.js b/spec/api-web-contents-spec.js index 00193372320f..a9519de131aa 100644 --- a/spec/api-web-contents-spec.js +++ b/spec/api-web-contents-spec.js @@ -36,12 +36,15 @@ describe('webContents module', function () { describe('getAllWebContents() API', function () { it('returns an array of web contents', function (done) { w.webContents.on('devtools-opened', function () { - assert.equal(webContents.getAllWebContents().length, 4) + const all = webContents.getAllWebContents().sort(function (a, b) { + return a.getId() - b.getId() + }) - assert.equal(webContents.getAllWebContents()[0].getType(), 'remote') - assert.equal(webContents.getAllWebContents()[1].getType(), 'webview') - assert.equal(webContents.getAllWebContents()[2].getType(), 'window') - assert.equal(webContents.getAllWebContents()[3].getType(), 'window') + assert.equal(all.length, 4) + assert.equal(all[0].getType(), 'window') + assert.equal(all[1].getType(), 'window') + assert.equal(all[2].getType(), 'remote') + assert.equal(all[3].getType(), 'webview') done() })