當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。