Part 28 - Cypress - Using cy.task() - Read Data from (EXCEL | DATABASE) | Run Commands on Node Env

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

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

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

    Yup, the most awaited one :) Thanks for this!! Awesome & Nice clarity!!!

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

    Thanks... Due to this I finally could solve my issue...thankuuu

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

    Hi, Much information covered. what plug-in is required to read data from Excel, How to install it, this thing also should be covered in the video. does your shown code work in the latest cypress version?

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

    Most awaited video.. thanks . Pls start uploading Cypress interview topics like framework, API testing etc

  • @swastikdash722
    @swastikdash722 3 ปีที่แล้ว +4

    People who came here for data base connection can skip to 15:06

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

    @ QA Box Let's Test Hello can you please suggest if we want to maintain two excels and at runtime we want to decide excel based on some condition

  • @SnehaPatil-b9d
    @SnehaPatil-b9d 2 หลายเดือนก่อน

    Very helpful :) Sir, can you please make one video on OTP extraction or 2FA Gmail via Cypress, thanks in advance...!!

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

    Hey! I get the error message "The 'task' event has not been registered in the setupNodeEvents method. You must register it before using cy.task()" . Can you help me fix that problem?

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

    Hi, do you know how to upload .xlsx files to cypress if the upload button is not coming from an tag, but its a inside a ?

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

    I have connected cypress to db but for some reason my query is returning an empty array but if I run the same query in Microsoft sql then I get results. Any idea why?

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

      You can try changing query and if the outcome stays the same, then you might be using the library incorrectly. So, in such case watch every single bit of information shown in the video and try to mimic that. If still no success then post you complete code

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

    Hi, what plug-in is required to read data from Excel, How to install it, this thing also should be covered in the video.

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

    I am trying to find out how much space it takes on my build if I switch on the video: true (right now, it is false meaning that we are not recording the tests). How can I do that? Are you going to make any video on that?

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

      It depends upon number of spec files and tests in those spec files. You can also control the leve of compression. But telling exact size is contextual

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

    Is there way to connect DynaoDB?

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

    I am getting below error
    28 |
    29 | Cypress.Commands.add('readDataBasedOnTestCaseId', (testCaseId) =>{
    > 30 | cy.task('readXlsxData', testCaseId).then((data) =>{
    | ^
    31 | cy.log(data)
    32 | console.log(data)
    33 | })
    cy.task() must only be invoked from the spec file or support file.

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

    Great Video. I'm wondering where can i download the code for handling excel file with multiple sheets

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

      const xlsx = require("xlsx");
      function generateJSONFromExcel(agrs) {
      const wb = xlsx.readFile(agrs.excelFilePath, { dateNF: "mm/dd/yyyy" });
      const ws = wb.Sheets[agrs.sheetName];
      return xlsx.utils.sheet_to_json(ws, { raw: false });
      }
      In this code itself you can do this since sheet name is an argument.

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

      @@QABoxLetsTest Thanks for super quick reply. I appreciate it. Needless to say the Videos are immensely helpful. Thanks for spending time in creating these.

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

      @@QABoxLetsTest Hello could we create a video on this please. This would be very helpful

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

    Hi, Thangs for the great video. But I have a question. How can we keep our username and password protected and also avoiding it to upload to git repo.? Thanks in advance :)

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

      Store it in some kind of key vault and access it from there

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

      @@QABoxLetsTest thanks for the reply, any reference video available?

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

      Nope, but if you are on any could then use key vault service. For other areas like local machine and Jenkins please Google respective encryption solutions or credentials managers

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

      @@QABoxLetsTest how about while using it in local host Jenkins where is use bitbucket as source code which may not have cypress config while which i would have avoided pushing into repo. In that case how can i use it during execution?

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

    hi Please fix this, or set pluginsFile to false if a plugins file is not necessary for your project. i am getting this error.. while iam trying to export data from excel

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

    Hi , could you please suggest if we have multiple spec files so how we can declare excel file path in just one file and call it in other spec files

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

      Watch import export videos from my Nodejs basics series.

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

    hey, I cloned the repositery and just used the command npx cypress open, but it gives an error Error: Cannot find module 'cypress-plugin-snapshots/plugin'

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

      Anytime you clone a project you first have to install all its dependencies. Please first run npm install command and then do the rest.

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

    @QA Box Let's Test
    I am encountering an ETIMEDOUT error while setting up connection with remote DB
    Can you help with that?

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

      Please first try to connect with your remote db using some SQL clients like toad and then use the same config in this function. Your error has to do with incorrect config.

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

      @@QABoxLetsTest yes i have narrowed it down to that
      actually i am using tcp/ip over SSH in SQL client

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

    I downloaded your code from git repo and tried to run but getting following error:
    Error: Cannot find module '@percy/cypress/task'
    Idk what is wrong with the 'index.js' file. I would appreciate if you help me with this. I am focusing mainly to read & write data from Excel.

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

      Did you happen to run npm install post downloading the project from GitHub?

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

    Are we able to save the snapshot in word document using cypress ?

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

      Why not, just need to find an npm package to do so and rest of the logic remains the same

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

    Hi ,
    Could you please provide any information on how to integrate IBM DB2 database with cypress.
    We are using squirrel sql client and IBM DB2 driver to connect to database.

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

      Kindly refer to the following link
      dev.to/moyarich/how-to-connect-node-js-to-ibm-db2-database-16m6
      Once you create a method for this, rest remain the same as mentioned in this video.

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

    Hello , I have a problem, Error : no such file or directory, open

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

      Hey..that errors states path you have used is invalid.

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

      @@QABoxLetsTest Thanks

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

    Can you provide your data driven freamwork structure in cypress?

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

      th-cam.com/video/-hn5uKczmKw/w-d-xo.html

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

    Gr8

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

    Hi,
    Is it possible to edit an excel file using cypress?

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

      Hey..Cypress can work with excel the way shown in this video. Regarding editing an excel, the concept would remain the same.
      exceljs npm package does let you modify Excel spreadsheets.
      Here's an example of reading in an existing spreadsheet and writing it back out to a different file:
      var Excel = require('exceljs');
      var workbook = new Excel.Workbook();
      workbook.xlsx.readFile('old.xlsx')
      .then(function() {
      var worksheet = workbook.getWorksheet(1);
      var row = worksheet.getRow(5);
      row.getCell(1).value = 5; // A5's value set to 5
      row.commit();
      return workbook.xlsx.writeFile('new.xlsx');
      })

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

      @@QABoxLetsTest Thank you for this. Is it possible to do this using the sheetjs package?

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

      Yes, give it a try :-)

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

      @@QABoxLetsTest Tried adding cy.writeFile then then excel file cannot be opened :D

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

      That won't work.....Like I've mentioned above build your solution using cy.task and sheetjs package code

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

    hi sir i need help in cypreess

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

    Hello, I am getting synsql.mssql is not a function. Please can you help?

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

      Hello, have you installed and imported the mssql package as I mentioned in this video?

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

      @@QABoxLetsTest Yes using npm install mssql

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

      And what about import in plugins file?

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

      @@QABoxLetsTest Done as const mssql = require("mssql"); Please correct me if I am wrong.

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

      You are using wrong node module; for sync version you require sync-sql
      Then the import would be
      const syncSql = require("sync-sql")
      Hope that would fix your issue else please send me your complete code at qaboxletstest@gmail.com