mirror of
https://github.com/lensapp/lens.git
synced 2025-05-20 05:10:56 +00:00
integration tests via spectron
Signed-off-by: Jari Kolehmainen <jari.kolehmainen@gmail.com>
This commit is contained in:
1 parent
5af12bdbbd
commit
cff4365b35
8 files changed
+473
-28
No files matched your search
@@ -0,0 +1,35 @@
|
||||
import { Application } from "spectron";
|
||||
import * as path from "path"
|
||||
|
||||
let appPath = ""
|
||||
switch(process.platform) {
|
||||
case "win32": {
|
||||
appPath = path.join("./dist/win-unpacked/Lens.exe")
|
||||
}
|
||||
case "linux": {
|
||||
appPath = path.join("./dist/linux-unpacked/kontena-lens")
|
||||
}
|
||||
case "darwin": {
|
||||
appPath = path.join("./dist/mac/LensDev.app/Contents/MacOS/LensDev")
|
||||
}
|
||||
}
|
||||
|
||||
export function setup() {
|
||||
return new Application({
|
||||
// path to electron app
|
||||
args: [],
|
||||
path: appPath,
|
||||
startTimeout: 30000,
|
||||
waitTimeout: 30000,
|
||||
})
|
||||
}
|
||||
|
||||
export async function tearDown(app: Application) {
|
||||
const pid = app.mainProcess.pid
|
||||
await app.stop()
|
||||
try {
|
||||
process.kill(pid, 0);
|
||||
} catch(e) {
|
||||
return
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
import { Application } from "spectron"
|
||||
import * as util from "../helpers/utils"
|
||||
|
||||
describe("app start", () => {
|
||||
let app: Application
|
||||
beforeEach(() => {
|
||||
app = util.setup()
|
||||
return app.start()
|
||||
}, 20000)
|
||||
|
||||
it('starts with whats new flow', async () => {
|
||||
await app.client.windowByIndex(1)
|
||||
await app.client.waitUntilWindowLoaded()
|
||||
await app.client.waitUntilTextExists("h1", "What's new")
|
||||
await app.client.click("button.btn-primary")
|
||||
await app.client.waitUntilTextExists("h1", "Welcome")
|
||||
})
|
||||
|
||||
afterEach(async () => {
|
||||
if (app && app.isRunning()) {
|
||||
return util.tearDown(app)
|
||||
}
|
||||
})
|
||||
})
|
||||
Reference in new issue
Block a user