Cypress Beginner Tutorial 11 | HTML Reports | Solution - Unexpected token � in JSON at position 0

แชร์
ฝัง
  • เผยแพร่เมื่อ 21 พ.ย. 2024

ความคิดเห็น • 137

  • @emmimagilbert3850
    @emmimagilbert3850 2 ปีที่แล้ว

    Taqqqq sir .... 😍😍 As a fresher ...this is very useful to me ... 😍

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Most welcome

  • @paulc2317
    @paulc2317 ปีที่แล้ว +2

    I think you don't need to type the word "run" inside the script execution line e.g.: "test": "npm run cypress" , and the again when you invoke the execution "npm run test", instead "npm test" would be enough. Also, a shortcut for the "Clear" DOS command is "clr"
    cheers

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hi Paul, thanks for adding

  • @fatemamotiwala8554
    @fatemamotiwala8554 7 หลายเดือนก่อน

    Thank you for the videos. It a very detailed step by step process, so very easy to understand and follow.

    • @RaghavPal
      @RaghavPal  7 หลายเดือนก่อน

      You're very welcome Fatema

  • @fatemamotiwala8554
    @fatemamotiwala8554 7 หลายเดือนก่อน +3

    I was stuck at rimraf, as it was deleting the folder but it gave an error invalid path for any files *.json or *.*. So, modify the command as "pretest": "rimraf ./cypress/report/*.json --glob", --glob helps it to identify the *sign. Hope it helps if someone is facing same issue

    • @RaghavPal
      @RaghavPal  7 หลายเดือนก่อน

      Thanks for posting Fatema.. I am sure this will help many

  • @vitaliyovcharenko4991
    @vitaliyovcharenko4991 2 ปีที่แล้ว

    Thank you Raghav! It would be great if you add to this video some info about adding screenshots to mocha html report. It is very helpful feature allowing to see the problem point.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      I will plan on this

  • @lisazhou7776
    @lisazhou7776 2 ปีที่แล้ว

    I follow your cypress tutorials. It is great. I am doing this test in work now. can you create how to debug cypress video

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Sure, I will Lisa

  • @slobodanparizoski6869
    @slobodanparizoski6869 ปีที่แล้ว

    If someone is facing any issues using the rimraf -r command to delete json report files form the previous test runs, just use this in "pretest":
    "pretest": "cd (relative path to your reports folder) && del *.json"
    In my case it was: "pretest": "cd ./cypress/report/mochawesome-report && del *.json"
    I came up with this after trying all other possible solutions which did not resolved the issue. And this worked for me.

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Thanks for adding Slobodan, I will help others

  • @erickdeazevedoalcantara7989
    @erickdeazevedoalcantara7989 8 หลายเดือนก่อน

    Awesome, thanks for your explanation.
    Greatings from Brazil.

    • @RaghavPal
      @RaghavPal  8 หลายเดือนก่อน

      Most welcome Erick

  • @goccuakhanh142
    @goccuakhanh142 4 หลายเดือนก่อน

    Thank you so much! This video is very helpful for me

    • @RaghavPal
      @RaghavPal  4 หลายเดือนก่อน

      You're very welcome

  • @deepaksingh2411
    @deepaksingh2411 3 ปีที่แล้ว

    Great video sir. ❤️
    I had a question, how you use windows on your Mac device? Is it some virtual machine or boot camp you use?
    Please suggest me which one is better?

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      It's a remote machine Deepak

  • @Dushyantsahu10
    @Dushyantsahu10 2 ปีที่แล้ว

    Awesome tutorial, Thanks Raghav
    Could you please guide me on how to deal with when the page doesn't have id available
    it has name, class and title

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Dushyant, I will try to add a session on this, For now can check some examples online

    • @Dushyantsahu10
      @Dushyantsahu10 2 ปีที่แล้ว

      @@RaghavPal I've tried so many online solution, that didnt help
      Still am trying the different methods available online, but eagerly waiting for your tutorial on iFrame handling
      Thanks :)

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      I will try to add

  • @xXMrThomasXx
    @xXMrThomasXx 4 หลายเดือนก่อน

    Awesome tutorial :D Thx :)

    • @RaghavPal
      @RaghavPal  4 หลายเดือนก่อน

      Glad it helped

  • @TebarAnutTirto
    @TebarAnutTirto ปีที่แล้ว

    Mr. Raghav thank you for the lesson ,but i still don t understand what is {script } for ?

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Tebar
      Please point the time in the video, so I can check

  • @mahedihasan2282
    @mahedihasan2282 2 ปีที่แล้ว

    Thank you very much .when the next series will come.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      As soon as possible Mahedi

    • @mahedihasan2282
      @mahedihasan2282 2 ปีที่แล้ว

      @@RaghavPal Waiting for your great videos

  • @narendranandhu5845
    @narendranandhu5845 3 ปีที่แล้ว

    Thank you, Raghav!
    Could you please tell me how to run a specific spec file instead of running all in the integration folder?... Thanks in advance

    • @narendranandhu5845
      @narendranandhu5845 3 ปีที่แล้ว

      Got it!... Could you please make a video on allure reports...

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว +1

      I will do

  • @nikhilgupta5721
    @nikhilgupta5721 2 ปีที่แล้ว

    One big limitation in Cypress report I can see is that it only gets generated after all specs ran, we can not see the reports in between the execution. Let's say you have a regression suite contains many specs and would like to see are they running fine or not we can see only at the last and in that way let's say something goes wrong then we have waisted that much amount of time waiting for it to get complete of execution, just only one way of monitoring console for pass and fail but observing report is satisfying.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Can use Cypress Dashboard

  • @amsofi
    @amsofi 2 ปีที่แล้ว

    Hi Raghav.first of all many thanks to your wonderful lessons. I am currently using cypress with BDD framework and I am running into an issue and do not know how to resolve. Kindly help me out. My applications works well with cypress framework but the data that involves lambda functions at the back end do not load when run from cypress. this happens only for the lambda calls. do you know what is blocking the data from displaying on the UI? any help on this is appreciated.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Sophia, will need to check the details, try checking some online examples

  • @samiRediAmaniTekeshAlazar
    @samiRediAmaniTekeshAlazar 2 ปีที่แล้ว

    what is the advantage of using testscript compared to using js file? why dont we use just js files throughout our test project?

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Hi, you can use JS only, TypeScript is a wrapper over JavaScript

  • @sasipriyakannan5742
    @sasipriyakannan5742 ปีที่แล้ว

    Hi..
    I'm working in cypress automation tool. I had a challenge in generating reports. I'm performing parallelization in cypress where I couldn't get consolidated html report for the test that has been executed in parallel. Can you please suggest?

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว +1

      Sasipriya
      To generate a consolidated HTML report for parallel tests in Cypress, you can use the following steps:
      1. **Install the mochawesome-merge package.**
      ```
      npm install mochawesome-merge
      ```
      2. **Create a script to merge the individual JSON reports into a single JSON report.**
      ```
      node mochawesome-merge [path/to/report1.json] [path/to/report2.json] ... > [path/to/merged.json]
      ```
      3. **Generate the HTML report from the merged JSON report.**
      ```
      npx mochawesome [path/to/merged.json] > [path/to/report.html]
      ```
      Here is an example of a script that you can use to merge the individual JSON reports into a single JSON report:
      ```
      #!/bin/bash
      # Get the list of JSON report files
      report_files=$(find . -name "*.json" -type f)
      # Merge the JSON report files into a single JSON report
      mochawesome-merge $report_files > merged.json
      ```
      Here is an example of a command that you can use to generate the HTML report from the merged JSON report:
      ```
      npx mochawesome merged.json > report.html
      ```
      This will generate a consolidated HTML report in the current directory.
      There is also a Cypress plugin called `cypress-parallel-mocha` that can help you to generate a consolidated HTML report for parallel tests. To use this plugin, you will need to:
      1. **Install the cypress-parallel-mocha plugin.**
      ```
      npm install cypress-parallel-mocha
      ```
      2. **Configure the cypress-parallel-mocha plugin in your Cypress configuration file.**
      ```
      // cypress/config/index.js
      const cypressParallelMocha = require('cypress-parallel-mocha');
      module.exports = {
      ...
      plugins: [
      cypressParallelMocha
      ]
      };
      ```
      3. **Run your tests in parallel.**
      ```
      npx cypress run --parallel
      ```
      The cypress-parallel-mocha plugin will generate a consolidated HTML report in the `cypress/reports` directory.
      I hope this helps

  • @shoonyakumari
    @shoonyakumari 5 หลายเดือนก่อน

    Hi Raghav, Thank you for sharing the knowledge and for your time spending for this videos. If possible could you please add the new video for reports using the latest versions because I am keep getting ERROR: Failed to merge reports Error: Pattern. Tried in online but not resolved.
    "cypress": "^13.9.0",
    "cypress-mochawesome-reporter": "^3.8.2",
    "mochawesome-merge": "^4.3.0"

    • @RaghavPal
      @RaghavPal  5 หลายเดือนก่อน

      Okay Shoonya.. There is also Cypress Masterclass on a newer version. Can check here - automationstepbystep.com/

    • @shoonyakumari
      @shoonyakumari 5 หลายเดือนก่อน

      @@RaghavPal Hi Raghav, Yes I watched all those 4 latest masterclass videos however reports not covered on those and suggest to watch this video only.
      TBH all your videos are very useful and able to do the basic frameworks from scratch.
      Just a request if possible please cover the latest reports, , window, alert popup messages to accepting cookies.
      (If i am not wrong in latest versions spec reports are creating by default and no need to merge anymore but please correct me if i am wrong).

    • @RaghavPal
      @RaghavPal  5 หลายเดือนก่อน

      ok, if i get sometime i will plan to create a new session for this

  • @Shahzilrind
    @Shahzilrind 3 ปีที่แล้ว

    Great video thanks

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Glad you enjoyed it Shahzil

  • @yashodharv5036
    @yashodharv5036 2 ปีที่แล้ว

    Thank you raghav, actually i am getting html report if am running the commands individually but when i am running it by keeping in package.json, i think it is not getting read, i am not getting the html file not the merged report file

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Yashodha, will need to check what exactly you are running in the script section of package.json, try some dummy command and see the syntax

  • @hayathbasha4519
    @hayathbasha4519 2 ปีที่แล้ว

    Hi sir,
    Can u pls let me know how to clear storage/cache before each cypress test file run

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Check this Hayath, stackoverflow.com/questions/46950668/does-cypress-clear-the-browser-cache-before-each-test

  • @YovelHadad
    @YovelHadad ปีที่แล้ว

    Hi Raghav.
    Can you make a tutorial for OAuth authentication of Application in UI ? 3-rd part side like google. Thank you

    • @YovelHadad
      @YovelHadad ปีที่แล้ว

      It will help a lot !

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว +1

      I will do

    • @YovelHadad
      @YovelHadad ปีที่แล้ว

      @@RaghavPal Thank you

  • @katharineponczoch1445
    @katharineponczoch1445 2 ปีที่แล้ว +1

    i downloaded the latest version of cypress. it did not automatically generate a cypress.json file. is it found elsewhere in the current version of cypress, or do i need to create it somehow?

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Hi Katharine, after you start cypress for the 1st time using command
      npx cypress open
      you should find the cypress.json file in the same folder where you ran the command

    • @ecatzkool7027
      @ecatzkool7027 2 ปีที่แล้ว

      @@RaghavPal
      I am getting the same. I installed cypress 10.4.0. I do not have a cypress.json file (looked through the whole dir) even after a ran npx cypress open. However, I do have cypress.config.js. I believe the content should be in this file since I see the watchForFileChanges here. But it seems that it is ignored (does not go into the reportDir folder and overwrite seems to be true). Here is the content of cypress.config.js. Am I missing something? Thanks.
      -----------------------------------------
      const { defineConfig } = require("cypress");
      const {downloadFile} = require('cypress-downloadfile/lib/addPlugin')
      module.exports = defineConfig({
      e2e: {
      watchForFileChanges: false,
      reporter: 'mochawesome',
      reportOptions: {
      charts: true,
      overwrite: false,
      html: false,
      json: true,
      reportDir: './cypress/reports'
      },
      setupNodeEvents(on, config) {
      // implement node event listeners here
      on('task', {downloadFile})
      },
      },
      });

    • @ecatzkool7027
      @ecatzkool7027 2 ปีที่แล้ว

      @@RaghavPal Realise my comment below is not to Raghav. Repost...
      I am getting the same. I installed cypress 10.4.0. I do not have a cypress.json file (looked through the whole dir) even after a ran npx cypress open. However, I do have cypress.config.js. I believe the content should be in this file since I see the watchForFileChanges here. But it seems that it is ignored (does not go into the reportDir folder and overwrite seems to be true). Here is the content of cypress.config.js. Am I missing something? Thanks.
      -----------------------------------------
      const { defineConfig } = require("cypress");
      const {downloadFile} = require('cypress-downloadfile/lib/addPlugin')
      module.exports = defineConfig({
      e2e: {
      watchForFileChanges: false,
      reporter: 'mochawesome',
      reportOptions: {
      charts: true,
      overwrite: false,
      html: false,
      json: true,
      reportDir: './cypress/reports'
      },
      setupNodeEvents(on, config) {
      // implement node event listeners here
      on('task', {downloadFile})
      },
      },

  • @pradipvaghela3179
    @pradipvaghela3179 2 ปีที่แล้ว

    hi,raghav in this video at the last minutes. why not run cypress command in test section. why are you put again cypress run command again in test section. if there any reason

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Pradip, pls mention the time, I will check

    • @pradipvaghela3179
      @pradipvaghela3179 2 ปีที่แล้ว

      @@RaghavPal hi,raghav, time is between 30 to 35.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      okay so in the test script I mentioned
      npm cypress run || npm run posttest
      Here the symbol || is used so that even if the 1st command (npm cypress run) fails i.e. even if any test fails, we still want to run the 2nd command (npm run posttest)

  • @deekshaa4243
    @deekshaa4243 2 ปีที่แล้ว

    Can you also show how to use Report Portal instead of Mochawesome reports

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      I will do Deeksha

  • @burgasHoH
    @burgasHoH 3 ปีที่แล้ว

    Nice one !

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Most welcome

  • @rockinhillbilly
    @rockinhillbilly ปีที่แล้ว

    Hi there, thank you for the wonderful tutorials.
    Regarding the end of the tutorial when we are using || and && in the scripts section of package.json, I could not get this to work. The posttest would run because the test script tells it to, but then the posttest would run, and effectively posttest would run twice. The first time it runs (via the test script) it creates the .json, with data, and then creates HTML file for report. However posttest then runs again (as it is programmed to always run after test), and then it runs the merge files command and overwrites the data in my .json file. It does not run the marge command, as we used &&, and the merge step failed.
    This is the only way I could get a .json file with data (note the test script stops after || .) -
    "scripts": {
    "pretest": "rm -r cypress/reports/*.json",
    "test": "npm run cy-test || :",
    "cy-test": "cypress run",
    "posttest": "npm run merge-reports && npm run html-report-gen",
    "merge-reports": "mochawesome-merge cypress/reports/*.json > cypress/reports/output20.json",
    "html-report-gen": "marge cypress/reports/output20.json --reportDir cypress/reports"
    },
    I would be curious to know how this works in your tutorial, if it does not work for me and I'm copying the exact code.
    Thanks :)

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      when you run test script, pretest and posttest will run before and after it, therefore we can adjust our commands accordingly in these scripts.
      You can modify them as per your needs

  • @hazimabdoh6303
    @hazimabdoh6303 2 ปีที่แล้ว

    dear Mr Raghav , i cant countinue see the complete result when execute the test command : npm run test , becuase the following result appeared and didint precceed to the next steps : [mochawesome] Report JSON saved to C:\CypressProjects\ReportsDemo1\cypress
    eports\mochawesome.json.
    any help please .thanks

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Hi Hazim, with these details I will not be able to know the reason, will need logs, Pls check all the steps again, Can check few online examples as well

    • @hazimabdoh6303
      @hazimabdoh6303 2 ปีที่แล้ว

      @@RaghavPal dear Mr Raghav , i try it again and get successtesting , after reinstall and reconfigure every thing related , thanks a lot

  • @prabhumishra3323
    @prabhumishra3323 2 ปีที่แล้ว

    How to send the report in mail to the team because the html files are dependent on assets folder

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      you can create an mhtml file and then send it OR
      use Cypress Dashboard and add all team members

  • @vineethpenki6247
    @vineethpenki6247 8 หลายเดือนก่อน +1

    ERROR: Failed to merge reports
    Error: Pattern .\\cypress\
    eports\\*.json matched no report files
    at C:\Users\2100289\cypress automation
    ode_modules\mochawesome-merge\lib\index.js:14:11
    at Array.map ()
    at C:\Users\2100289\cypress automation
    ode_modules\mochawesome-merge\lib\utils.js:3:46
    at merge (C:\Users\2100289\cypress automation
    ode_modules\mochawesome-merge\lib\index.js:84:17)
    at Object. (C:\Users\2100289\cypress automation
    ode_modules\mochawesome-merge\bin\mochawesome-merge.js:32:1)
    it showing error like this what it means could you please tell

    • @RaghavPal
      @RaghavPal  8 หลายเดือนก่อน

      Vineeth
      The error message you're seeing is related to the `mochawesome-merge` module, which is used to merge multiple Mochawesome JSON reports into one. The error message `Pattern .\\cypress\
      eports\\*.json matched no report files` indicates that the module is unable to find any JSON report files in the specified directory (`.\\cypress\
      eports\\`).
      This could be due to a few reasons:
      1. No report files exist: If no tests have been run, or if all tests have passed (depending on your configuration), no report files may have been generated in the first place
      2. Incorrect directory: The directory provided might not be correct. Ensure that the path specified is the one where the JSON reports are being generated
      3. Path format: The path format could be incorrect due to the use of different slashes. Try changing the slashes
      To resolve this issue, you could check the following..
      - Ensure that tests have been run and that they generate a report file.
      - Verify the directory path to make sure it points to the correct location of the report files.
      - Check your `mochawesome-merge` command and ensure it's correctly formatted
      .

    • @vineethpenki6247
      @vineethpenki6247 8 หลายเดือนก่อน

      Yeah thank u it’s working 🙏

  • @AbdulrahmanAbdelhamid
    @AbdulrahmanAbdelhamid ปีที่แล้ว

    Why do I get an error saying
    'unknown option: -r
    run 'rimraf --help' for usage information'
    when trying to run the pretest and how do I fix it?

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      The error message "unknown option: -r run 'rimraf --help' for usage information" usually occurs in Cypress when there is an issue with the command that you are trying to execute.
      The "-r" option is not a valid option for Cypress. It is possible that you have added this option to the Cypress command by mistake, or that it is specified in the configuration file.
      To fix this issue, you should check your Cypress configuration file (cypress.json) to see if the "-r" option is specified. If it is, remove it and try running the command again.
      If the issue persists, it could be that there is a problem with the way that the pretest command is being executed. In this case, you may need to review the script that is running the command and check that it is correctly invoking Cypress.
      It is also worth checking that you have installed all the necessary dependencies and packages for Cypress to run, such as Node.js, Cypress, and any plugins or extensions that you may need.
      If none of these solutions work, you can try reaching out to the Cypress community for further support or troubleshooting assistance.

  • @socalledvinoth
    @socalledvinoth 2 ปีที่แล้ว

    Hi Raghav
    i'm getting this error in mac machine
    command not found: out-file

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      will need to check on this Vinoth, pls check if you have followed all the steps

    • @socalledvinoth
      @socalledvinoth 2 ปีที่แล้ว

      @@RaghavPal i missed -
      Now, It's working fine.
      Thanks for your response.

  • @kairunbee1914
    @kairunbee1914 3 ปีที่แล้ว

    Hi is it possible in cypress to run
    1. Specs file in parallel
    2. It block in parallel

    • @RaghavPal
      @RaghavPal  3 ปีที่แล้ว

      Yes, ideally when we have option to run from command line, we can get do it, also check docs.cypress.io/guides/guides/parallelization#Splitting-up-your-test-suite

  • @vishnuvijayan6727
    @vishnuvijayan6727 2 ปีที่แล้ว

    hello raghav,
    the below command is not working for me in mac,
    npx mochawesome-merge cypress/report/mochawesome-report/*.json | out-file -encoding ascii cypress/report/output.json,
    zsh: command not found: out-file

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Vishnu, will need to check the error and logs, pls refer some examples and try

  • @brunoveiga9155
    @brunoveiga9155 11 หลายเดือนก่อน

    Hello Raghav. On 13:50, mine says: bash: out-file: command not found ERROR: Failed to merge reports. Do you know how I can fix this? It might be because I am doing it from a MacOs. Thank you.

    • @RaghavPal
      @RaghavPal  11 หลายเดือนก่อน

      Not very sure if that is the reason for this Bruno, can check some online examples

    • @brunoveiga9155
      @brunoveiga9155 11 หลายเดือนก่อน

      @@RaghavPal I solved it, thanks

  • @LeIsaiahsss
    @LeIsaiahsss 6 หลายเดือนก่อน

    it didn't generate any videos and screenshots for me when I ran the cypress test

    • @RaghavPal
      @RaghavPal  6 หลายเดือนก่อน

      Justin
      Let's address the issue with generating videos and screenshots in Cypress HTML reports
      1. Screenshots:
      - Cypress provides built-in support for taking screenshots during test execution.
      - To manually capture a screenshot, you can use the `cy.screenshot()` command in your test code.
      - By default, Cypress automatically captures screenshots when a test fails during `cypress run`.
      - Note that screenshots on failure are not automatically taken during `cypress open`.
      - You can configure the screenshots folder by setting the `screenshotsFolder` option in your `cypress.json` file⁵.
      - If you're not seeing screenshots, ensure that the configuration is correctly set and that the folder exists.
      2. Videos:
      - Cypress supports video recording for Chromium-based browsers (Chrome, Electron, Edge).
      - Video recording is disabled by default but can be enabled by setting `video: true` in your configuration.
      - During `cypress run`, Cypress records a video for each spec file.
      - Videos are not recorded during `cypress open`.
      - Videos are stored in the `videosFolder`, which is set to `cypress/videos` by default.
      - When using the `--record` flag, videos are processed, compressed, and uploaded to Cypress Cloud after each spec file run.
      - You can control video compression using the `videoCompression` option⁵.
      3. Troubleshooting Tips:
      - If you're still facing issues:
      - Look at the video recordings and screenshots.
      - Split large spec files into smaller ones.
      - Split long tests into smaller tests.
      - Run the same test using `--browser chrome` to check if the problem is isolated to the Electron browser.
      - Compare screenshots/videos between Electron and Chrome runs⁸.
      Remember to verify your configuration settings and ensure that the necessary folders exist

  • @sagark1556
    @sagark1556 ปีที่แล้ว

    I was facing an issue while merging
    Here is the problem statement
    ERROR: Failed to merge reports
    Error: Pattern cypress/reports/mocha/*.json matched no report files
    **Solved -
    changed the legacy command:
    from:
    mochawesome-merge cypress/reports/mocha/*.json > cypress/reports/report.json
    to:
    mochawesome-merge cypress/reports/mocha/*.json -o cypress/reports/report.json

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Thanks for adding Sagar. This will help others

  • @prassanasrinivas7397
    @prassanasrinivas7397 2 ปีที่แล้ว

    when i run npx cypress open am getting your pluginsFile is invalid plugins\index.js
    Unexpected token export in line 42 of index.js . any idea of what to change sir?
    please reply if someone knows it

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว +1

      Hi Prassana, check your plugins/index.js file and see what do you have at line no 42, sometimes it can be formatting issue too, Right click inside file and select Format Document and save and try

  • @syedghouse1696
    @syedghouse1696 2 ปีที่แล้ว

    Cypress reload causing blank page
    Can u pls advise alternative way for reload

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Syed, you can restart and check

  • @satyanarayanas6769
    @satyanarayanas6769 2 ปีที่แล้ว

    npm ERR! could not determine executable to run
    i got this error before step 6

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Can reinstall or use a diff version

  • @mehrunisa929
    @mehrunisa929 11 หลายเดือนก่อน

    There is no cypress.json file in my vs code why is it so and how can I get it ?

    • @RaghavPal
      @RaghavPal  11 หลายเดือนก่อน +1

      Mehru
      Here's why you might not have a cypress.json file in your VS Code project, and how to get it:
      1. New Cypress Project:
      Cypress doesn't automatically create a cypress.json file when you start a new project. You'll need to generate it manually.
      2. Older Cypress Version:
      In Cypress versions older than 9.0, the configuration file was named cypress.config.js. If you're using an older version, look for that file instead.
      3. Incorrect Project Structure:
      The cypress.json file should be located in the root directory of your Cypress project. If it's not there, it might be in a different location or not yet created.
      How to Get the cypress.json File:
      1. Manual Creation:
      Right-click in the root directory of your Cypress project in VS Code.
      Select "New File" and name it cypress.json.
      2. Cypress Command (Newer Versions):
      Open a terminal in your project directory.
      Run the command npx cypress open.
      This will launch Cypress and create a default cypress.json file if it doesn't exist.
      Once you have the cypress.json file, you can customize your Cypress configuration within it.
      Key Points:
      The cypress.json file is essential for configuring various Cypress settings, such as:
      Test files to run
      Base URL for tests
      Environment variables
      Browser preferences
      Plugins
      If you're using Cypress 9.0 or newer, you can also use a cypress.config.js file for configuration.

    • @mehrunisa929
      @mehrunisa929 10 หลายเดือนก่อน

      you are so helpful thank you so much. God bless you@@RaghavPal

  • @nicolasma7424
    @nicolasma7424 2 ปีที่แล้ว

    Hi Raghav, me again :) I don't see anything about Unexpected token � in JSON at position 0 in this video.. I'm trying to implement BrowsertStack in my testing solution but end up with this error message "SyntaxError: Unexpected token C in JSON at position 0". Any idea how to fix it ?
    I know you said you are going to create a video for BrowserStack and Jenkins but I saw this video's title and though it would help me :)
    Thanks for your help

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      I will check on this and update

    • @nicolasma7424
      @nicolasma7424 2 ปีที่แล้ว

      @@RaghavPal Thanks. Your video's title is "Solution - Unexpected token � in JSON at position 0" so I thought you were talking about it.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      I have this section in the video, pls check

    • @nicolasma7424
      @nicolasma7424 2 ปีที่แล้ว

      @@RaghavPal Is there ? Can you please point at the timestand ? I can't find it :/

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Pls check 12:43

  • @equalityx3376
    @equalityx3376 2 ปีที่แล้ว

    How to do this on vr

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      will need to check on this

  • @josecaceres3516
    @josecaceres3516 ปีที่แล้ว

    loveu

    • @RaghavPal
      @RaghavPal  ปีที่แล้ว

      Hope it helped Jose

  • @HHHorea
    @HHHorea 2 ปีที่แล้ว

    where is tutorial number 10? :)

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      find all here - automationstepbystep.com/

  • @dougm118
    @dougm118 6 หลายเดือนก่อน +1

    ascii is pronounced as-KEY sir not as-KAI. :). I'm listening to you and I'm
    like... what did he say?

    • @RaghavPal
      @RaghavPal  6 หลายเดือนก่อน

      Thanks for correcting Doug. will remember

    • @dougm118
      @dougm118 6 หลายเดือนก่อน

      @@RaghavPal Sure. Do you have any tutorials on using Cypress with an application within an iFrame? Unfortunately, the application I wanted to test is housed in an . I found various solutions from folks on StackOverflow but it is a shame that the Inspector from Cypress does not work to identify elements contained in an . I like your approach to breaking things down into simple steps and walking through some common online solution or your own would be helpful.

    • @dougm118
      @dougm118 6 หลายเดือนก่อน

      @@RaghavPal Also the e in echo is a short e sound like in the word bet, check, metal...Eh co not EE co. For Windows, use "pretest" : "del .\\path-to-json-files\\*.json". No need for rimraf. Also for a PC: "merge-reports": "mochawesome-merge mochawesome-report/*.json > out-file -encoding ascii output.json",
      Thank you for this helpful video.

    • @RaghavPal
      @RaghavPal  6 หลายเดือนก่อน

      not yet

  • @martinkazda2571
    @martinkazda2571 2 ปีที่แล้ว

    Hello. I have to say that your great guides really help me. But i have issue in this project. When i use run the pretest in form: "rm -r ./cypress/report/*.json". Test is stopped with message: rm: cannot remove './cypress/report/*.json': No such file or directory. Do you have any idea what is the reason fot that? When the .json file is in directory everything works fine. Thank you for your answer :).

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Martin, did you try this command separately, from the terminal, Also, in case of windows, use rimraf instead of rm

  • @vikum08
    @vikum08 5 หลายเดือนก่อน

    Hi Rahav
    When I am running 'npm run pretest' I am always getting this error "unknown option: -r"
    My code is - "pretest": "rimraf -r ./cypress/reports/*.json", and I already install "rimraf" too. Can you help me to resolve this issue plz?

    • @RaghavPal
      @RaghavPal  5 หลายเดือนก่อน

      Vikum
      Here are few things you can check for the issue with the "unknown option: -r" error when running `npm run pretest`.
      1. Incorrect Usage of `rimraf`:
      - The issue lies in the usage of `rimraf`. The `-r` flag is not valid for `rimraf`.
      - `rimraf` is used to delete files and directories, but it doesn't require the `-r` flag. Instead, it automatically handles recursive deletion.
      - To fix this, remove the `-r` flag from your script.
      2. Update Your Script:
      - Modify your `package.json` script to remove the `-r` flag:
      ```json
      "scripts": {
      "pretest": "rimraf ./cypress/reports/*.json"
      }
      ```
      - Now, running `npm run pretest` should work as expected.
      3. Run the Command:
      - After updating your script, execute `npm run pretest` again.
      4. Additional Notes:
      - If you encounter any other issues, ensure that you have the correct version of `rimraf` installed (`npm install rimraf --save-dev`).
      - Also, make sure that the path to your `.json` files is correct.
      Remember to remove the `-r` flag from your script, and your `pretest` command should work without any errors
      -

    • @vikum08
      @vikum08 5 หลายเดือนก่อน

      @@RaghavPal Thanks Raghav your comments highly appreciate it

  • @pradipvaghela3179
    @pradipvaghela3179 2 ปีที่แล้ว

    Hi, Brother. i facing access denied during the scripts in terminal using this -> npm run merge-report
    > mocha_report_prog@1.0.0 merge-report
    > mochawesome-merge ./cypress/reports/*.json > ./ report11.json
    Access is denied.
    can you please help me out whats needs to be require for this

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi Pradip, will need more logs to troubleshoot, Check all the steps and setup again

  • @aartiriat7590
    @aartiriat7590 6 หลายเดือนก่อน

    Hi @raghav,
    when i am trying to run the pretest at 28:00 using rimraf i am getting below error:
    > reportingproject@1.0.0 pretest
    > rimraf -r ./cypress/reports/*.json
    unknown option: -r
    run `rimraf --help` for usage information
    Can you please help?

    • @RaghavPal
      @RaghavPal  6 หลายเดือนก่อน

      Aarti
      The error message you're seeing is because `rimraf` does not recognize the `-r` option. The `rimraf` command is used to delete files and directories, and it does not require the `-r` option like the `rm -r` command in Unix-based systems.
      You should modify your script in the `package.json` file to remove the `-r` option. Here's how your script should look:
      ```json
      "scripts": {
      "pretest": "rimraf ./cypress/reports/*.json"
      }
      ```
      Now, when you run your pretest script, it should correctly delete all `.json` files in the `./cypress/reports/` directory without any errors. If the directory itself needs to be deleted, you can specify the directory without the `/*.json`:
      ```json
      "scripts": {
      "pretest": "rimraf ./cypress/reports"
      }
      ```
      This will delete the `reports` directory itself. Please try
      --

    • @aartiriat7590
      @aartiriat7590 6 หลายเดือนก่อน

      @raghav: thanks a ton

  • @vighneshmane2080
    @vighneshmane2080 9 หลายเดือนก่อน +2

    to remove the json files the command rm is not recognized,
    ------------------------------------------------------------------------------------------------
    > project1@1.0.0 pretest
    > rm -r ./cypress/reports/*.json
    'rm' is not recognized as an internal or external command,
    operable program or batch file.
    -----------------------------------------------------------------------------------------------
    even if i use rimraf
    --------------------------------------------------------------------
    > project1@1.0.0 pretest
    > rimraf -r ./cypress/reports/*.json
    unknown option: -r
    run `rimraf --help` for usage information
    ---------------------------------------------------------------------
    please help me out anyone

    • @RaghavPal
      @RaghavPal  9 หลายเดือนก่อน +1

      If someone is facing any issues using the rimraf -r command to delete json report files form the previous test runs, just use this in "pretest":
      "pretest": "cd (relative path to your reports folder) && del *.json"
      In my case it was: "pretest": "cd ./cypress/report/mochawesome-report && del *.json"
      this worked for me.

  • @mahasakka2594
    @mahasakka2594 6 หลายเดือนก่อน

    HELLO,
    how can I correct this issue ?
    npx mochawesome-merge ./cypress/reports/*.json > ./cypress/reports/output.json
    >>
    ERROR: Failed to merge reports
    Error: Pattern > matched no report files
    at D:\Cypress\Project 1
    ode_modules\mochawesome-merge\lib\index.js:14:11
    at Array.map ()
    at D:\Cypress\Project 1
    ode_modules\mochawesome-merge\lib\utils.js:3:46
    at merge (D:\Cypress\Project 1
    ode_modules\mochawesome-merge\lib\index.js:84:17)
    at Object. (D:\Cypress\Project 1
    ode_modules\mochawesome-merge\bin\mochawesome-merge.js:32:1)
    at Module._compile (node:internal/modules/cjs/loader:1480:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1564:10)
    at Module.load (node:internal/modules/cjs/loader:1287:32)
    at Module._load (node:internal/modules/cjs/loader:1103:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:168:12)

    • @RaghavPal
      @RaghavPal  6 หลายเดือนก่อน

      The error message you're encountering indicates that the `mochawesome-merge` command failed to merge the reports due to a pattern matching issue. Let's address this step by step:
      1. Pattern Matching Issue:
      - The error specifically states: "Error: Pattern > matched no report files."
      - This means that the pattern you provided (`./cypress/reports/*.json`) did not match any report files in the specified directory.
      2. Solution:
      - To resolve this, let's adjust the command to ensure that it correctly identifies the report files.
      - Instead of using `>` (which is not a valid pattern), use `*` to match all JSON files in the `./cypress/reports/` directory.
      - Here's the corrected command:
      ```
      npx mochawesome-merge ./cypress/reports/*.json > ./cypress/reports/output.json
      ```
      3. Additional Considerations:
      - Make sure that the `./cypress/reports/` directory contains the expected JSON report files.
      - Verify that the file names follow the pattern you're using (e.g., `report1.json`, `report2.json`, etc.).
      4. Version 4 Update:
      - If you're using version 4 of `mochawesome-merge`, note that it no longer accepts the `--reportDir` option.
      - Instead, specify a list of file paths or glob patterns directly (separated by spaces).
      - For example:
      ```
      npx mochawesome-merge ./cypress/reports/mocha/*.json > ./cypress/reports/output.json
      ```
      Try the corrected command, and it should successfully merge the reports into the `output.json` file

  • @musikaphtv6727
    @musikaphtv6727 2 ปีที่แล้ว

    Hi Raghav, I tried this activities and I got this
    PS D:\Cypress\Project1> npx cypress run --reporter mochawesome
    'chcp' is not recognized as an internal or external command,
    operable program or batch file.
    Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19) at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    {
    errno: -4058,
    code: 'ENOENT',
    syscall: 'spawn cmd',
    path: 'cmd',
    spawnargs: [
    '/c',
    'WMIC path win32_process get Name,Processid,ParentProcessId,Commandline,ExecutablePath'
    ]
    }
    Error: spawn cmd ENOENT
    at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19) at onErrorNT (node:internal/child_process:480:16)
    at processTicksAndRejections (node:internal/process/task_queues:83:21)
    Please help me.

    • @RaghavPal
      @RaghavPal  2 ปีที่แล้ว

      Hi, this can help stackoverflow.com/questions/8142058/chcp-is-not-recognized-as-an-internal-or-external-command-operable-program-or