Open przedab opened 1 year ago
Hello @YOU54F,
A little update from my side:
I was able to send the screenshot's artifacts URL with the CI_JOB_URL variable to the custom-text option with this pattern:
--custom-text=\"- Check <given_1_url|reports> from the tests execution.\n- Check <$CI_JOB_URL/artifacts/browse/cypress/screenshots|screenshots> from the failing tests (if there were!).\"",
But still, it will be a good improvement to create automatically screenshot links from pattern like this:
screenshot-dir=$CI_JOB_URL/artifacts/file/cypress/screenshots
What about a block functionality? Is it ready to use?
Hey bud,
Kinda, half-baked, I don't know when I'll get round to finishing it off.
The new cli is here
https://github.com/YOU54F/cypress-plugins/blob/master/cypress-slack-reporter/src/index.ts
which uses the https://github.com/raycharius/slack-block-builder to support building blocks
the slack client calls a messageConstructor which supports customBlocks
You are welcome to use the code as inspiration and build it out. The slack-block-builder project is really nice to work with
I've not released it yet as a package, I can't remember what needed to be finished on it, sorry it's been a good while since I last worked on it
Hello @YOU54F , I'm trying to send a custom Slack message with some links to screenshots. I did some tries but could not get a result as expected. Can you help me with it?
1 Screenshots generated from the screenshot-dir option with the wrong custom-url:
npx cypress-slack-reporter --useOnlyCustomUrl --vcs-provider=none --ci-provider=custom --custom-url=$CI_PIPELINE_URL/ --screenshot-dir=cypress/screenshots --report-dir=cypress/reports --only-failed --verbose --custom-text='DONT WORRY ITS JUST A TEST'
Results: The Test Report button points to the correct pipeline URL from the GitLab pipeline(but I need to point to the job URL, not the pipeline URL), and screenshot links are created with the wrong pattern. - OK like this: https://gitlab.com/xxxxx/qat/video-outstream-automation/-/pipelines/981281470/cypress/screenshots/playerFunctions.feature/Video%20Outstream%20player%20functions%20tests%20--%20Check%20that%20video%20is%20rendered%20with%20different%20vast%20versions%20vast2%20(example%20#1)%20(failed)%20(attempt%202).png
2. Screenshots generated from screenshot-dir option:
npx cypress-slack-reporter --useOnlyCustomUrl --vcs-provider=none --ci-provider=custom --custom-url=$CI_JOB_URL/ --screenshot-dir=artifacts/file/cypress/screenshots --report-dir=cypress/reports --only-failed --verbose --custom-text='DONT WORRY ITS JUST A TEST'
Logs:
Results: The Test Report button is pointing to the correct job URL from GitLab pipeline, but links are not created at all:
3. Screenshots generated from the screenshot-dir option with $CI_JOB_URL:
npx cypress-slack-reporter --useOnlyCustomUrl --vcs-provider=none --ci-provider=custom --custom-url=$CI_PIPELINE_URL/ --screenshot-dir=$CI_JOB_URL/artifacts/file/cypress/screenshots --report-dir=cypress/reports --only-failed --verbose --custom-text='DONT WORRY ITS JUST A TEST'
Logs:
Results: The Test Report button points to the correct pipeline URL from GitLab pipeline, 'screenshotDirectory' in logs points to the correct screenshots dir, but links are not created at all. The same as above:
4. Add a $CI_JOB_URL link to the custom text: npx cypress-slack-reporter --useOnlyCustomUrl --vcs-provider=none --ci-provider=custom --custom-url=$CI_PIPELINE_URL/ --screenshot-dir=$CI_JOB_URL/artifacts/file/cypress/screenshots --report-dir=cypress/reports --verbose --custom-text='Check https://sorry-cypress-dashboard.dev-itx5.itx5.eqtv.dev/video-outstream-automation/runs|sorry-cypress-dashboard Check <$CI_JOB_URL/artifacts/browse/cypress/screenshots|Screenshots> for failing tests'
Results: Variable $CI_JOB_URL is not resolved: