MCPcopy Create free account
hub / github.com/gotify/server / newTest

Function newTest

ui/src/tests/setup.ts:30–63  ·  view source on GitHub ↗
(pluginsDir = '')

Source from the content-addressed store, hash-verified

28};
29
30export 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
65const testPluginDir = (): {dir: string; generator: () => string} => {
66 const random = Math.random().toString(36).substring(2, 15);

Callers 5

message.test.tsFile · 0.90
plugin.test.tsFile · 0.90
user.test.tsFile · 0.90
client.test.tsFile · 0.90

Calls 4

testFilePathFunction · 0.85
buildGoExecutableFunction · 0.85
startGotifyFunction · 0.85
waitForGotifyFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…