https://cypress.io logo
Join Discord
Powered by
# help
  • e

    enough-fireman-4779

    12/07/2022, 10:36 AM
    hello once again... i have a question.. I have a table with multiple links... and i want to choose a random one every time... i'm using this code(see below), but sometimes it fails on the "click()" and i don't understand why... it's not happening always... is there any work around to click random links?
    Copy code
    ChooseRandomShop() {
            cy.get('table [href]').then( myLinks => {
                const randomLink = Cypress._.sample(myLinks)
                cy.wrap(randomLink).click()
            })
  • s

    strong-chef-89202

    12/07/2022, 11:28 AM
    Hi again, I am wondering if there is a way to setup global state before running each test. In my case this state is readonly, so it would suffice to set it up once and reuse it later. The global state consists of loading a file (a keepass database to be exact) to retrieve usernames and passwords from. Currently I am running the following in the
    beforeEach
    phase:
    Copy code
    typescript
    cy.fixture(pathToDB, null).then((rawData) => {
        // Some cursed-voodo magic to get the data as an ArrayBuf
        const buf = Cypress.Buffer.from(rawData);
        const database = new Uint8Array(buf).buffer;
        cy.fixture(pathToPassword).then((password: string) => {
            Keepass.loadDatabase(database, password);
        });
    });
    While this works, I feel like I am missing something to initialize it globally once. I tried the
    support/e2e.ts
    but that did not work. Is there a better way to do this?
  • l

    lemon-wall-91819

    12/07/2022, 11:30 AM
    Hello, I am needing of some help 🙂 I have tried out cypress and love it. Is there a way of changing the file locations cypress is pointing to as I am now looking to put it into a repo and can't see a way to repoint the locations or uninstall cypress
  • l

    lemon-wall-91819

    12/07/2022, 11:35 AM
    I am using a mac at the moment, it is just the case of deleting all the files in the folder it is pointing to ?
  • g

    gray-kilobyte-89541

    12/07/2022, 11:38 AM
    what does it say when it fails?
  • g

    gray-kilobyte-89541

    12/07/2022, 11:39 AM
    can you initialize it once? and the tests don't update anything in it?
  • g

    gray-kilobyte-89541

    12/07/2022, 11:40 AM
    https://on.cypress.io/installing-cypress
  • n

    nutritious-artist-49849

    12/07/2022, 11:48 AM
    After the upgrade i was able to switch different origin but i have an issue with payment since cypress by default cleared all the session data the values are not added in the API request
  • s

    strong-chef-89202

    12/07/2022, 12:05 PM
    Id like to avoid having to restate it for every test file, or is there a way to share beforeEach behavior across files? When I try to use the class in another spec, it is not initialized, and therefore does not work.
  • g

    green-jordan-14676

    12/07/2022, 12:13 PM
    Hello. Anyone kindly help in loading issue.
  • f

    fresh-doctor-14925

    12/07/2022, 12:17 PM
    Hi, you've bumped this a couple of times now. Please don't keep doing this; it just adds noise. Your question in its current form is too broad and vague. Take a look at #763097415896268840 for some tips to make it easier for one of us volunteers to answer
  • e

    enough-fireman-4779

    12/07/2022, 12:30 PM
    everytime is different.. it finds the href in the previous step, but when it comes to "click()" boom
  • c

    careful-quill-5790

    12/07/2022, 12:51 PM
    Hello Everyone! I recently started using Cypress for one of my projects. We had some changes in the frontend which involved the introduction of webcomponents via lit elements. It also heavily relies on slots. I need to update some tests involving checking if some components are rendered on the right place. Like this:
    Copy code
    <my-custom-element>
        #shadow-root
            <ul>
                <li data-testid="id-a">
                    <slot name="slot-a" />
                </li>
                <li data-testid="id-b">
                    <slot name="slot-b" />
                </li>
            </ul>
        <a slot="slot-b" class="looking-for-this" />
    </my-custom-element>
    
    cy.get('my-custom-element').shadow().find('[data-testid="id-b"]').???
    My goal would be checking if element "a" with class "looking-for-this" is properly rendered under data-testid="id-b". Unfortunately I couldn't find a way to query the assigned nodes to data-testid="id-b". Cypress seems only able to find the empty slot. Do you think is there any workaround? Any help would be greatly appreciated!
  • o

    orange-portugal-35791

    12/07/2022, 1:08 PM
    Guys, Cypress's SSO certificate has expired and I don't have a non-SSO account to update the certificate. I was guided to create a new organization and then add it to my original one, but how would I do that? Regards,
  • a

    adorable-stone-42197

    12/07/2022, 1:09 PM
    We upgraded Cypress to 11.2.0 version and during the build Jenkins tells us the 8.7.0 version is used. Is it necessary to change that version somewhere else so that it does not constantly use the old version?
  • g

    gray-kilobyte-89541

    12/07/2022, 2:07 PM
    i think your table re-renders and the old href element is no longer valid
  • f

    full-postman-68262

    12/07/2022, 2:16 PM
    Hey team. Wonder if anyone can help. We currently use Cypress for a suite of API tests, and at the moment, I'm logging out the requests and responses as they happen in the tests, so that I've got something to read through in a bit more detail when I'm digging into test failures. However, the suite has grown so large that I think the constant logging is causing some performance degradation in the container. What I would ideally like to do is to store these logs in a string array, and then only actually log them out on test failure. Ideally I'd like to do this using
    Cypress.on
    to tap into events on
    run:start
    and
    fail
    to handle printing and clearing the array, but it seems like
    console.log
    doesn't do anything within
    Cypress.on
    , and
    Cypress.log()
    only prints out to the browser console instead of the container stdout. Does anyone have any suggestions for ways I could figure out how to print to stdout in
    Cypress.on
    or just other ideas of how I could handle this type of logging without having to add
    beforeEach
    and
    afterEach
    hooks to every test just to handle this?
  • b

    big-waitress-61452

    12/07/2022, 3:06 PM
    Guys, How to run cypress UI (Browser) without need opened electron GUI? The QA needs open cypress UI (Browser) running inside WSL2, but the configuration to open electron GUI it's so complicated...
  • f

    fresh-doctor-14925

    12/07/2022, 3:25 PM
    There isn't a way to set this in the UI, but you can run a command like so
    npx cypress open --e2e --browser electron
  • m

    mysterious-belgium-25713

    12/07/2022, 3:42 PM
    Don't the latest version of wsl2 that you can get from the Microsoft Store have build in wslG. So you can open gui apps without issues
  • d

    dry-scooter-25612

    12/07/2022, 4:07 PM
    As you are colleagues I am making an automated process of password recovery, I have 2 Script the first runs and sends the recovery link to this public inbox: https://www.mailinator.com/ the second Script, is to perform the entire process of changing password, I have the 2 functional detail is that the URL sent to the mail, that process I do manually that is to copy that url and place it in my script and; that the process continues normally. I have tried to do it in many ways but I don't know how, could you give me an orientation?
  • e

    enough-truck-68085

    12/07/2022, 5:42 PM
    !duplicate
  • n

    nutritious-analyst-96582

    12/07/2022, 5:42 PM
    Uh oh, It looks like you have posted the same question in multiple channels. Help us prevent spam by removing any duplicates of your questions, Thanks! 😀
  • t

    thousands-gpu-36872

    12/07/2022, 8:57 PM
    hello Guys ! It´s possible to ignore the before (hook) just in one specific test in the same archive ?
  • g

    gray-kilobyte-89541

    12/07/2022, 8:58 PM
    you could probably look at the current test's name (inside the before hook) and use
    return
    to skip, but I would think this would make the code harder to understand
  • t

    thousands-gpu-36872

    12/07/2022, 9:00 PM
    In this case im using a cy.login() in a beforeEach(). Maybe it´s better to remove then and use a cy.login inside the it´s ?
  • b

    brave-river-4142

    12/07/2022, 9:13 PM
    Hi guys, how can I get a pseudo element? This is span its actually a checkbox and the ::after its check symbol (using the version 9.7.0)
  • e

    enough-truck-68085

    12/07/2022, 9:18 PM
    So you want to call
    cy.login()
    in every test but one? Am I understanding that? If so can you just organize your tests using
    describe
    hooks so that only the tests that need login inherit that setup while other tests share a different setup?
  • t

    thousands-gpu-36872

    12/07/2022, 9:20 PM
    that's exactly it, thanks for the tip
  • l

    loud-park-10778

    12/07/2022, 9:23 PM
    Hey guys, so the problem im having is that im trying to make a delete request but it requires the token to authorize, how can i get the bearer token? relatively new at this, any help would be mostly appreciated !
1...223224225...252Latest