Browse Source

test: fix conditions for some tests (#23489) (#23607)

Alexey Kuzmin 4 years ago
parent
commit
6b8ca86459
2 changed files with 4 additions and 9 deletions
  1. 2 2
      spec-main/api-browser-window-spec.ts
  2. 2 7
      spec/webview-spec.js

+ 2 - 2
spec-main/api-browser-window-spec.ts

@@ -18,6 +18,7 @@ const { expect } = chai
 chai.use(chaiAsPromised)
 chai.use(dirtyChai)
 
+const features = process.electronBinding('features')
 const fixtures = path.resolve(__dirname, '..', 'spec', 'fixtures')
 
 // Is the display's scale factor possibly causing rounding of pixel coordinate
@@ -711,7 +712,7 @@ describe('BrowserWindow module', () => {
       })
     })
 
-    describe('BrowserWindow.moveAbove(mediaSourceId)', () => {
+    ifdescribe(features.isDesktopCapturerEnabled())('BrowserWindow.moveAbove(mediaSourceId)', () => {
       it('should throw an exception if wrong formatting', async () => {
         const fakeSourceIds = [
           'none', 'screen:0', 'window:fake', 'window:1234', 'foobar:1:2'
@@ -4000,7 +4001,6 @@ describe('BrowserWindow module', () => {
     })
   })
 
-  const features = process.electronBinding('features')
   const skip = features.isOffscreenRenderingEnabled() && 
     (process.platform !== 'linux' || process.arch !== 'ia32')
   ifdescribe(skip)('offscreen rendering', () => {

+ 2 - 7
spec/webview-spec.js

@@ -5,6 +5,7 @@ const http = require('http');
 const url = require('url');
 const { ipcRenderer } = require('electron');
 const { emittedOnce, waitForEvent } = require('./events-helpers');
+const { ifdescribe } = require('./spec-helpers');
 
 const { expect } = chai;
 chai.use(dirtyChai);
@@ -1076,13 +1077,7 @@ describe('<webview> tag', function () {
     });
   });
 
-  describe('<webview>.printToPDF()', () => {
-    before(function () {
-      if (!features.isPrintingEnabled()) {
-        this.skip();
-      }
-    });
-
+  ifdescribe(features.isPrintingEnabled())('<webview>.printToPDF()', () => {
     // TODO(deepak1556): Fix and enable after upgrade.
     it.skip('can print to PDF', async () => {
       const src = 'data:text/html,%3Ch1%3EHello%2C%20World!%3C%2Fh1%3E';