23 | Tired of mainstream fashion ideas, popular trends and societal
24 | norms? This line of lifestyle products will help you catch up with
25 | the hipster trend and express your personal style. Start shopping
26 | hip and vintage items now!
27 |
50 | );
51 | };
52 |
53 | export default Home;
54 |
--------------------------------------------------------------------------------
/demo-app/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/favicon.ico
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/air-plant.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/air-plant.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/barista-kit.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/barista-kit.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/camera-lens.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/camera-lens.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/camp-mug.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/camp-mug.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/city-bike.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/city-bike.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/credits.txt:
--------------------------------------------------------------------------------
1 | film-camera.jpg,CC0 Public Domain,https://pxhere.com/en/photo/829555
2 | camera-lens.jpg,CC0 Public Domain,https://pxhere.com/en/photo/670041
3 | air-plant.jpg,,https://unsplash.com/photos/uUwEAW5jFLE
4 | camp-mug.jpg,,https://unsplash.com/photos/h9VhRlMfVkg
5 | record-player.jpg,,https://unsplash.com/photos/pEEHFSX1vak
6 | city-bike.jpg,,https://unsplash.com/photos/Lpe9u9etwMU
7 | typewriter.jpg,,https://unsplash.com/photos/mk7D-4UCfmg
8 | barista-kit.jpg,,https://unsplash.com/photos/ZiRyGGIpRCw
9 | terrarium.jpg,,https://unsplash.com/photos/E9QYLj0724Y
10 |
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/film-camera.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/film-camera.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/record-player.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/record-player.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/terrarium.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/terrarium.jpg
--------------------------------------------------------------------------------
/demo-app/public/static/img/products/typewriter.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/demo-app/public/static/img/products/typewriter.jpg
--------------------------------------------------------------------------------
/demo-app/utils/storage.js:
--------------------------------------------------------------------------------
1 | const storage = typeof window === "undefined" ? {} : window.sessionStorage;
2 |
3 | export function get(key) {
4 | if (!storage) {
5 | return;
6 | }
7 | const str = JSON.parse(storage.getItem(key));
8 | return str;
9 | }
10 |
11 | export function set(key, value) {
12 | if (!storage) {
13 | return;
14 | }
15 | value = JSON.stringify(value);
16 | return storage.setItem(key, value);
17 | }
18 |
19 | export function del(key) {
20 | if (!storage) {
21 | return;
22 | }
23 | return storage.removeItem(key);
24 | }
25 |
--------------------------------------------------------------------------------
/dev-tools/find-unused-exports.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const unusedExports = require('ts-unused-exports');
26 | const result = unusedExports.default('./tsconfig.json');
27 | if (Object.keys(result).length) {
28 | throw Error(`Unused exports detected\n${JSON.stringify(result, null, 2)}\n`);
29 | }
30 | // eslint-disable-next-line no-console
31 | console.log('No unused exports detected.\n');
32 |
--------------------------------------------------------------------------------
/docs/DOWNLOAD.md:
--------------------------------------------------------------------------------
1 | # Elastic Synthetic Monitoring Point and Click Script Recorder Download Page
2 |
3 | **Current Version:** 1.4.14 Released 4 June 2025
4 |
5 | ## Download Links
6 |
7 | - [MacOS (Intel)](https://download.elasticsearch.org/synthetics-recorder/synthetics-recorder-1.4.14-mac-x64.dmg)
8 | - [MacOS (Apple Silicon)](https://download.elasticsearch.org/synthetics-recorder/synthetics-recorder-1.4.14-mac-arm64.dmg)
9 | - [Windows](https://download.elasticsearch.org/synthetics-recorder/synthetics-recorder-1.4.14-win-x64.exe)
10 | - [Linux](https://download.elasticsearch.org/synthetics-recorder/synthetics-recorder-1.4.14-linux-amd64.deb)
11 |
12 | ## Supported Systems
13 |
14 | - macOS (High Sierra and up): 64-bit Intel and ARM (Apple Silicon) for macOS
15 | - Windows (Windows 10 and up): x64
16 | - Linux: Ubuntu 14.04 and newer
17 |
--------------------------------------------------------------------------------
/docs/e2e_1.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/docs/e2e_1.png
--------------------------------------------------------------------------------
/docs/e2e_2.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/docs/e2e_2.png
--------------------------------------------------------------------------------
/docs/e2e_3.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/docs/e2e_3.png
--------------------------------------------------------------------------------
/e2e/.dockerignore:
--------------------------------------------------------------------------------
1 | **/node_modules
2 |
--------------------------------------------------------------------------------
/e2e/Dockerfile.jenkins:
--------------------------------------------------------------------------------
1 | ARG NODE_VERSION
2 | FROM node:$NODE_VERSION
3 |
4 | # Get desired XVFB display
5 | ARG DISPLAY
6 |
7 | # Install dependencies before we actually
8 | # switch into the unprivileged jenkins user.
9 | RUN apt-get -qq update
10 | RUN apt-get -y -qq install curl git
11 |
12 | # Installing XVFB and other GUI-related deps for E2E tests
13 | ARG DEBIAN_FRONTEND=noninteractive
14 | RUN apt-get -y -qq install xvfb \
15 | libgtk-3-0 \
16 | libxtst6 \
17 | libnotify-dev \
18 | libgconf-2-4 \
19 | libnss3 \
20 | libxss1 \
21 | libasound2 \
22 | libgbm-dev \
23 | --no-install-recommends \
24 | && rm -rf /var/lib/apt/lists/*
25 |
26 | # Make relevant environment variables available for tests
27 | ENV DISPLAY $DISPLAY
28 | ENV NPM_COMMAND ci
29 |
30 | WORKDIR /synthetics-recorder
31 |
32 | # Change the UID to match the one running the docker container
33 | ARG UID
34 | RUN usermod -u $UID node
35 |
36 | USER node
37 |
--------------------------------------------------------------------------------
/e2e/services/env.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | export const TEST_PORT = process.env.TEST_PORT;
26 | export const CDP_TEST_PORT = parseInt(TEST_PORT ?? '61337') + 1;
27 | export const DISPLAY = process.env.DISPLAY ?? ':99';
28 |
29 | export const DEMO_APP_PORT = process.env.DEMO_APP_PORT ?? '11337';
30 | export const DEMO_APP_URL = `http://localhost:${DEMO_APP_PORT}`;
31 |
--------------------------------------------------------------------------------
/e2e/services/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | export * from './electron';
26 | export * from './browser';
27 | export * as env from './env';
28 |
--------------------------------------------------------------------------------
/e2e/setup/builder.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const { spawn } = require('child_process');
26 |
27 | const buildFiles = async () => {
28 | return new Promise((resolve, reject) => {
29 | if (process.env.IS_RUNNER) return;
30 | const ls = spawn('npm', ['run', 'build'], {
31 | env: {
32 | PATH: process.env.PATH,
33 | BROWSER: 'none',
34 | },
35 | shell: true,
36 | detached: true,
37 | });
38 |
39 | ls.on('close', resolve);
40 |
41 | ls.stdout.setEncoding('utf8');
42 | ls.stderr.setEncoding('utf8');
43 |
44 | ls.stdout.on('data', data => {
45 | // eslint-disable-next-line no-console
46 | console.log(data);
47 | });
48 |
49 | ls.stderr.on('data', data => {
50 | // eslint-disable-next-line no-console
51 | console.error(data);
52 | reject();
53 | });
54 | });
55 | };
56 |
57 | module.exports = { buildFiles };
58 |
--------------------------------------------------------------------------------
/e2e/setup/demo_app.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const http = require('http');
26 | const url = require('url');
27 | const path = require('path');
28 | const next = require('../../demo-app/node_modules/next');
29 | const { env } = require('../services');
30 |
31 | const NEXT_DIR = path.join(__dirname, '../..', 'demo-app');
32 |
33 | const startServer = async () => {
34 | const app = next({ dev: false, dir: NEXT_DIR });
35 | const handle = app.getRequestHandler();
36 |
37 | await app.prepare();
38 |
39 | const httpServer = http.createServer((req, res) => {
40 | const parsedUrl = url.parse(req.url, true);
41 | handle(req, res, parsedUrl);
42 | });
43 |
44 | httpServer.listen(env.DEMO_APP_PORT, err => {
45 | if (err) throw err;
46 |
47 | // eslint-disable-next-line no-console
48 | console.log(`> Demo app ready on http://localhost:${env.DEMO_APP_PORT}`);
49 | });
50 |
51 | return httpServer;
52 | };
53 |
54 | const startDemoApp = async () => {
55 | const demoAppServer = await startServer();
56 | global.__demoApp__ = demoAppServer;
57 | };
58 |
59 | module.exports = { startDemoApp };
60 |
--------------------------------------------------------------------------------
/e2e/setup/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const { startDemoApp } = require('./demo_app');
26 |
27 | module.exports = async () => {
28 | await Promise.all([startDemoApp()]);
29 | };
30 |
--------------------------------------------------------------------------------
/e2e/teardown/demo_app.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const stopDemoApp = () => {
26 | return new Promise(resolve => {
27 | global.__demoApp__.close(resolve);
28 | });
29 | };
30 |
31 | module.exports = { stopDemoApp };
32 |
--------------------------------------------------------------------------------
/e2e/teardown/index.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const { stopDemoApp } = require('./demo_app');
26 |
27 | module.exports = async () => {
28 | await stopDemoApp();
29 | };
30 |
--------------------------------------------------------------------------------
/e2e/tests/assertion.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { ElectronServiceFactory, env } from '../services';
26 |
27 | const electronService = new ElectronServiceFactory();
28 |
29 | afterEach(async () => {
30 | await electronService.terminate();
31 | });
32 |
33 | describe('Assertion', () => {
34 | describe('Assertion Info Popover', () => {
35 | it('creates a link to playwright docs on assertion info popover', async () => {
36 | const electronWindow = await electronService.getWindow();
37 | await electronService.enterTestUrl(env.DEMO_APP_URL);
38 | await electronService.clickStartRecording();
39 | await electronService.waitForPageToBeIdle();
40 | await electronService.clickStopRecording();
41 | await electronService.clickActionElementSettingsButton(
42 | 'id=action-element-0-0',
43 | 'text=Add assertion'
44 | );
45 | await electronWindow.click(
46 | `[aria-label="Shows a popover with more information about Playwright assertions."]`
47 | );
48 |
49 | expect(
50 | await electronWindow.$(
51 | "text=You can add assertions to validate your page's content matches your expectations."
52 | )
53 | ).toBeTruthy();
54 | expect(await electronWindow.$('text=Read more')).toBeTruthy();
55 | });
56 | });
57 | });
58 |
--------------------------------------------------------------------------------
/e2e/tests/navigation.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import type { Server } from 'http';
26 | import { ElectronServiceFactory, env } from '../services';
27 | import { createTestHttpServer } from './testServer';
28 |
29 | const electronService = new ElectronServiceFactory();
30 |
31 | let server: Server;
32 | let url: string;
33 |
34 | beforeAll(async () => {
35 | const { server: s, port } = await createTestHttpServer();
36 | server = s;
37 | url = `http://localhost:${port}`;
38 | });
39 |
40 | afterAll(async () => {
41 | await electronService.terminate();
42 | await new Promise(resolve => server.close(resolve));
43 | });
44 |
45 | // fixme: flaky test
46 | describe.skip('Navigation', () => {
47 | it("records chromium's opened pages", async () => {
48 | const electronWindow = await electronService.getWindow();
49 |
50 | await electronService.enterTestUrl(env.DEMO_APP_URL);
51 |
52 | await electronService.clickStartRecording();
53 | await electronService.waitForPageToBeIdle();
54 | await electronService.navigateRecordingBrowser(url);
55 |
56 | expect(await electronWindow.$('text=Step 1')).toBeTruthy();
57 | expect(await electronWindow.$(`text=navigate ${env.DEMO_APP_URL}`)).toBeTruthy();
58 | expect(await electronWindow.$(`text=navigate ${url}`)).toBeTruthy();
59 | await electronService.clickStopRecording();
60 | });
61 | });
62 |
--------------------------------------------------------------------------------
/e2e/tests/pauseAndResume.test.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { ElectronServiceFactory, env } from '../services';
26 |
27 | const electronService = new ElectronServiceFactory();
28 |
29 | afterEach(async () => {
30 | await electronService.terminate();
31 | });
32 |
33 | // fixme: test is flaky
34 | describe.skip('Pause and Resume', () => {
35 | it('pauses and resumes', async () => {
36 | const electronWindow = await electronService.getWindow();
37 |
38 | await electronService.enterTestUrl(env.DEMO_APP_URL);
39 | await electronService.clickStartRecording();
40 | await electronService.waitForPageToBeIdle();
41 | await electronWindow.click('text=Pause');
42 |
43 | expect(await electronWindow.getByText('Recording paused')).toBeTruthy();
44 |
45 | expect(await electronWindow.getByText('Resume')).toBeTruthy();
46 | expect(await electronWindow.getByText('Stop').isDisabled()).toBeTruthy();
47 | expect(await electronWindow.getByText('Test').isDisabled()).toBeTruthy();
48 |
49 | await electronWindow.click('text=Resume');
50 | expect(await electronWindow.getByText('Recording', { exact: true })).toBeTruthy();
51 | await electronService.recordClick('text=BuyUSD 12.49 >> button');
52 | await electronService.recordClick('text=Add to Cart');
53 | await electronService.clickStopRecording();
54 |
55 | expect(await electronWindow.getByText('Start over').isEnabled()).toBeTruthy();
56 | expect(await electronWindow.getByText('Test').isEnabled()).toBeTruthy();
57 | });
58 | });
59 |
--------------------------------------------------------------------------------
/e2e/tests/testServer.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import http from 'http';
26 | import { AddressInfo } from 'net';
27 |
28 | export async function createTestHttpServer(port = 0) {
29 | const server = http.createServer((_req, res) => {
30 | res.statusCode = 200;
31 | res.setHeader('Content-Type', 'text/html');
32 | res.end(`
33 |
34 |
35 |
36 |
37 |
38 |
39 | `);
40 | });
41 |
42 | server.listen(port);
43 | await new Promise((resolve, reject) => {
44 | server.once('listening', resolve);
45 | server.once('error', reject);
46 | });
47 | const { port: p } = server.address() as AddressInfo;
48 | return { server, port: p };
49 | }
50 |
--------------------------------------------------------------------------------
/electron-builder.linux-x64.yml:
--------------------------------------------------------------------------------
1 | productName: "Elastic Synthetics Recorder"
2 | appId: co.elastic.synthetics-recorder
3 | artifactName: ${name}-${version}-${os}-${arch}.${ext}
4 | beforeBuild: "./scripts/fix-sharp.js"
5 | beforePack: "./scripts/before-pack.js"
6 | afterPack: "./scripts/after-pack.js"
7 | afterSign: "./scripts/notarize.js"
8 | files:
9 | - build/**/*
10 | - scripts/**/*
11 | - assets/entitlements.mac.plist
12 | extraResources:
13 | - from: local-browsers/_releases/${os}-${arch}
14 | to: local-browsers
15 | - from: node_modules/@img/**/*
16 | to: app.asar.unpacked/node_modules/@img
17 | - NOTICE.txt
18 | publish:
19 | - provider: github
20 | extraMetadata:
21 | main: build/electron/electron.js
22 | protocols:
23 | - name: elastic-synthetics-recorder
24 | schemes:
25 | - elastic-synthetics-recorder
26 | linux:
27 | target:
28 | - target: deb
29 | arch:
30 | - x64
31 | icon: public/elastic.png
32 | category: Utility
33 | # electron-builder issue:
34 | # https://github.com/electron-userland/electron-builder/issues/6200#issuecomment-907830847
35 | asarUnpack:
36 | - "**\\*.{node,dll}"
37 | - "**/node_modules/@elastic/synthetics/**"
38 | asar: true
--------------------------------------------------------------------------------
/electron-builder.mac-arm64.yml:
--------------------------------------------------------------------------------
1 | productName: "Elastic Synthetics Recorder"
2 | appId: co.elastic.synthetics-recorder
3 | artifactName: ${name}-${version}-${os}-${arch}.${ext}
4 | beforeBuild: "./scripts/fix-sharp.js"
5 | beforePack: "./scripts/before-pack.js"
6 | afterPack: "./scripts/after-pack.js"
7 | afterSign: "./scripts/notarize.js"
8 | files:
9 | - build/**/*
10 | - scripts/**/*
11 | - assets/entitlements.mac.plist
12 | extraResources:
13 | - from: local-browsers/_releases/${os}-${arch}
14 | to: local-browsers
15 | - from: node_modules/@img/**/*
16 | to: app.asar.unpacked/node_modules/@img
17 | - from: node_modules/color-name/**/*
18 | to: app.asar.unpacked/node_modules/color-name
19 | - NOTICE.txt
20 | publish:
21 | - provider: github
22 | extraMetadata:
23 | main: build/electron/electron.js
24 | protocols:
25 | - name: elastic-synthetics-recorder
26 | schemes:
27 | - elastic-synthetics-recorder
28 | mac:
29 | icon: public/elastic.png
30 | category: public.app-category.developer-tools
31 | entitlements: assets/entitlements.mac.plist
32 | entitlementsInherit: assets/entitlements.mac.plist
33 | gatekeeperAssess: false
34 | hardenedRuntime: true
35 | asar: true
36 | target:
37 | - target: default
38 | arch:
39 | - arm64
40 |
--------------------------------------------------------------------------------
/electron-builder.mac-x64.yml:
--------------------------------------------------------------------------------
1 | productName: "Elastic Synthetics Recorder"
2 | appId: co.elastic.synthetics-recorder
3 | artifactName: ${name}-${version}-${os}-${arch}.${ext}
4 | beforeBuild: "./scripts/fix-sharp.js"
5 | beforePack: "./scripts/before-pack.js"
6 | afterPack: "./scripts/after-pack.js"
7 | afterSign: "./scripts/notarize.js"
8 | files:
9 | - build/**/*
10 | - scripts/**/*
11 | - assets/entitlements.mac.plist
12 | extraResources:
13 | - from: local-browsers/_releases/${os}-${arch}
14 | to: local-browsers
15 | - from: node_modules/@img/**/*
16 | to: app.asar.unpacked/node_modules/@img
17 | - NOTICE.txt
18 | publish:
19 | - provider: github
20 | extraMetadata:
21 | main: build/electron/electron.js
22 | protocols:
23 | - name: elastic-synthetics-recorder
24 | schemes:
25 | - elastic-synthetics-recorder
26 | mac:
27 | icon: public/elastic.png
28 | category: public.app-category.developer-tools
29 | entitlements: assets/entitlements.mac.plist
30 | entitlementsInherit: assets/entitlements.mac.plist
31 | gatekeeperAssess: false
32 | hardenedRuntime: true
33 | asar: true
34 | target:
35 | - target: default
36 | arch:
37 | - x64
--------------------------------------------------------------------------------
/electron-builder.win-x64.yml:
--------------------------------------------------------------------------------
1 | productName: "Elastic Synthetics Recorder"
2 | appId: co.elastic.synthetics-recorder
3 | artifactName: ${name}-${version}-${os}-${arch}.${ext}
4 | beforeBuild: "./scripts/fix-sharp.js"
5 | beforePack: "./scripts/before-pack.js"
6 | afterPack: "./scripts/after-pack.js"
7 | afterSign: "./scripts/notarize.js"
8 | files:
9 | - build/**/*
10 | - scripts/**/*
11 | - assets/entitlements.mac.plist
12 | extraResources:
13 | - from: local-browsers/_releases/${os}-${arch}
14 | to: local-browsers
15 | - from: node_modules/@img/**/*
16 | to: app.asar.unpacked/node_modules/@img
17 | - NOTICE.txt
18 | publish:
19 | - provider: github
20 | extraMetadata:
21 | main: build/electron/electron.js
22 | protocols:
23 | - name: elastic-synthetics-recorder
24 | schemes:
25 | - elastic-synthetics-recorder
26 | win:
27 | target:
28 | - target: nsis
29 | arch:
30 | - x64
31 | icon: public/elastic.png
32 | asar: true
33 | asarUnpack:
34 | - "**\\*.{node,dll}"
35 | - "**/node_modules/@elastic/synthetics/**"
--------------------------------------------------------------------------------
/electron/api/exportScript.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import { BrowserWindow, dialog, IpcMainInvokeEvent } from 'electron';
25 | import { writeFile } from 'fs/promises';
26 |
27 | export async function onExportScript(_event: IpcMainInvokeEvent, code: string) {
28 | const window = BrowserWindow.getFocusedWindow() || BrowserWindow.getAllWindows()[0];
29 | const { filePath, canceled } = await dialog.showSaveDialog(window, {
30 | filters: [
31 | {
32 | name: 'JavaScript',
33 | extensions: ['js'],
34 | },
35 | ],
36 | defaultPath: 'recorded.journey.js',
37 | });
38 |
39 | if (!canceled && filePath) {
40 | await writeFile(filePath, code);
41 | return true;
42 | }
43 | return false;
44 | }
45 |
--------------------------------------------------------------------------------
/electron/api/generateCode.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import type { Steps } from '@elastic/synthetics';
26 | import { SyntheticsGenerator } from '@elastic/synthetics/dist/formatter/javascript';
27 | import type { IpcMainInvokeEvent } from 'electron';
28 |
29 | export async function onGenerateCode(
30 | _event: IpcMainInvokeEvent,
31 | data: { isProject: boolean; actions: Steps }
32 | ) {
33 | const generator = new SyntheticsGenerator(data.isProject);
34 | return generator.generateFromSteps(data.actions);
35 | }
36 |
--------------------------------------------------------------------------------
/electron/api/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | export * from './recordJourney';
25 | export * from './setMode';
26 | export * from './exportScript';
27 | export * from './runJourney';
28 | export * from './openExternalLink';
29 | export * from './generateCode';
30 |
--------------------------------------------------------------------------------
/electron/api/openExternalLink.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import { IpcMainInvokeEvent, shell } from 'electron';
25 | import logger from 'electron-log';
26 |
27 | export async function onOpenExternalLink(_event: IpcMainInvokeEvent, url: string) {
28 | try {
29 | await shell.openExternal(url);
30 | } catch (e) {
31 | logger.error(e);
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/electron/api/setMode.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import { IpcMainInvokeEvent } from 'electron';
25 | import { BrowserManager } from '../browserManager';
26 |
27 | export function onSetMode(browserManager: BrowserManager) {
28 | return async function (_event: IpcMainInvokeEvent, mode: string) {
29 | const browserContext = browserManager.getContext();
30 | if (!browserContext) return;
31 | const page = browserContext.pages()[0];
32 | if (!page) return;
33 | await page.mainFrame().evaluate(
34 | ([mode]) => {
35 | // `__pw_setMode` is a private function
36 | (window as any).__pw_setMode(mode);
37 | },
38 | [mode]
39 | );
40 | };
41 | }
42 |
--------------------------------------------------------------------------------
/electron/config.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { join } from 'path';
26 | import isDev from 'electron-is-dev';
27 | import { getExecutablePath, getChromeVersion } from '../scripts/install-pw';
28 |
29 | /**
30 | * Electron resources path where all the `extraResources`
31 | * mentioned in build are copied to on all platforms
32 | */
33 | const RESOURCES_PATH = process.resourcesPath;
34 | const ROOT_DIR = process.cwd();
35 |
36 | /**
37 | * Journey directory is for storing a dummy file to simulate
38 | * the project tests
39 | */
40 | export const JOURNEY_DIR = isDev ? join(ROOT_DIR, 'journeys') : join(RESOURCES_PATH, 'journeys');
41 |
42 | /**
43 | * Controls where the browser binaries are available
44 | * to use it for both recording and testing phase
45 | */
46 | export const PLAYWRIGHT_BROWSERS_PATH = isDev
47 | ? join(ROOT_DIR, 'local-browsers')
48 | : join(RESOURCES_PATH, 'local-browsers');
49 |
50 | const defaultExecutablePath = getExecutablePath();
51 | const installedVersion = getChromeVersion();
52 |
53 | export const EXECUTABLE_PATH = join(
54 | PLAYWRIGHT_BROWSERS_PATH,
55 | installedVersion,
56 | defaultExecutablePath.split(installedVersion)[1]
57 | );
58 |
--------------------------------------------------------------------------------
/electron/preload.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import type { IElectronAPI } from '../common/types';
25 | import { contextBridge, ipcRenderer } from 'electron';
26 |
27 | const electronAPI: IElectronAPI = {
28 | exportScript: async contents => {
29 | return await ipcRenderer.invoke('export-script', contents);
30 | },
31 | recordJourney: async url => {
32 | return await ipcRenderer.invoke('record-journey', url);
33 | },
34 | stopRecording: async () => {
35 | await ipcRenderer.invoke('stop-recording');
36 | },
37 | pauseRecording: async () => {
38 | await ipcRenderer.invoke('set-mode', 'none');
39 | },
40 | resumeRecording: async () => {
41 | await ipcRenderer.invoke('set-mode', 'recording');
42 | },
43 | addActionGeneratedListener: listener => {
44 | ipcRenderer.on('actions-generated', listener);
45 | return () => {
46 | ipcRenderer.removeAllListeners('actions-generated');
47 | };
48 | },
49 | generateCode: async params => {
50 | return ipcRenderer.invoke('actions-to-code', params);
51 | },
52 | openExternalLink: async url => {
53 | await ipcRenderer.invoke('open-external-link', url);
54 | },
55 | runTest: async (params, listener) => {
56 | ipcRenderer.on('test-event', listener);
57 | await ipcRenderer.invoke('run-journey', params);
58 | },
59 | removeOnTestListener: () => {
60 | ipcRenderer.removeAllListeners('test-event');
61 | },
62 | };
63 |
64 | contextBridge.exposeInMainWorld('electronAPI', electronAPI);
65 |
--------------------------------------------------------------------------------
/electron/syntheticsManager.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import { fork, ChildProcess, ForkOptions } from 'child_process';
25 | import logger from 'electron-log';
26 | const SYNTHETICS_CLI = require.resolve('@elastic/synthetics/dist/cli');
27 |
28 | export class SyntheticsManager {
29 | protected _cliProcess: ChildProcess | null = null;
30 |
31 | isRunning() {
32 | return !!this._cliProcess;
33 | }
34 |
35 | /**
36 | * Fork the Synthetics CLI with correct browser path and
37 | * cwd correctly spawns the process
38 | */
39 | run(args: string[], options: ForkOptions) {
40 | const ps = fork(`${SYNTHETICS_CLI}`, args, options);
41 | this._cliProcess = ps;
42 | return ps;
43 | }
44 |
45 | stop() {
46 | if (this._cliProcess && !this._cliProcess.kill()) {
47 | logger.warn('Unable to abort Synthetics test process.');
48 | }
49 | this._cliProcess = null;
50 | }
51 | }
52 |
53 | export const syntheticsManager = new SyntheticsManager();
54 |
--------------------------------------------------------------------------------
/jest.e2e.config.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | module.exports = {
26 | verbose: true,
27 | preset: 'ts-jest',
28 | bail: true,
29 |
30 | // The paths to modules that run some code to configure or set up the testing environment before each test
31 | // setupFiles: [],
32 |
33 | globalSetup: '/e2e/setup',
34 | globalTeardown: '/e2e/teardown',
35 |
36 | // A list of paths to modules that run some code to configure or set up the testing framework before each test
37 | setupFilesAfterEnv: [],
38 |
39 | testEnvironment: 'node',
40 |
41 | testPathIgnorePatterns: [`node_modules`, `\\.cache`, './e2e/setup'],
42 |
43 | // This option sets the URL for the jsdom environment. It is reflected in properties such as location.href
44 | // testURL: "http://localhost",
45 | transform: {
46 | '^.+\\.tsx?$': 'ts-jest',
47 | },
48 | globals: {
49 | 'ts-jest': {
50 | isolatedModules: true,
51 | },
52 | },
53 | moduleFileExtensions: ['ts', 'tsx', 'js', 'jsx', 'json', 'node'],
54 | testTimeout: 60000,
55 | reporters: ['default', ['jest-junit', { outputName: 'e2e-junit.xml' }]],
56 | };
57 |
--------------------------------------------------------------------------------
/jest.unit.config.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | module.exports = {
26 | projects: [
27 | {
28 | displayName: 'node',
29 | preset: 'ts-jest',
30 | coveragePathIgnorePatterns: ['.test.ts', '.test.js', '.test.tsx', '.test.jsx'],
31 | testEnvironment: 'node',
32 | testMatch: ['**/?(*.)+(spec|test).[tj]s'],
33 | testPathIgnorePatterns: [`node_modules`, `\\.cache`, `e2e`, `build`],
34 | },
35 | {
36 | displayName: 'components',
37 | preset: 'ts-jest',
38 | coveragePathIgnorePatterns: ['.test.ts', '.test.js', '.test.tsx', '.test.jsx'],
39 | testEnvironment: 'jsdom',
40 | testMatch: ['**/?(*.)+(spec|test).[tj]sx'],
41 | testPathIgnorePatterns: [`node_modules`, `\\.cache`, `e2e`, `build`],
42 | resolver: `./tests/common/resolver.js`,
43 | },
44 | ],
45 | };
46 |
--------------------------------------------------------------------------------
/nodemon.json:
--------------------------------------------------------------------------------
1 | {
2 | "watch": ["build/electron/"]
3 | }
4 |
--------------------------------------------------------------------------------
/public/elastic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/public/elastic.png
--------------------------------------------------------------------------------
/public/favicon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/elastic/synthetics-recorder/5c39986c1929e11e088d5c52b7f7f909e759e23e/public/favicon.png
--------------------------------------------------------------------------------
/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 | Elastic Synthetics Recorder
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/scripts/after-pack.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | const { spawn } = require('child_process');
25 | const path = require('path');
26 |
27 | exports.default = function afterPack(ctx) {
28 | const platform = ctx.electronPlatformName;
29 | if (platform === 'linux') {
30 | const resourcesPath = path.join(ctx.appOutDir, 'resources');
31 | return changePermission(resourcesPath);
32 | }
33 | };
34 |
35 | function changePermission(resourcesPath) {
36 | return new Promise((resolve, reject) => {
37 | const ps = spawn('chmod', ['777', resourcesPath], {
38 | shell: true,
39 | });
40 | ps.on('close', code => {
41 | if (code === 0) {
42 | resolve();
43 | } else {
44 | reject(new Error('process finished with error code ' + code));
45 | }
46 | });
47 | ps.on('error', reject);
48 | });
49 | }
50 |
--------------------------------------------------------------------------------
/scripts/before-pack.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const { Arch } = require('electron-builder');
26 | const { downloadForPlatform } = require('./download-chromium');
27 |
28 | exports.default = function beforePack(ctx) {
29 | const arch = Arch[ctx.arch];
30 | const platform = ctx.electronPlatformName;
31 | return downloadForPlatform(platform, arch);
32 | };
33 |
--------------------------------------------------------------------------------
/scripts/fix-sharp.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | const { spawn } = require('child_process');
26 |
27 | // This script will forcibly install sharp for the given platform, because
28 | // at times the electro-builder process seems not to do this.
29 | exports.default = async function fixSharp(ctx) {
30 | const platform = ctx.platform.nodeName;
31 | const arch = ctx.arch;
32 |
33 | const filteredEnvs = {};
34 | for (const [k, v] of Object.entries(process.env)) {
35 | if (!k.startsWith('APPLE_') && !k.includes('PASSWORD')) {
36 | filteredEnvs[k] = v;
37 | }
38 | }
39 |
40 | await new Promise((resolve, reject) => {
41 | const npmInstall = spawn('sh', ['-c', 'env && npm install sharp'], {
42 | stdio: 'inherit',
43 | shell: true,
44 | env: {
45 | ...filteredEnvs,
46 | npm_config_os: platform,
47 | npm_config_cpu: arch,
48 | npm_config_arch: arch,
49 | npm_config_platform: platform,
50 | },
51 | });
52 | npmInstall.on('close', code => {
53 | if (code === 0) {
54 | resolve();
55 | } else {
56 | reject(new Error('process finished with error code ' + code));
57 | }
58 | });
59 | npmInstall.on('error', reason => {
60 | reject(reason);
61 | });
62 | });
63 | return true;
64 | };
65 |
--------------------------------------------------------------------------------
/scripts/notarize.js:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | const { notarize } = require('@electron/notarize');
25 |
26 | exports.default = async function notarizing(context) {
27 | const { electronPlatformName, appOutDir } = context;
28 | if (electronPlatformName !== 'darwin' || process.env.SKIP_NOTARIZATION) {
29 | return;
30 | }
31 | const appName = context.packager.appInfo.productFilename;
32 | const { APPLE_USERNAME, APPLE_TEAM_ID, APPLE_APP_SPECIFIC_PASSWORD } = process.env;
33 |
34 | return await notarize({
35 | tool: 'notarytool',
36 | appPath: `${appOutDir}/${appName}.app`,
37 | appleId: APPLE_USERNAME,
38 | appleIdPassword: APPLE_APP_SPECIFIC_PASSWORD,
39 | teamId: APPLE_TEAM_ID,
40 | });
41 | };
42 |
--------------------------------------------------------------------------------
/src/common/types.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import type { StepStatus } from '../../common/types';
26 |
27 | export type ResultCategory = StepStatus | 'running';
28 |
29 | export interface StepSeparatorDragDropDataTransfer {
30 | initiatorIndex: number;
31 | }
32 |
33 | export type Setter = React.Dispatch>;
34 |
35 | export enum RecordingStatus {
36 | NotRecording = 'NOT_RECORDING',
37 | Recording = 'RECORDING',
38 | Paused = 'PAUSED',
39 | }
40 |
--------------------------------------------------------------------------------
/src/components/ActionDetail/FormControl.test.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { fireEvent } from '@testing-library/react';
26 | import React from 'react';
27 | import { render } from '../../helpers/test';
28 | import { FormControl } from './FormControl';
29 |
30 | describe('FormControl', () => {
31 | it('Displays the label', () => {
32 | const { getByText } = render(
33 |
34 | );
35 |
36 | expect(getByText('Test label'));
37 | expect(getByText('Test name'));
38 | });
39 |
40 | it('handles `onChange`', async () => {
41 | const onChange = jest.fn();
42 | const { getByRole } = render(
43 |
44 | );
45 |
46 | const textElement = getByRole('textbox');
47 |
48 | fireEvent.change(textElement, { target: { value: 'updated value' } });
49 |
50 | expect(onChange).toHaveBeenCalled();
51 | });
52 | });
53 |
--------------------------------------------------------------------------------
/src/components/ActionDetail/FormControl.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFormRow, EuiFieldText } from '@elastic/eui';
26 | import React, { ChangeEventHandler } from 'react';
27 |
28 | interface IFormControl {
29 | 'data-test-subj'?: string;
30 | label?: string;
31 | name: string;
32 | noPrepend?: boolean;
33 | onChange: ChangeEventHandler;
34 | value: string;
35 | }
36 |
37 | export function FormControl({ label, name, noPrepend, onChange, value, ...rest }: IFormControl) {
38 | return (
39 |
40 |
46 |
47 | );
48 | }
49 |
--------------------------------------------------------------------------------
/src/components/ActionDetail/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | export { ActionDetail } from './ActionDetail';
26 |
--------------------------------------------------------------------------------
/src/components/ActionElement/AssertionHeadingText.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
26 | import type { ActionInContext } from '@elastic/synthetics';
27 | import React from 'react';
28 | import { COMMAND_SELECTOR_OPTIONS } from '../../common/shared';
29 | import { Bold } from './styles';
30 |
31 | interface IAssertionHeadingText {
32 | actionContext: ActionInContext;
33 | }
34 |
35 | export function AssertionHeadingText({ actionContext }: IAssertionHeadingText) {
36 | return (
37 |
38 | {actionContext.action.name}
39 |
40 | {
41 | COMMAND_SELECTOR_OPTIONS.find(option => option.value === actionContext.action.command)
42 | ?.text
43 | }
44 |
45 | {actionContext.action.selector}
46 | {actionContext.action.value}
47 |
48 | );
49 | }
50 |
--------------------------------------------------------------------------------
/src/components/ActionElement/Behavior.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 | import { EuiFlexItem } from '@elastic/eui';
25 | import React from 'react';
26 | import styled from 'styled-components';
27 |
28 | const AssertItem = styled(EuiFlexItem)`
29 | border-left: ${props => props.theme.border.thick};
30 | padding-left: 20px;
31 | `;
32 |
33 | const ActionItem = styled(EuiFlexItem)`
34 | border-left: ${props => props.theme.border.thick};
35 | padding-left: 20px;
36 | margin-left: 0px;
37 | `;
38 |
39 | interface IActionWrapper {
40 | children: React.ReactNode;
41 | isAssert?: boolean;
42 | omitBorder?: boolean;
43 | }
44 |
45 | export const Behavior: React.FC = ({ children, isAssert, omitBorder }) => {
46 | if (isAssert) return {children};
47 | if (omitBorder) {
48 | return {children};
49 | }
50 |
51 | return {children};
52 | };
53 |
--------------------------------------------------------------------------------
/src/components/ActionElement/ControlButton.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiButtonIcon, EuiButtonIconPropsForButton, EuiToolTip } from '@elastic/eui';
26 | import React from 'react';
27 |
28 | const DEFAULT_DISABLED_TOOLTIP_CONTENT = 'Cannot edit actions while recording.';
29 | interface IActionControlButton {
30 | disabledToolTipContent?: string;
31 | // when disabled, display a tooltip explaining why
32 | hideToolTipWhenDisabled?: boolean;
33 | isVisible: boolean;
34 | }
35 |
36 | type Props = IActionControlButton & EuiButtonIconPropsForButton;
37 |
38 | export function ActionControlButton({
39 | disabledToolTipContent,
40 | isDisabled,
41 | hideToolTipWhenDisabled,
42 | iconType,
43 | isVisible,
44 | onClick,
45 | ...rest
46 | }: Props) {
47 | const button = (
48 |
58 | );
59 |
60 | if (isDisabled && !hideToolTipWhenDisabled) {
61 | return (
62 |
63 | {button}
64 |
65 | );
66 | }
67 |
68 | return button;
69 | }
70 |
--------------------------------------------------------------------------------
/src/components/ActionElement/HeadingText.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFlexGroup, EuiFlexItem } from '@elastic/eui';
26 | import type { ActionInContext } from '@elastic/synthetics';
27 | import React from 'react';
28 | import styled from 'styled-components';
29 | import { AssertionHeadingText } from './AssertionHeadingText';
30 | import { Bold } from './styles';
31 |
32 | interface IHeadingText {
33 | actionContext: ActionInContext;
34 | }
35 |
36 | const WrapText = styled(EuiFlexItem)`
37 | overflow-wrap: anywhere;
38 | `;
39 |
40 | export function HeadingText({ actionContext }: IHeadingText) {
41 | if (actionContext.action.isAssert) {
42 | return ;
43 | }
44 | return (
45 |
46 | {actionContext.action.name}
47 |
48 |
49 | {actionContext.action.name !== 'navigate' && actionContext.action.selector}
50 | {actionContext.action.name === 'navigate' ? actionContext.action.url : null}
51 |
52 |
53 | );
54 | }
55 |
--------------------------------------------------------------------------------
/src/components/ActionElement/NewStepDividerButton.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import styled from 'styled-components';
26 | import { EuiButtonIcon } from '@elastic/eui';
27 | import React from 'react';
28 |
29 | interface Props {
30 | actionIndex: number;
31 | stepIndex: number;
32 | onClick: () => void;
33 | }
34 |
35 | interface StyleProps {
36 | computedvisibility: string;
37 | }
38 |
39 | const AddStepDivider = styled(EuiButtonIcon)`
40 | background-color: ${({ theme }) => theme.colors.body};
41 | position: relative;
42 | left: 63px;
43 | top: -8px;
44 | visibility: ${({ computedvisibility }) => computedvisibility};
45 | z-index: 1;
46 | `;
47 |
48 | export function NewStepDividerButton({ actionIndex, stepIndex, onClick }: Props) {
49 | return (
50 | 0 ? 'visible' : 'hidden'}
53 | color="text"
54 | iconType="plusInCircle"
55 | id={`insert-divider-${stepIndex}-${actionIndex}`}
56 | onClick={onClick}
57 | />
58 | );
59 | }
60 |
--------------------------------------------------------------------------------
/src/components/ActionElement/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | export { ActionElement } from './ActionElement';
26 |
--------------------------------------------------------------------------------
/src/components/ActionElement/styles.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFlexItem } from '@elastic/eui';
26 | import styled from 'styled-components';
27 |
28 | export const Bold = styled(EuiFlexItem)`
29 | font-weight: bold;
30 | `;
31 |
--------------------------------------------------------------------------------
/src/components/AppPageBody.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiPageBody } from '@elastic/eui';
26 | import React from 'react';
27 | import styled from 'styled-components';
28 |
29 | const PageBody = styled(EuiPageBody)`
30 | padding: 0px 0px 0px 40px;
31 | `;
32 |
33 | export const AppPageBody: React.FC<{ children: React.ReactNode }> = ({ children }) => {
34 | return {children};
35 | };
36 |
--------------------------------------------------------------------------------
/src/components/Assertion/Select.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiSelect } from '@elastic/eui';
26 | import React, { ChangeEventHandler } from 'react';
27 | import { COMMAND_SELECTOR_OPTIONS } from '../../common/shared';
28 |
29 | interface IAssertionSelect {
30 | onChange: ChangeEventHandler;
31 | value?: string;
32 | }
33 |
34 | export function AssertionSelect({ onChange, value }: IAssertionSelect) {
35 | return (
36 |
42 | );
43 | }
44 |
--------------------------------------------------------------------------------
/src/components/Assertion/index.ts:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | export { Assertion } from './Assertion';
26 |
--------------------------------------------------------------------------------
/src/components/ExportScriptFlyout/Body.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiCheckbox, EuiCodeBlock, EuiFlyoutBody, EuiSpacer } from '@elastic/eui';
26 | import React from 'react';
27 | import type { Setter } from '../../common/types';
28 |
29 | interface Props {
30 | code: string;
31 | exportAsProject: boolean;
32 | setExportAsProject: Setter;
33 | }
34 |
35 | export function Body({ code, exportAsProject, setExportAsProject }: Props) {
36 | return (
37 |
38 | setExportAsProject(!exportAsProject)}
43 | />
44 |
45 |
53 | {code}
54 |
55 |
56 | );
57 | }
58 |
--------------------------------------------------------------------------------
/src/components/ExportScriptFlyout/Footer.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFlyoutFooter, EuiFlexGroup, EuiFlexItem, EuiButtonEmpty } from '@elastic/eui';
26 | import React from 'react';
27 | import type { Setter } from '../../common/types';
28 | import type { JourneyType } from '../../../common/types';
29 | import { SaveCodeButton } from '../SaveCodeButton';
30 |
31 | interface IFlyoutFooter {
32 | setVisible: Setter;
33 | type: JourneyType;
34 | }
35 |
36 | export function Footer({ setVisible, type }: IFlyoutFooter) {
37 | return (
38 |
39 |
40 |
41 | setVisible(false)}>Close
42 |
43 |
44 |
45 |
46 |
47 |
48 | );
49 | }
50 |
--------------------------------------------------------------------------------
/src/components/ExportScriptFlyout/Header.tsx:
--------------------------------------------------------------------------------
1 | /*
2 | MIT License
3 |
4 | Copyright (c) 2021-present, Elastic NV
5 |
6 | Permission is hereby granted, free of charge, to any person obtaining a copy
7 | of this software and associated documentation files (the "Software"), to deal
8 | in the Software without restriction, including without limitation the rights
9 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 | copies of the Software, and to permit persons to whom the Software is
11 | furnished to do so, subject to the following conditions:
12 |
13 | The above copyright notice and this permission notice shall be included in
14 | all copies or substantial portions of the Software.
15 |
16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22 | THE SOFTWARE.
23 | */
24 |
25 | import { EuiFlyoutHeader, EuiTitle } from '@elastic/eui';
26 | import React from 'react';
27 |
28 | interface IFlyoutHeader {
29 | id: string;
30 | headerText: string;
31 | }
32 |
33 | export function Header({ headerText, id }: IFlyoutHeader) {
34 | return (
35 |
36 |
37 |