mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-12-25 07:33:23 +03:00
Run main process tests on Linux
This commit is contained in:
parent
ccd381b8ad
commit
6841babc4a
@ -4,10 +4,13 @@ git:
|
||||
matrix:
|
||||
include:
|
||||
- os: linux
|
||||
env: NODE_VERSION=4.4.7 CC=clang CXX=clang++ npm_config_clang=1
|
||||
env: NODE_VERSION=4.4.7 DISPLAY=:99.0 CC=clang CXX=clang++ npm_config_clang=1
|
||||
|
||||
sudo: false
|
||||
|
||||
before_install:
|
||||
- "/sbin/start-stop-daemon --start --quiet --pidfile /tmp/custom_xvfb_99.pid --make-pidfile --background --exec /usr/bin/Xvfb -- :99 -ac -screen 0 1280x1024x16"
|
||||
|
||||
install:
|
||||
- git clone https://github.com/creationix/nvm.git /tmp/.nvm
|
||||
- source /tmp/.nvm/nvm.sh
|
||||
@ -16,7 +19,7 @@ install:
|
||||
- npm install -g npm
|
||||
- script/build --create-debian-package --create-rpm-package --compress-artifacts
|
||||
|
||||
script: true
|
||||
script: script/test
|
||||
|
||||
cache:
|
||||
directories:
|
||||
|
22
script/test
22
script/test
@ -3,17 +3,26 @@
|
||||
'use strict'
|
||||
|
||||
require('colors')
|
||||
const assert = require('assert')
|
||||
const async = require('async')
|
||||
const childProcess = require('child_process')
|
||||
const fs = require('fs')
|
||||
const glob = require('glob')
|
||||
const path = require('path')
|
||||
|
||||
const CONFIG = require('./config')
|
||||
|
||||
const appName = CONFIG.channel === 'beta' ? 'Atom Beta' : 'Atom'
|
||||
const packagedAppPath = path.resolve(__dirname, '..', 'out', `${appName}.app`)
|
||||
const executablePath = path.join(packagedAppPath, 'Contents', 'MacOS', appName)
|
||||
const resourcePath = CONFIG.repositoryRootPath
|
||||
let executablePath
|
||||
if (process.platform === 'darwin') {
|
||||
const executablePaths = glob.sync(path.join(CONFIG.buildOutputPath, '*.app'))
|
||||
assert(executablePaths.length === 1, `More than one application to run tests against was found. ${executablePaths.join(',')}`)
|
||||
executablePath = path.join(executablePaths[0], 'Contents', 'MacOS', path.basename(executablePaths[0], '.app'))
|
||||
} else if (process.platform === 'linux') {
|
||||
const executablePaths = glob.sync(path.join(CONFIG.buildOutputPath, '**', 'atom'))
|
||||
assert(executablePaths.length === 1, `More than one application to run tests against was found. ${executablePaths.join(',')}`)
|
||||
executablePath = executablePaths[0]
|
||||
}
|
||||
|
||||
function runCoreMainProcessTests (callback) {
|
||||
const testPath = path.join(CONFIG.repositoryRootPath, 'spec', 'main-process')
|
||||
@ -68,7 +77,12 @@ for (let packageName in CONFIG.appMetadata.packageDependencies) {
|
||||
})
|
||||
}
|
||||
|
||||
const testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites)
|
||||
let testSuitesToRun
|
||||
if (process.platform === 'darwin') {
|
||||
testSuitesToRun = [runCoreMainProcessTests, runCoreRenderProcessTests].concat(packageTestSuites)
|
||||
} else {
|
||||
testSuitesToRun = [runCoreMainProcessTests]
|
||||
}
|
||||
|
||||
async.series(testSuitesToRun, function (err, exitCodes) {
|
||||
if (err) {
|
||||
|
@ -17,7 +17,6 @@ describe('AtomApplication', function () {
|
||||
let originalPlatform, originalAppQuit, originalAtomHome, atomApplicationsToDestroy
|
||||
|
||||
beforeEach(function () {
|
||||
originalPlatform = Object.getOwnPropertyDescriptor(process, 'platform')
|
||||
originalAppQuit = electron.app.quit
|
||||
mockElectronAppQuit()
|
||||
originalAtomHome = process.env.ATOM_HOME
|
||||
@ -34,13 +33,12 @@ describe('AtomApplication', function () {
|
||||
})
|
||||
|
||||
afterEach(async function () {
|
||||
Object.defineProperty(process, 'platform', originalPlatform)
|
||||
electron.app.quit = originalAppQuit
|
||||
process.env.ATOM_HOME = originalAtomHome
|
||||
for (let atomApplication of atomApplicationsToDestroy) {
|
||||
await atomApplication.destroy()
|
||||
}
|
||||
await clearElectronSession()
|
||||
electron.app.quit = originalAppQuit
|
||||
})
|
||||
|
||||
describe('launch', function () {
|
||||
@ -95,22 +93,24 @@ describe('AtomApplication', function () {
|
||||
assert.equal(openedPath, filePath)
|
||||
})
|
||||
|
||||
it('positions new windows at an offset distance from the previous window', async function () {
|
||||
const atomApplication = buildAtomApplication()
|
||||
if (process.platform === 'darwin' || process.platform === 'win32') {
|
||||
it('positions new windows at an offset distance from the previous window', async function () {
|
||||
const atomApplication = buildAtomApplication()
|
||||
|
||||
const window1 = atomApplication.launch(parseCommandLine([makeTempDir()]))
|
||||
await focusWindow(window1)
|
||||
window1.browserWindow.setBounds({width: 400, height: 400, x: 0, y: 0})
|
||||
const window1 = atomApplication.launch(parseCommandLine([makeTempDir()]))
|
||||
await focusWindow(window1)
|
||||
window1.browserWindow.setBounds({width: 400, height: 400, x: 0, y: 0})
|
||||
|
||||
const window2 = atomApplication.launch(parseCommandLine([makeTempDir()]))
|
||||
await focusWindow(window2)
|
||||
const window2 = atomApplication.launch(parseCommandLine([makeTempDir()]))
|
||||
await focusWindow(window2)
|
||||
|
||||
assert.notEqual(window1, window2)
|
||||
window1Dimensions = window1.getDimensions()
|
||||
window2Dimensions = window2.getDimensions()
|
||||
assert.isAbove(window2Dimensions.x, window1Dimensions.x)
|
||||
assert.isAbove(window2Dimensions.y, window1Dimensions.y)
|
||||
})
|
||||
assert.notEqual(window1, window2)
|
||||
const window1Dimensions = window1.getDimensions()
|
||||
const window2Dimensions = window2.getDimensions()
|
||||
assert.isAbove(window2Dimensions.x, window1Dimensions.x)
|
||||
assert.isAbove(window2Dimensions.y, window1Dimensions.y)
|
||||
})
|
||||
}
|
||||
|
||||
it('reuses existing windows when opening paths, but not directories', async function () {
|
||||
const dirAPath = makeTempDir("a")
|
||||
|
Loading…
Reference in New Issue
Block a user