Reusable commands in Cypress || Write Generic Functions - Part - 14

Sdílet
Vložit
  • čas přidán 15. 07. 2024
  • In this video, I have explained how to create generic functions and commands in Cypress and how to use them in your test spec.
    Cypress provides a feature to write your generic functions in commands.js file which will be loaded first before your tests and the same function can be called in your test by Cypress.
    Git Repo for all Cypress Examples:
    github.com/naveenanimation20/...
    ~~~Subscribe to this channel, and press bell icon to get some interesting videos on Selenium and Automation:
    czcams.com/users/Naveen%20Au...
    Follow me on my Facebook Page:
    / naveenqtpexpert
    Let's join our Automation community for some amazing knowledge sharing and group discussion on Telegram:
    t.me/joinchat/COJqZUPB02r5sB7...
    Paid courses (Recorded) videos:
    naveenautomationlabs.com/reco...
    For Java & Selenium - naveenautomationlabs.com/selen...
    For API (Manual + Automation) - naveenautomationlabs.com/manua...
  • Věda a technologie

Komentáře • 24

  • @shabbyguy4334
    @shabbyguy4334 Před 4 lety +1

    Once again Naveen, Brilliant! Well explained, to the point and always daily common used examples. Can't wait for the next upload, keep up the awesome work!!!!!

  • @maheshkalagatta5364
    @maheshkalagatta5364 Před 3 lety +1

    Thanks @Naveen AutomationLabs. We could gain much knowledge on Cypress and related topics. Could you please make more videos on Cypress API and also on Framework part

  • @AlanMartinez-yk7dm
    @AlanMartinez-yk7dm Před 2 lety

    Thanks Bro !!! big help

  • @ozankurucu6261
    @ozankurucu6261 Před rokem

    Thanks!

  • @muslimaadil3590
    @muslimaadil3590 Před 4 lety

    Hello Naveen, when do you start the API class? I'd like to sign up.

  • @Johnny-pt5jb
    @Johnny-pt5jb Před 3 lety

    Should we use custom commands instead of POM?

  • @TechTutorialz99
    @TechTutorialz99 Před 2 lety

    very helpful session. I am facing issue (test runner is closing immediatly), pls let me know how not to exit from test runner

  • @varshapatil2458
    @varshapatil2458 Před 3 lety

    Hey Naveen, How to check if has ?

  • @rcrider43210
    @rcrider43210 Před 2 lety

    **I am Trying to draw rectangular shape on canvas in Cypress Automation, but it is not allowing to do so. All we need to click and hold from one diagonal point and drag& drop let's say from (1,1) to another coordinate point(2,2). Then our task would be done.
    Note: But the problem here is the source element point (1,1) is not any element it's just a point on canvas and if we hold this value in ILocation interface then we cannot use any drag and drop plugin because in drag arguments the source & target parameter should be element string.
    Have used the below trigger code also but this also did not work for me.
    export function drawRectangle(start: ILocation, size: number): any {
    //'start' is the mid point of coordinate
    // size is 100
    const source = {x: start.x, y: start.y}
    const dest= {x: start.x + size, y: start.y + size }
    cy.get('.div.canvas-container').click(source.x, source.y).as('sourcePoint');
    cy.get('@sourcePoint'). trigger ("mousedown", {force:true})
    cy.get('.div.canvas-container').trigger ("mousemove", {source, dest}, {force:true})
    cy.get('.div.canvas-container').click(dest.x, dest.y).as('destPoint');
    cy.get('@destPoint'). trigger ("mouseup", {force:true})
    }

  • @shreyasjain9891
    @shreyasjain9891 Před 2 lety

    Do we need to import the cypress in command.js file like below:
    import cypress from "cypress"
    because I am getting error : The following error originated from your test code, not from Cypress.
    > cypress is not defined.
    If I use the import function then I am getting errors too in node_modules folder,
    If I remove this command the code is running without any issue
    what should I do to resolve it, either way, I am getting errors if I use import or without import call.
    please help

  • @sumitpaul8585
    @sumitpaul8585 Před 3 lety

    I see that after execution of 1st it block, it automatically signout from the page. 2nd and 3rd it block, again sign in button is displayed.

  • @kairunbee1914
    @kairunbee1914 Před 2 lety

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

  • @amolnawale2177
    @amolnawale2177 Před 4 lety

    Hi Naveen, instead of hard coded values of email and password, can we read them from some config.properties file or some excel file?

  • @BhagatSingh-mh4og
    @BhagatSingh-mh4og Před rokem

    @Naveen Bhaiya, As i seen in your video that we dont need to login again & again for every 'it' block so you have used before function but sir cypress has removed this function in version above 12, how we can achieved this feature ? please reply bhaiya.

    • @prakashajay8405
      @prakashajay8405 Před rokem +1

      @Naveen, I am also looking this info.
      Instead of logging in again and again I want to login only once then other tests should continue. Though I put Login code in before(), my test is not continuing .

  • @deven7722
    @deven7722 Před 4 lety

    Hello Naveen. i stuck one scenario.. i want to run 2000k scripts parrallel execution for nightly build.
    one script takes around average 3 mins.. can you pleas guid me how to handle this kind issues
    Available resources:- selenium, java, testing, maven, jenkins, git
    OR anybody can help me if possible

  • @maheedharkolipakula9222
    @maheedharkolipakula9222 Před 4 lety +1

    Sir I need to practice in eclipse.it's possible or not