Skip to content

Commit

Permalink
(@wdio/cli): improve bootstrap ElectronJS project (#11523)
Browse files Browse the repository at this point in the history
* Revert "(@wdio/protocols): revert command name change"

This reverts commit daeb031.

* (@wdio/cli): improve bootstrap ElectronJS project
  • Loading branch information
christian-bromann authored Oct 25, 2023
1 parent 963b578 commit 496f30a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 7 deletions.
9 changes: 9 additions & 0 deletions packages/wdio-cli/src/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,15 @@ export const QUESTIONNAIRE = [{
if (isBrowserRunner(answers)) {
return SUPPORTED_PACKAGES.framework.slice(0, 1)
}
/**
* Serenity tests don't come with proper ElectronJS example files
*/
if (getTestingPurpose(answers) === 'electron') {
return SUPPORTED_PACKAGES.framework.filter(
({ value }) => !value.startsWith('@serenity-js')
)
}

return SUPPORTED_PACKAGES.framework
}
}, {
Expand Down
6 changes: 2 additions & 4 deletions packages/wdio-cli/src/templates/snippets/electronTest.js.ejs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
import { browser } from '@wdio/globals'

describe('Electron Testing', () => {
it('should print application metadata', async () => {
const appName = await browser.electron.app('getName')
const appVersion = await browser.electron.app('getVersion')
console.log('Testing Electron app:', appName, appVersion)
it('should print application title', async () => {
console.log('Hello', await browser.getTitle(), 'application!')
})
})
6 changes: 5 additions & 1 deletion packages/wdio-cli/src/templates/wdio.conf.tpl.ejs
Original file line number Diff line number Diff line change
@@ -1,10 +1,14 @@
<%
if (answers.isUsingTypeScript && answers.purpose === 'electron') {
%>/// <reference types="wdio-electron-service" />
<% }
if (answers.isUsingTypeScript && !answers.serenityAdapter) {
%>import type { Options } from '@wdio/types'
<% }
if (answers.isUsingTypeScript && answers.serenityAdapter) {
%>import type { WebdriverIOConfig } from '@serenity-js/webdriverio'
%>import type { WebdriverIOConfig } from '@serenity-js/webdriverio'
<% }
if (answers.isUsingTypeScript) {
Expand Down
4 changes: 2 additions & 2 deletions packages/wdio-protocols/src/protocols/appium.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1564,7 +1564,7 @@ export default {
},
'/session/:sessionId/appium/execute_driver': {
POST: {
command: 'driverScript',
command: 'executeDriverScript',
description:
'This command enables you to specify a WebdriverIO script as a string and transmit it to the Appium server for local execution on the server itself. This approach helps minimize potential latency associated with each command. ***To utilize this command with Appium 2.0, you must have the [`execute-driver-plugin`](https://github.com/appium/appium/tree/master/packages/execute-driver-plugin) plugin installed.***',
ref: 'https://github.com/appium/appium/blob/master/docs/en/commands/session/execute-driver.md',
Expand All @@ -1573,7 +1573,7 @@ export default {
name: 'script',
type: 'string',
description:
"The script to execute. It has access to a 'driver' object which represents a webdriverio session attached to the current server.",
"The script to execute. It has access to a 'driver' object which represents a WebdriverIO session attached to the current server.",
required: true,
},
{
Expand Down

0 comments on commit 496f30a

Please sign in to comment.