Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run tests separately by using a custom command #384

Closed
pikonha opened this issue Sep 24, 2021 · 11 comments
Closed

Run tests separately by using a custom command #384

pikonha opened this issue Sep 24, 2021 · 11 comments

Comments

@pikonha
Copy link

pikonha commented Sep 24, 2021

Hi there,

I'm implementing synthetics tests here at my company and trying this tool.
I currently have about 10 tests grouped by context and they are all started by the default elastic-synthetics command.

What I'm looking for is a way of running they separately, possible by specifying the path in the command. But I haven't found any way of passing flags to the docker.elastic.co/beats/heartbeat:7.13.0 image default command.

Can you guys help me with this issue?
FYI I'm currently running all tests in the same pod since every file that has the .journey prefix is executed.

If you need any extra information or files I'd be glad to share with you.

@vigneshshanmugam
Copy link
Member

@picolloo You can filter journeys based on tags and match. Find the docs here - https://www.elastic.co/guide/en/beats/heartbeat/current/monitor-browser-options.html#monitor-browser-filter-journeys

These would allow you to group journeys, Let us know if you need any help.

@pikonha
Copy link
Author

pikonha commented Sep 27, 2021

I tried using this configuration but it appears no being passed to the default command:
heartbeat_1 | 2021-09-27T14:22:23.019Z INFO synthexec/synthexec.go:128 Running command: /tmp/elastic-synthetics-463793093/node_modules/.bin/elastic-synthetics . --screenshots --json --network --outfd 3 in directory: '/tmp/elastic-synthetics-463793093'

I also keep receiving this warning: synthexec/synthexec.go:207 error parsing line: invalid character 'a' looking for beginning of value for line: at 22432 ms Runner: end step.

My heartbeat.yml:

heartbeat.monitors:
- type: browser
  name: accounts
  id: accounts-auth
  schedule: "@every 1m"
  filter_journeys:
    match: "Sign in*"
  source:
    local:
      path: "${SUITES_DIR}"

The journey:

journey('Sign in', options => {
  const { page } = options
  const signInPage = new SignInPage(page)

  step('sign in', async () => {
    await signInPage.navigate()
    return signInPage.signIn()
  })

  step('select product', async () => signInPage.selectMarketingProduct())
})

@vigneshshanmugam
Copy link
Member

Needs two changes for this feature to work.

  1. Heartbeat version should be 7.14
  2. Journeys needs to be tagged properly.
journey({name: "Sign in page", tag: tags: ['home']}, options => {
 
});
  1. Tags grouping allows you to group journeys

It should also work with name match in your example as its matched using filter_jorurneys.match. Could you let me know if the stack version is 7.14?

@pikonha
Copy link
Author

pikonha commented Sep 27, 2021

I've upgraded the heartbeat version to the 7.14 and gave the journey a name: journey({ name: 'Sign in' }, options => {}).

But I keep receiving INFO synthexec/synthexec.go:131 Running command: /tmp/elastic-synthetics-308913876/node_modules/.bin/elastic-synthetics /tmp/elastic-synthetics-308913876 --screensho ts on --rich-events --outfd 3 in directory: '/tmp/elastic-synthetics-308913876 and every journey is run.

Locally I'm able to use match to run this journey only, but inside heartbeat it just does not work.

@vigneshshanmugam
Copy link
Member

Apologies, its available from Heartbeat 7.15 onwards. I provided the link to the current documentation which was the latest. Can you try and let us know.

@pikonha
Copy link
Author

pikonha commented Sep 28, 2021

Thanks for your help in here @vigneshshanmugam. Using this Dockerfile I was able to make it work as I expected:

FROM docker.elastic.co/beats/heartbeat:7.15.0

USER root
RUN mkdir $SUITES_DIR
RUN chown heartbeat:heartbeat $SUITES_DIR

USER heartbeat

WORKDIR $SUITES_DIR

COPY package.json .
COPY package-lock.json .

RUN npm i

COPY . .

Even though I still receiving this message: synthexec/synthexec.go:221 error parsing line: invalid character 'a' looking for beginning of value for line: at 6478 ms Runner: end step (fill form). But I guess it isn't related to my journeys.

Wish you the best, see ya.

@pikonha pikonha closed this as completed Sep 28, 2021
@pikonha
Copy link
Author

pikonha commented Sep 29, 2021

There's something wrong happening with the screenshots after the updates I made. Is this a problem with heartbeat:7.15?

image

@pikonha pikonha reopened this Sep 29, 2021
@vigneshshanmugam
Copy link
Member

Which version of of Kibana are you using? We made some changes on how we store the screenshots data and that might be the cause.

@pikonha
Copy link
Author

pikonha commented Sep 29, 2021

7.13

@vigneshshanmugam
Copy link
Member

I see, The reason you are seeing the issue is because we have changed the logic around how the screenshots are stored and constructed on the synthetics and also on the UI side. You would need to move to same version 7.15 or 7.14 of Kibana. You can read the details here - #285

PS: Screenshots occupies a huge space so instead of a blob of data, we split them in to smaller chunks to help with caching documents on the Elasticsearch side and then reconstruct them on the UI.

@pikonha
Copy link
Author

pikonha commented Sep 30, 2021

Alright @vigneshshanmugam, I'm going to do that and get back to you if I need something. Thanks for everything so far.

@pikonha pikonha closed this as completed Sep 30, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants