https://cypress.io logo
Join DiscordCommunities
Powered by
# e2e-testing
  • v

    victorious-honey-34966

    09/12/2022, 5:04 PM
    I have added assertion, same problem
  • l

    little-address-70980

    09/12/2022, 6:11 PM
    Hello, I am new to Cypess and trying to build a POC of end to end tests using Cypress for a web portal at work. I have a very basic question, how can I create test data required for few e2e test scenarios by calling APIs ? I need the data to be persisted in the db so mocking would not work in my situation. It would be really helpful if someone could point me to any articles or examples to learn about it. Thanks in advance!
  • s

    stale-optician-85950

    09/12/2022, 7:27 PM
    Putting Cypress aside for a moment. If your application has endpoints you can hit to create test data i.e POST user details to create a new user account: Ask your developers for these endpoint details (URLs, methods, body data etc), and first get it working in Postman, so that you understand what you are doing. Then move back to Cypress and code it using the
    cy.request()
    command https://docs.cypress.io/api/commands/request Also @gray-kilobyte-89541 has a video on the topic

    https://www.youtube.com/watch?v=CBQdo-22jzQ▾

  • e

    eager-london-10753

    09/12/2022, 7:27 PM
    Hello Team! I integrated cypress-test-rail reporter with cypress and i get this error when i trigger the tests. Can anyone help me resolve this? Error loading the reporter: cypress-testrail-reporter We searched for the reporter in these paths: - /Users/manoharadepu/Dev/cypress-bdd/cypress-testrail-reporter - /Users/manoharadepu/Dev/cypress-bdd/node_modules/cypress-testrail-reporter
  • g

    gray-kilobyte-89541

    09/12/2022, 7:32 PM
    Postman always rings twice...
  • l

    limited-barista-33480

    09/12/2022, 11:04 PM
    hello greetings, someone has worked implementing AWSIoT and MQTTClient in cypress the idea is to simulate the publication of a message and a topic to a web environment. Currently I do it manually using MQTT fx and I have to automate it in cypress with JavaSript. And what configuration is needed to upload it to a server with an SSL certificate?
  • g

    great-beard-98693

    09/13/2022, 8:05 AM
    not sure if I understand, but it shoudn't matter where you put the cypress folder. you need to deploy the app somehow, and cypress will just send requests to it
  • h

    handsome-lion-1748

    09/13/2022, 8:39 AM
    Hi, I have a question related to pipelines on gitlab, our project is in 2 repos (back and front ends) so is it possible for me build the app on say gitlab pipeline and run cypress tests?
  • h

    handsome-lion-1748

    09/13/2022, 8:46 AM
    I think I'm looking for something like this https://stackoverflow.com/questions/32995578/how-to-access-multiple-repositories-in-ci-build I'm checking it
  • d

    damp-kangaroo-1521

    09/13/2022, 9:00 AM
    Hi, I have problem with run test from specific folder. I have e2e folder, and in e2e is second folder MOBILE. I want run tests only from mobile folder. I add "npm run cy:mobile" but doesn't work. Have u idea?
  • s

    stale-optician-85950

    09/13/2022, 9:17 AM
    npx cypress run --spec "cypress/e2e/mobile/*.cy.js"
  • d

    damp-kangaroo-1521

    09/13/2022, 9:19 AM
    Copy code
    Missing baseUrl in compilerOptions. tsconfig-paths will be skipped
    Can't run because no spec files were found.
    
    We searched for specs matching this glob pattern:
  • s

    stale-optician-85950

    09/13/2022, 9:21 AM
    npx cypress run --spec "cypress/e2e/mobile/*"
    It's difficult to give precise help without seeing your folder structure.
  • s

    stale-optician-85950

    09/13/2022, 9:23 AM
    Documentation is here https://docs.cypress.io/guides/guides/command-line look for the
    --spec
    examples.
  • d

    damp-kangaroo-1521

    09/13/2022, 9:35 AM
    I tried it. I can't see answer for my question in the documentation 😦
  • s

    stale-optician-85950

    09/13/2022, 10:04 AM
    So your folder name is different to what you posted in the original message, and the command will depend on what you have inside of
    mobile-iOS
    Have you tried
    npx cypress run --spec "cypress/e2e/mobile-iOS/*"
  • d

    damp-kangaroo-1521

    09/13/2022, 10:31 AM
    ah sure, I forgotten change folder name. It work, lovely thanks!
  • s

    stale-optician-85950

    09/13/2022, 10:40 AM
    @damp-kangaroo-1521 You should consider using tagged tests rather than folders for specific groups, as outlined by @gray-kilobyte-89541 here https://glebbahmutov.com/blog/tag-tests/ but that's your own choice.
  • n

    nice-horse-33158

    09/13/2022, 1:17 PM
    Hi @agreeable-scooter-87343 , did your problem start with the Salesforce Winter 23 update? Have you managed to resolve it? I have the same problem, whenever use cy.visit, Cypress left pane is disappearing. already tested: experimentalModifyObstructiveThirdPartyCode, modifyObstructiveCode, toggle Cypress/Node version, viewport... but all without success
  • p

    polite-jordan-30716

    09/13/2022, 3:11 PM
    hi all, can you recommend me a way to assert whether a element contains a substring? It contains a bunch of text and I would like to assert whether it contains a specific sentence. expect($element.text()).to.include.text('expected text') expect($element.text()).to.contain.text('expected text') expect($element.text()).to.have.text('expected text') all seem to fail -> because it uses have text and expects only the expected text to be in the element
  • g

    gray-kilobyte-89541

    09/13/2022, 3:15 PM
    https://on.cypress.io/contains
  • p

    polite-jordan-30716

    09/13/2022, 3:16 PM
    In that case, do I just assert whether the element is found with the given text?
  • l

    little-address-70980

    09/13/2022, 4:14 PM
    We use keycloak IAM to authenticate API requests, for some reason I could no succeed connecting to keycloak to get the access token needed to make API calls. I tried the following 1) cy.request() which is replicating the way we fetch the access token in Postman and it throws 415 error as cypress does not allow passing a header section in cy.request() 2) cy.exec() to replicating the way we fetch the access token from cmd and it does not work either 3) Also stumbled upon cypress-keycloak plugin but could not get it working.
  • g

    gray-kilobyte-89541

    09/13/2022, 4:28 PM
    I would read the command's doc page and the examples. And if you need more examples, see https://glebbahmutov.com/cypress-examples/commands/querying.html
  • s

    stale-optician-85950

    09/13/2022, 7:02 PM
    What did you mean by "cypress does not allow passing a header section in cy.request()"? You can of course pass headers, here's a small example from my own cy.request():
    Copy code
    cy.request({
       method: 'GET',
       url: uniqueUrl,
       headers: {
          Authorization: Cypress.env('BASIC_AUTH'),
       },
    }).then(({ status }) => {
       expect(status).to.eq(200);
    });
    https://docs.cypress.io/api/commands/request#Arguments "headers | null | Additional headers to send; Accepts object literal"
  • l

    little-address-70980

    09/13/2022, 7:03 PM
    Yea I just realized that I missed to read the doc fully, I could send the headers and could resolve the connectivity issue. Thank you @stale-optician-85950
  • s

    stale-optician-85950

    09/13/2022, 7:04 PM
    Good man, well done 👏
  • b

    brief-toddler-73066

    09/13/2022, 8:13 PM
    Help Migrating from 9.7 to 10.7 please Running in gitlab CI/CD pipeline, test passes on 9.7 but in 10.7 errors: "Cypress could not verify that this server is running: https://:1443" We're running a docker container cypress/included:10.7.0 I'm new to docker AND cypress so I just need help knowing which needs adjusting. I can't see anything port specific in the migration documentation.
  • a

    ancient-island-31170

    09/14/2022, 12:08 PM
    hello! can anyone help me on the thing i wanted to achieve!!! i do have a menu list:
    Copy code
    export const Menu = [
        {
          id: 1,
          title: "Home",
          link: "/",
          children: [],
        },
        {
          id: 2,
          title: "Consultants",
          link: "#",
          children: [
            { childTitle: "Find a Doctor", childTo: "/consultant/doctors" },
          ],
        },
        {
          id: 3,
          title: "Services",
          link: "/services",
          children: [
            {
              childTitle: "Clinical Laboratory",
              childTo: "/services/laboratoryservices",
            },
          ],
        },
        {
          id: 4,
          title: "Packages",
          link: "/packages",
          children: [],
        },
      ];
    and i want to check the links by going to the page and checking the url which matches with the list or not. the code i wrote is:
    Copy code
    const menus = Menu;
    
    context("Nav items test", () => {
      beforeEach(() => {
        cy.visit("/");
      });
    
      it("should redirect to the expected pages", () => {
        cy.get(".navbar-nav>li>a[href!='/#']").each((links, index) => {
          cy.wrap(links).click();
          cy.url().should("contain", links[0].href);
        });
    });
    if i do it manually then it is working:
    Copy code
    cy.get('[data-cy=nav-item]').contains('About').click()
                        cy.url().should('include', '/about/')
  • f

    flaky-airport-12178

    09/14/2022, 1:15 PM
    Hi team, Please help me check why I got this error
1...100101102...192Latest