Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

spectron.d.ts 9.7KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320
  1. // Type definitions for spectron v3.6.0
  2. // Project: https://github.com/electron/spectron
  3. // Definitions by: deerares <https://github.com/deerares>
  4. /// <reference types="node" />
  5. declare module 'spectron' {
  6. import * as Electron from 'electron';
  7. import * as WebdriverIO from 'webdriverio';
  8. interface AccessibilityAuditOptions {
  9. /**
  10. * true to ignore failures with a severity of 'Warning' and only
  11. * include failures with a severity of 'Severe'. Defaults to false.
  12. */
  13. ignoreWarnings?: boolean;
  14. /**
  15. * Rule code values such as AX_COLOR_01 to ignore failures for.
  16. */
  17. ignoreRules?: string[];
  18. }
  19. interface AccessibilityAuditResult {
  20. /**
  21. * False when the audit has failures
  22. */
  23. failed: boolean;
  24. /**
  25. * A detailed message about the results
  26. */
  27. message: string;
  28. /**
  29. * An array of detail objects for each failed rule
  30. */
  31. results: {
  32. /**
  33. * A unique accessibility rule identifier
  34. */
  35. code: string;
  36. /**
  37. * Selector path of each HTML element that failed the rule
  38. */
  39. elements: string[];
  40. /**
  41. * A String message about the failed rule
  42. */
  43. message: string;
  44. /**
  45. * 'Warning' or 'Severe'
  46. */
  47. severity: 'Warning' | 'Severe';
  48. /**
  49. * URL providing more details about the failed rule
  50. */
  51. url: string;
  52. }[];
  53. }
  54. export interface SpectronClient extends WebdriverIO.BrowserObject {
  55. /**
  56. * Focus a window using its title or URL.
  57. * <webview> tags can also be focused as a separate window.
  58. */
  59. switchWindow(urlOrTitleToMatch: string): Promise<void>;
  60. /**
  61. * Wait until the window is no longer loading.
  62. * Takes an optional timeout in milliseconds that defaults to 5000.
  63. */
  64. waitUntilWindowLoaded(timeout?: number): Promise<void>;
  65. /**
  66. * Wait until the element matching the given selector contains the given text.
  67. * Takes an optional timeout in milliseconds that defaults to 5000.
  68. */
  69. waitUntilTextExists(
  70. selector: string,
  71. text: string,
  72. timeout?: number
  73. ): Promise<void>;
  74. /**
  75. * Gets the number of open windows. <webview> tags are also counted as separate windows.
  76. */
  77. getWindowCount(): Promise<number>;
  78. /**
  79. * Focus a window using its index from the windowHandles() array.
  80. * <webview> tags can also be focused as a separate window.
  81. */
  82. windowByIndex(index: number): Promise<void>;
  83. /**
  84. * Get the selected text in the current window.
  85. */
  86. getSelectedText(): Promise<string>;
  87. /**
  88. * Gets the console log output from the render process.
  89. * The logs are cleared after they are returned.
  90. */
  91. getRenderProcessLogs(): Promise<object[]>;
  92. /**
  93. * Gets the console log output from the main process.
  94. * The logs are cleared after they are returned.
  95. */
  96. getMainProcessLogs(): Promise<string[]>;
  97. /**
  98. * Run an accessibility audit in the focused window with the specified options.
  99. */
  100. auditAccessibility(
  101. options?: AccessibilityAuditOptions
  102. ): Promise<AccessibilityAuditResult>;
  103. }
  104. export interface SpectronWindow extends Electron.BrowserWindow {
  105. capturePage(): Promise<Electron.NativeImage>;
  106. }
  107. export interface SpectronWebContents extends Electron.WebContents {
  108. savePage(
  109. fullPath: string,
  110. saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML',
  111. callback?: (eror: Error) => void
  112. ): boolean;
  113. savePage(
  114. fullPath: string,
  115. saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'
  116. ): Promise<void>;
  117. savePage(
  118. fullPath: string,
  119. saveType: 'HTMLOnly' | 'HTMLComplete' | 'MHTML'
  120. ): any;
  121. executeJavaScript(code: string, userGesture?: boolean): Promise<any>;
  122. }
  123. type BasicAppSettings = {
  124. /**
  125. * String host name of the launched chromedriver process. Defaults to 'localhost'.
  126. */
  127. host?: string;
  128. /**
  129. * Number port of the launched chromedriver process. Defaults to 9515.
  130. */
  131. port?: number;
  132. /**
  133. * Number in milliseconds to wait for application quitting.
  134. * Defaults to 1000 milliseconds.
  135. */
  136. quitTimeout?: number;
  137. /**
  138. * Number in milliseconds to wait for ChromeDriver to start.
  139. * Defaults to 5000 milliseconds.
  140. */
  141. startTimeout?: number;
  142. /**
  143. * Number in milliseconds to wait for calls like waitUntilTextExists and
  144. * waitUntilWindowLoaded to complete.
  145. * Defaults to 5000 milliseconds.
  146. */
  147. waitTimeout?: number;
  148. /**
  149. * Number of retry attempts to make when connecting to ChromeDriver.
  150. * Defaults to 10 attempts.
  151. */
  152. connectionRetryCount?: number;
  153. /**
  154. * Number in milliseconds to wait for connections to ChromeDriver to be made.
  155. * Defaults to 30000 milliseconds.
  156. */
  157. connectionRetryTimeout?: number;
  158. /**
  159. * String path to a node executable to launch ChromeDriver with.
  160. * Defaults to process.execPath.
  161. */
  162. nodePath?: string;
  163. /** String path to the Electron application executable to launch.
  164. * Note: If you want to invoke electron directly with your app's main script then you should
  165. * specify path as electron via electron-prebuilt and specify your app's main script path as
  166. * the first argument in the args array.
  167. */
  168. path: string;
  169. /**
  170. * Array of arguments to pass to the Electron application.
  171. */
  172. args?: string[];
  173. /**
  174. * Array of arguments to pass to ChromeDriver.
  175. * See here (https://sites.google.com/a/chromium.org/chromedriver/capabilities) for details
  176. * on the Chrome arguments.
  177. */
  178. chromeDriverArgs?: string[];
  179. /**
  180. * Object of additional environment variables to set in the launched application.
  181. */
  182. env?: object;
  183. /**
  184. * String address of a Chrome debugger server to connect to.
  185. */
  186. debuggerAddress?: string;
  187. /**
  188. * String path to file to store ChromeDriver logs in.
  189. * Setting this option enables --verbose logging when starting ChromeDriver.
  190. */
  191. chromeDriverLogPath?: string;
  192. /**
  193. * String path to a directory where Webdriver will write logs to.
  194. * Setting this option enables verbose logging from Webdriver.
  195. */
  196. webdriverLogPath?: string;
  197. /**
  198. * Extra Webdriver options
  199. */
  200. webdriverOptions?: object;
  201. /**
  202. * Custom property name to use when requiring modules.
  203. * Defaults to require.
  204. * This should only be used if your application deletes the main window.require function
  205. * and assigns it to another property name on window.
  206. */
  207. requireName?: string;
  208. };
  209. type AppConstructorOptions = BasicAppSettings & {
  210. /**
  211. * String path to the working directory to use for the launched application.
  212. * Defaults to process.cwd().
  213. */
  214. cwd?: string;
  215. };
  216. export type ApplicationSettings = BasicAppSettings & {
  217. /**
  218. * String path to the working directory to use for the launched application.
  219. * Defaults to process.cwd().
  220. */
  221. workingDirectory?: string;
  222. };
  223. /**
  224. * Start and stop your Electron application.
  225. */
  226. export class Application {
  227. /**
  228. * Spectron uses WebdriverIO and exposes the managed client property on the created
  229. * Application instances.
  230. * The full client API provided by WebdriverIO can be found here
  231. * http://webdriver.io/api.html
  232. * Several additional commands are provided specific to Electron.
  233. */
  234. client: SpectronClient;
  235. /**
  236. * The electron property is your gateway to accessing the full Electron API.
  237. * Each Electron module is exposed as a property on the electron property so you can
  238. * think of it as an alias for require('electron') from within your app.
  239. */
  240. electron: Electron.RemoteMainInterface;
  241. /**
  242. * The browserWindow property is an alias for require('electron').remote.getCurrentWindow().
  243. * It provides you access to the current BrowserWindow and contains all the APIs.
  244. * https://electron.atom.io/docs/api/browser-window/
  245. */
  246. browserWindow: SpectronWindow;
  247. /**
  248. * The webContents property is an alias for
  249. * require('electron').remote.getCurrentWebContents().
  250. * It provides you access to the WebContents for the current window
  251. * and contains all the APIs.
  252. * https://electron.atom.io/docs/api/web-contents/
  253. */
  254. webContents: SpectronWebContents;
  255. /**
  256. * The mainProcess property is an alias for require('electron').remote.process.
  257. * It provides you access to the main process's process global.
  258. * https://nodejs.org/api/process.html
  259. */
  260. mainProcess: NodeJS.Process;
  261. /**
  262. *The rendererProcess property is an alias for global.process.
  263. * It provides you access to the main process's process global.
  264. * https://nodejs.org/api/process.html
  265. */
  266. rendererProcess: NodeJS.Process;
  267. constructor(options: AppConstructorOptions);
  268. /**
  269. * Starts the application.
  270. * Returns a Promise that will be resolved when the application is ready to use.
  271. * You should always wait for start to complete before running any commands.
  272. */
  273. start(): Promise<Application>;
  274. /**
  275. * Stops the application.
  276. * Returns a Promise that will be resolved once the application has stopped.
  277. */
  278. stop(): Promise<Application>;
  279. /**
  280. * Stops the application and then starts it.
  281. * Returns a Promise that will be resolved once the application has started again.
  282. */
  283. restart(): Promise<Application>;
  284. /**
  285. * Checks to determine if the application is running or not.
  286. */
  287. isRunning(): boolean;
  288. /**
  289. * Get all the configured options passed to the new Application() constructor.
  290. * This will include the default options values currently being used.
  291. */
  292. getSettings(): ApplicationSettings;
  293. }
  294. }