1
0
mirror of https://github.com/lensapp/lens.git synced 2025-05-20 05:10:56 +00:00

attempt to fix test

Signed-off-by: Jim Ehrismann <jehrismann@mirantis.com>
This commit is contained in:
Jim Ehrismann 2020-09-25 17:19:13 -04:00
parent 8114bd9752
commit 254a45c45b

View File

@ -19,7 +19,7 @@ describe("Lens integration tests", () => {
const BACKSPACE = "\uE003" const BACKSPACE = "\uE003"
let app: Application let app: Application
const awaitAppStart = async () => { const appStart = async () => {
app = util.setup() app = util.setup()
await app.start() await app.start()
// Wait for splash screen to be closed // Wait for splash screen to be closed
@ -35,7 +35,7 @@ describe("Lens integration tests", () => {
} }
describe("app start", () => { describe("app start", () => {
beforeAll(awaitAppStart, 20000) beforeAll(appStart, 20000)
afterAll(async () => { afterAll(async () => {
if (app && app.isRunning()) { if (app && app.isRunning()) {
@ -110,25 +110,47 @@ describe("Lens integration tests", () => {
describeif(ready)("cluster tests", () => { describeif(ready)("cluster tests", () => {
let clusterAdded = false let clusterAdded = false
beforeAll(awaitAppStart, 20000)
afterAll(async () => { const addCluster = async () => {
if (app && app.isRunning()) {
return util.tearDown(app)
}
})
it('allows to add a cluster', async () => {
await clickWhatsNew(app) await clickWhatsNew(app)
await addMinikubeCluster(app) await addMinikubeCluster(app)
await waitForMinikubeDashboard(app) await waitForMinikubeDashboard(app)
await app.client.click('a[href="/nodes"]') await app.client.click('a[href="/nodes"]')
await app.client.waitUntilTextExists("div.TableCell", "Ready") await app.client.waitUntilTextExists("div.TableCell", "Ready")
clusterAdded = true }
describe("cluster add", () => {
beforeAll(appStart, 20000)
afterAll(async () => {
if (app && app.isRunning()) {
return util.tearDown(app)
}
})
it('allows to add a cluster', async () => {
await addCluster()
clusterAdded = true
})
}) })
const appStartAddCluster = async () => {
if (clusterAdded) {
await appStart()
await addCluster()
}
}
describe("cluster pages", () => { describe("cluster pages", () => {
beforeAll(appStartAddCluster, 40000)
afterAll(async () => {
if (app && app.isRunning()) {
return util.tearDown(app)
}
})
const tests : { const tests : {
drawer?: string drawer?: string
drawerId?: string drawerId?: string
@ -391,6 +413,14 @@ describe("Lens integration tests", () => {
}) })
describe("cluster operations", () => { describe("cluster operations", () => {
beforeEach(appStartAddCluster, 40000)
afterEach(async () => {
if (app && app.isRunning()) {
return util.tearDown(app)
}
})
it('shows default namespace', async () => { it('shows default namespace', async () => {
expect(clusterAdded).toBe(true) expect(clusterAdded).toBe(true)
await app.client.click('a[href="/namespaces"]') await app.client.click('a[href="/namespaces"]')
@ -400,6 +430,9 @@ describe("Lens integration tests", () => {
it(`creates ${TEST_NAMESPACE} namespace`, async () => { it(`creates ${TEST_NAMESPACE} namespace`, async () => {
expect(clusterAdded).toBe(true) expect(clusterAdded).toBe(true)
await app.client.click('a[href="/namespaces"]')
await app.client.waitUntilTextExists("div.TableCell", "default")
await app.client.waitUntilTextExists("div.TableCell", "kube-system")
await app.client.click("button.add-button") await app.client.click("button.add-button")
await app.client.waitUntilTextExists("div.AddNamespaceDialog", "Create Namespace") await app.client.waitUntilTextExists("div.AddNamespaceDialog", "Create Namespace")
await app.client.keys(`${TEST_NAMESPACE}\n`) await app.client.keys(`${TEST_NAMESPACE}\n`)