Grafana k6 || HTTP POST Call - Part2

Поделиться
HTML-код
  • Опубликовано: 25 янв 2025

Комментарии • 8

  • @lucanapoli9291
    @lucanapoli9291 8 месяцев назад

    amazing !!! thanks!

  • @GopikrishnanGovindaraj
    @GopikrishnanGovindaraj 9 месяцев назад +1

    Thanks for the reply. The page was really helpful.
    My another concern is, is there any way to capture the url of the page and passing it to another test file ? (here my url will be dynamic)

    • @ABAutomationHub
      @ABAutomationHub  8 месяцев назад

      Yes, using cy.url() you can handle it..
      Example :
      1). For the Other Test File, you can either wrap or write to a file. Below is the sample code with the writeFile solution.
      Test1:
      =======
      describe('Test for multiple urls', () => {
      it('Fetch url and save it to the file', () => {
      cy.visit('naveenautomationlabs.com/opencart/')
      .get('[title="MacBook"]').click()
      .url().then((urlvalue) => {
      cy.writeFile('cypress/fixtures/url.json', { url: urlvalue });
      });
      });
      })
      Test2:
      ========
      describe('Fetch URL from Test1', () => {
      it('pass URL from fixture file', () => {
      cy.fixture('url').then((urlValue) => {
      cy.visit(urlValue)
      })
      });
      });

  • @RamishaFaheem-pv3fc
    @RamishaFaheem-pv3fc 8 месяцев назад +1

    Hi Anshita, Im new to k6, i have used the same code on gorest dummy POST api and have passed the bearer token in params as well, theres no error in the code but its returning 401 but same api is working on postman, can u help

    • @ABAutomationHub
      @ABAutomationHub  8 месяцев назад

      Make sure that the token is correct. Check out the sample code for the GoRest API here: github.com/Anshita-Bhasin/k6_examples/blob/main/post-go-rest-api.js

    • @RamishaFaheem-pv3fc
      @RamishaFaheem-pv3fc 8 месяцев назад +1

      @@ABAutomationHub Hello, noticed i was passing the token directly in params constant without putting it in headers. Thank you for replying, this helped

  • @GopikrishnanGovindaraj
    @GopikrishnanGovindaraj 9 месяцев назад

    Hi, I'm new to cypress automation. Here I have a concern like is it possible to capture the text from one test case and pass it to compare it in another test case ? I'm awaiting for your reply.

    • @ABAutomationHub
      @ABAutomationHub  9 месяцев назад +1

      Yes, it is possible to do it. You can check out
      the detailed code here : github.com/Anshita-Bhasin/Cypress_Examples/blob/main/cypress/e2e/findText.cy.js
      medium.com/@anshita.bhasin/how-to-get-element-text-in-cypress-71c68814d20