当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript spectron.Application类代码示例

本文整理汇总了TypeScript中spectron.Application的典型用法代码示例。如果您正苦于以下问题:TypeScript Application类的具体用法?TypeScript Application怎么用?TypeScript Application使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了Application类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: stopApplication

export function stopApplication(app: Application) {
    if (!app || !app.isRunning()) {
        return;
    }
    console.log("Stopping application");
    return app.stop();
}
开发者ID:MayGo,项目名称:backer-timetracker,代码行数:7,代码来源:utils.ts

示例2: startApplication

export function startApplication(app: Application) {
    if (!app || app.isRunning()) {
        return;
    }
    console.log("Starting application");
    return app.start();
}
开发者ID:MayGo,项目名称:backer-timetracker,代码行数:7,代码来源:utils.ts

示例3: beforeAll

 beforeAll(async () => {
   app = new Application({
     path: electronPath,
     args: [path.join(__dirname, '..', '..', 'app')],
   });
   return app.start();
 });
开发者ID:namgunghyeon,项目名称:s3_finder,代码行数:7,代码来源:e2e.spec.ts

示例4: before

 before(function() {
     let electronPath = path.join(__dirname, '..', '..', 'node_modules', '.bin', 'electron');
     if (process.platform === 'win32') {
         electronPath += '.cmd';
     }
     let appPath = path.join(__dirname, '..', '..', 'app', 'server', 'main.js');
     app = new Application({
         path: electronPath,
         args: [
             appPath,
             `--storagepath=${testHelpers.tempLocalStore}`
         ],
     });
     chaiAsPromised.transferPromiseness = app.transferPromiseness;
     return app.start();
 });
开发者ID:kpreeti096,项目名称:BotFramework-Emulator,代码行数:16,代码来源:performance.ts

示例5: beforeEach

 beforeEach(function() {
   let appPath = path.join(
     __dirname,
     '..',
     '..',
     '..',
     'node_modules',
     '.bin',
     'electron'
   )
   if (process.platform === 'win32') {
     appPath += '.cmd'
   }
   app = new Application({
     path: appPath,
     args: [path.join(__dirname, '..', '..', '..', 'out')],
   })
   return app.start()
 })
开发者ID:Aj-ajaam,项目名称:desktop,代码行数:19,代码来源:launch-test.ts

示例6: require

// A simple test to verify a visible window is opened with a title
import assert = require('assert');

let Application = require('spectron').Application;

let pathToApp = `./src/evetron/bin/${(process.platform === 'darwin'
    ? 'Electron.app/Contents/MacOS/'
    : '')}electron${(process.platform === 'win32'
        ? '.exe'
        : '')}`;

/*********** Node tests ***********/

const app = new Application({
    path: pathToApp,
});

console.log('application launch');

app.start().then(() => {
    // Check if the window is visible
    return app.browserWindow.isVisible();
}).then((isVisible: Boolean) => {
    // Verify the window is visible
    assert.equal(isVisible, true);
}).then(() => {
    // Get the window's title 
    return app.browserWindow.getTitle();
}).then((title: String) => {
    // Verify the window's title
开发者ID:JimiC,项目名称:evetron,代码行数:30,代码来源:main.ts

示例7: boot

export function boot(context: ITestCallbackContext, testConfig: Partial<FnTestConfig> = {}): Promise<spectron.Application> {

    context.retries(testConfig.retries || 0);
    context.timeout(testConfig.testTimeout || 30000);

    const skipFetch       = testConfig.skipFetch !== false;
    const skipUpdateCheck = testConfig.skipUpdateCheck !== false;

    const currentTestDir = getTestDir(context);

    if (testConfig.prepareTestData) {
        testConfig.prepareTestData.forEach((data) => {
            fs.outputFileSync([currentTestDir, data.name].join(path.sep), data.content);
        });
    }

    const profilesDirPath  = currentTestDir + "/profiles";
    const localProfilePath = profilesDirPath + "/local";

    testConfig.localRepository = Object.assign(new LocalRepository(), testConfig.localRepository || {});

    testConfig.localRepository.openTabs = testConfig.localRepository.openTabs.map((tab) => {
        if (tab.id.startsWith("test:")) {
            tab.id = tab.id.replace("test:", currentTestDir);
        }
        return tab;
    });


    fs.outputFileSync(localProfilePath, JSON.stringify(testConfig.localRepository));

    if (testConfig.platformRepositories) {
        for (const userID in testConfig.platformRepositories) {
            const profilePath = profilesDirPath + `/${userID}`;
            const profileData = Object.assign(new UserRepository(), testConfig.platformRepositories[userID] || {});

            fs.outputFileSync(profilePath, JSON.stringify(profileData));
        }
    }

    const moduleOverrides = testConfig.overrideModules && JSON.stringify(testConfig.overrideModules, (key, val) => {
        if (typeof val === "function") {
            return val.toString();
        }
        return val;
    });


    const chromiumArgs = [
        isDevServer() && "./electron",
        "--spectron",
        skipFetch && "--no-fetch-on-start",
        skipUpdateCheck && "--no-update-check",
        "--user-data-dir=" + currentTestDir,
        moduleOverrides && `--override-modules=${moduleOverrides}`
    ].filter(v => v);

    const appCreation = new spectron.Application({
        path: findAppBinary(),
        args: chromiumArgs
    });

    return appCreation.start().then((app: any) => {
        Object.assign(app, {testdir: currentTestDir});

        if (testConfig.waitForMainWindow === false) {
            return app;
        }

        return app.client.waitForVisible("ct-layout").then(() => app);

    });
}
开发者ID:hmenager,项目名称:composer,代码行数:73,代码来源:util.ts

示例8:

}).then(() => {
    console.log('application exit');
    // Stop the application
    return app.stop();
});
开发者ID:JimiC,项目名称:evetron,代码行数:5,代码来源:main.ts


注:本文中的spectron.Application类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。