(pluginsDir = '')
| 28 | }; |
| 29 | |
| 30 | export const newTest = async (pluginsDir = ''): Promise<GotifyTest> => { |
| 31 | const port = await getPort(); |
| 32 | |
| 33 | const gotifyFile = testFilePath(); |
| 34 | |
| 35 | await buildGoExecutable(gotifyFile); |
| 36 | |
| 37 | const gotifyInstance = startGotify(gotifyFile, port, pluginsDir); |
| 38 | |
| 39 | const gotifyURL = 'http://localhost:' + port; |
| 40 | await waitForGotify('http-get://localhost:' + port); |
| 41 | const browser = await puppeteer.launch({ |
| 42 | headless: process.env.CI === 'true', |
| 43 | args: [`--window-size=1920,1080`, '--no-sandbox'], |
| 44 | }); |
| 45 | const page = await browser.newPage(); |
| 46 | await page.setViewport({width: 1920, height: 1080}); |
| 47 | await page.goto(gotifyURL); |
| 48 | |
| 49 | return { |
| 50 | close: async () => { |
| 51 | await Promise.all([ |
| 52 | browser.close(), |
| 53 | new Promise((resolve) => |
| 54 | kill(gotifyInstance.pid!, 'SIGKILL', () => resolve(undefined)) |
| 55 | ), |
| 56 | ]); |
| 57 | rimrafSync(gotifyFile, {maxRetries: 8}); |
| 58 | }, |
| 59 | url: gotifyURL, |
| 60 | browser, |
| 61 | page, |
| 62 | }; |
| 63 | }; |
| 64 | |
| 65 | const testPluginDir = (): {dir: string; generator: () => string} => { |
| 66 | const random = Math.random().toString(36).substring(2, 15); |
no test coverage detected
searching dependent graphs…