Skip to content

Commit a881116

Browse files
committed
fix start before build is ready
1 parent e97338f commit a881116

File tree

1 file changed

+10
-24
lines changed

1 file changed

+10
-24
lines changed

tests/admin-ui-tests/utils.ts

Lines changed: 10 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -67,42 +67,27 @@ export function adminUITests (
6767
tests: (browser: playwright.BrowserType<playwright.Browser>) => void
6868
) {
6969
const projectDir = path.join(projectRoot, pathToTest)
70-
7170
dotenv.config()
71+
7272
describe('development', () => {
7373
let exit: (() => Promise<void>) | undefined = undefined
74-
75-
test('start keystone in dev', async () => {
74+
test('prepare keystone', async () => {
7675
;({ exit } = await spawnCommand3(projectDir, ['dev'], 'Admin UI ready'))
7776
})
7877

79-
describe('browser tests', () => {
80-
tests(playwright.chromium)
81-
})
82-
83-
afterAll(async () => {
84-
await exit?.()
85-
})
78+
describe('browser tests', () => tests(playwright.chromium))
79+
afterAll(async () => await exit?.())
8680
})
8781

8882
describe('production browser tests', () => {
8983
let exit: (() => Promise<void>) | undefined = undefined
90-
91-
test('build keystone', async () => {
92-
await spawnCommand3(projectDir, ['build'])
93-
})
94-
95-
test('start keystone in prod', async () => {
84+
test('prepare keystone', async () => {
85+
await (await spawnCommand3(projectDir, ['build'])).exited
9686
;({ exit } = await spawnCommand3(projectDir, ['start'], 'Admin UI ready'))
9787
})
9888

99-
describe('browser tests', () => {
100-
tests(playwright.chromium)
101-
})
102-
103-
afterAll(async () => {
104-
await exit?.()
105-
})
89+
describe('browser tests', () => tests(playwright.chromium))
90+
afterAll(async () => await exit?.())
10691
})
10792
}
10893

@@ -147,6 +132,7 @@ export async function spawnCommand3 (cwd: string, commands: string[], waitOn: st
147132
exit: async () => {
148133
p.kill('SIGHUP')
149134
await exitPromise
150-
}
135+
},
136+
exited: exitPromise
151137
}
152138
}

0 commit comments

Comments
 (0)