https://github.com/testingbot/testingbot-electron-demo-app
TestingBot Electron Demo App
https://github.com/testingbot/testingbot-electron-demo-app
demo-app electron electron-app electron-demo testingbot
Last synced: about 2 months ago
JSON representation
TestingBot Electron Demo App
- Host: GitHub
- URL: https://github.com/testingbot/testingbot-electron-demo-app
- Owner: testingbot
- License: mit
- Created: 2024-08-19T12:32:59.000Z (10 months ago)
- Default Branch: main
- Last Pushed: 2024-08-23T13:13:53.000Z (9 months ago)
- Last Synced: 2025-02-12T05:44:34.058Z (4 months ago)
- Topics: demo-app, electron, electron-app, electron-demo, testingbot
- Language: JavaScript
- Homepage: https://testingbot.com/support/
- Size: 652 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# testingbot-electron-demo-app
This repository contains a simple calculator app, built by TestingBot to demonstrate automated testing against Electron-based apps.

## NodeJS Example
Below is an example on how to run this demo Electron app on TestingBot's remote machines:
```javascript
const { Builder, By } = require('selenium-webdriver');
const { Options } = require('selenium-webdriver/chrome');(async function example() {
let driver;try {
// Set capabilities
let caps = {
browserName: 'electron',
platformName: 'VENTURA',
browserVersion: '31',
'tb:binary_location': 'testingbot-electron-demo-app.app/Contents/MacOS/testingbot-electron-demo-app',
'tb:app': 'https://github.com/testingbot/testingbot-electron-demo-app/releases/download/v1.0.0/testingbot-electron-demo-app-darwin-arm64-1.0.0.zip'
};driver = await new Builder()
.usingServer('https://key:[email protected]/wd/hub')
.withCapabilities(caps)
.build();// Generate two random numbers between 0 and 9
const num1 = Math.floor(Math.random() * 10);
const num2 = Math.floor(Math.random() * 10);const firstNumber = await driver.findElement(By.id(`btn-${num1}`));
const secondNumber = await driver.findElement(By.id(`btn-${num2}`));
const plus = await driver.findElement(By.id('btn-plus'));
const equal = await driver.findElement(By.id('btn-equal'));// Perform operations
await firstNumber.click();
await plus.click();
await secondNumber.click();
await equal.click();// Get the result
const resultElement = await driver.findElement(By.id('calc-display'));
const resultText = await resultElement.getText();// Verify the result
if ((num1 + num2) !== parseInt(resultText)) {
throw new Error('Test failed');
}} catch (error) {
console.error('Error during test execution:', error);
} finally {
if (driver) {
await driver.quit();
}
}
})();
```## More information
More information is available on [TestingBot's Electron Documentation](https://testingbot.com/support/electron).