Socket
Socket
Sign inDemoInstall

spectron

Package Overview
Dependencies
Maintainers
3
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

spectron - npm Package Compare versions

Comparing version 18.0.0 to 19.0.0

6

package.json
{
"name": "spectron",
"version": "18.0.0",
"version": "19.0.0",
"description": "Easily test your Electron apps using ChromeDriver and WebdriverIO.",

@@ -31,3 +31,3 @@ "main": "index.js",

"dev-null": "^0.1.1",
"electron-chromedriver": "16.0.0",
"electron-chromedriver": "17.0.0",
"got": "^11.8.0",

@@ -44,3 +44,3 @@ "split": "^1.0.1",

"check-for-leaks": "^1.2.1",
"electron": "^16.0.8",
"electron": "^17.0.0",
"eslint": "^7.14.0",

@@ -47,0 +47,0 @@ "eslint-config-standard": "^16.0.2",

@@ -6,3 +6,3 @@ # <img src="https://cloud.githubusercontent.com/assets/378023/15063284/cf544f2c-1383-11e6-9336-e13bd64b1694.png" width="60px" align="center" alt="Spectron icon"> Spectron

### 🚨 On February 1, 2022, Spectron will be officially deprecated by the Electron team. Please read about more about [our planned deprecation here](https://github.com/electron-userland/spectron/issues/1045).
### 🚨 Spectron is officially deprecated as of February 1, 2022.

@@ -43,2 +43,3 @@ Easily test your [Electron](http://electron.atom.io) apps using

| `^16.0.0` | `^18.0.0`|
| `^17.0.0` | `^19.0.0`|

@@ -75,3 +76,3 @@ Learn more from [this presentation](https://speakerdeck.com/kevinsawicki/testing-your-electron-apps-with-chromedriver).

```js
const Application = require('spectron').Application
const { Application } = require('spectron')
const assert = require('assert')

@@ -84,3 +85,3 @@ const electronPath = require('electron') // Require Electron from the binaries included in node_modules.

beforeEach(function () {
beforeEach(async function () {
this.app = new Application({

@@ -107,17 +108,16 @@ // Your electron path can be any binary

})
return this.app.start()
await this.app.start()
})
afterEach(function () {
afterEach(async function () {
if (this.app && this.app.isRunning()) {
return this.app.stop()
await this.app.stop()
}
})
it('shows an initial window', function () {
return this.app.client.getWindowCount().then(function (count) {
assert.equal(count, 1)
// Please note that getWindowCount() will return 2 if `dev tools` are opened.
// assert.equal(count, 2)
})
it('shows an initial window', async function () {
const count = await this.app.client.getWindowCount()
assert.equal(count, 1)
// Please note that getWindowCount() will return 2 if `dev tools` are opened.
// assert.equal(count, 2)
})

@@ -241,7 +241,5 @@ })

```js
app.client.$('#error-alert').then(function (element) {
element.getText().then(function (errorText) {
console.log('The #error-alert text content is ' + errorText)
})
})
const element = await app.client.$('#error-alert')
const errorText = await element.getText()
console.log('The #error-alert text content is ' + errorText)
```

@@ -277,5 +275,4 @@

```js
app.browserWindow.isVisible().then(function (visible) {
console.log('window is visible? ' + visible)
})
const visible = await app.browserWindow.isVisible()
console.log('window is visible? ' + visible)
```

@@ -293,5 +290,4 @@

```js
app.browserWindow.capturePage().then(function (imageBuffer) {
fs.writeFile('page.png', imageBuffer)
})
const imageBuffer = await app.browserWindow.capturePage()
fs.writeFile('page.png', imageBuffer)
```

@@ -322,8 +318,8 @@

```js
app.webContents.savePage('/Users/kevin/page.html', 'HTMLComplete')
.then(function () {
console.log('page saved')
}).catch(function (error) {
console.error('saving page failed', error.message)
})
try {
await app.webContents.savePage('/Users/kevin/page.html', 'HTMLComplete')
console.log('page saved')
catch (error) {
console.error('saving page failed', error.message)
}
```

@@ -337,6 +333,4 @@

```js
app.webContents.executeJavaScript('1 + 2')
.then(function (result) {
console.log(result) // prints 3
})
const result = await app.webContents.executeJavaScript('1 + 2')
console.log(result) // prints 3
```

@@ -355,5 +349,4 @@

```js
app.mainProcess.argv().then(function (argv) {
console.log('main process args: ' + argv)
})
const argv = await app.mainProcess.argv()
console.log('main process args: ' + argv)
```

@@ -376,5 +369,4 @@

```js
app.rendererProcess.env().then(function (env) {
console.log('renderer process env variables: ' + env)
})
const env = await app.rendererProcess.env()
console.log('renderer process env variables: ' + env)
```

@@ -421,6 +413,5 @@

```js
app.client.getMainProcessLogs().then(function (logs) {
logs.forEach(function (log) {
console.log(log)
})
const logs = await app.client.getMainProcessLogs()
logs.forEach(function (log) {
console.log(log)
})

@@ -437,8 +428,7 @@ ```

```js
app.client.getRenderProcessLogs().then(function (logs) {
logs.forEach(function (log) {
console.log(log.message)
console.log(log.source)
console.log(log.level)
})
const logs = await app.client.getRenderProcessLogs()
logs.forEach(function (log) {
console.log(log.message)
console.log(log.source)
console.log(log.level)
})

@@ -452,5 +442,4 @@ ```

```js
app.client.getSelectedText().then(function (selectedText) {
console.log(selectedText)
})
const selectedText = await app.client.getSelectedText()
console.log(selectedText)
```

@@ -464,5 +453,4 @@

```js
app.client.getWindowCount().then(function (count) {
console.log(count)
})
const count = await app.client.getWindowCount()
console.log(count)
```

@@ -539,7 +527,6 @@

```js
app.client.auditAccessibility().then(function (audit) {
if (audit.failed) {
console.error(audit.message)
}
})
const audit = await app.client.auditAccessibility()
if (audit.failed) {
console.error(audit.message)
}
```

@@ -555,20 +542,16 @@

// Focus main page and audit it
app.client.windowByIndex(0).then(function() {
app.client.auditAccessibility().then(function (audit) {
if (audit.failed) {
console.error('Main page failed audit')
console.error(audit.message)
}
await app.client.windowByIndex(0)
const audit = await app.client.auditAccessibility()
if (audit.failed) {
console.error('Main page failed audit')
console.error(audit.message)
}
//Focus <webview> tag and audit it
app.client.windowByIndex(1).then(function() {
app.client.auditAccessibility().then(function (audit) {
if (audit.failed) {
console.error('<webview> page failed audit')
console.error(audit.message)
}
})
})
})
})
//Focus <webview> tag and audit it
await app.client.windowByIndex(1)
const audit = await app.client.auditAccessibility()
if (audit.failed) {
console.error('<webview> page failed audit')
console.error(audit.message)
}
```

@@ -575,0 +558,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc