https://cypress.io logo
Join Discord
Powered by
# general-chat
  • n

    numerous-kangaroo-93739

    01/20/2022, 8:29 PM
    and creating user guides so there is that
  • r

    rich-lamp-44536

    01/20/2022, 8:30 PM
    what do you mean by
    a const
    ? or just
    Copy code
    ts
    const x = 'a'
    cy.get('input').type(x)
  • n

    numerous-kangaroo-93739

    01/20/2022, 8:31 PM
    well mine looks like const {username, password} = cy.task('getSecrets')
  • n

    numerous-kangaroo-93739

    01/20/2022, 8:31 PM
    its the get task from a plug in that is getting me aws seceret manager. but when I .log at the end i am seeing the text getting filled out but its not taking it for some reason
  • r

    rich-lamp-44536

    01/20/2022, 8:32 PM
    I sadly don't know what
    cy.task
    is 👀 Never used that 🤔
  • n

    numerous-kangaroo-93739

    01/20/2022, 8:33 PM
    yea I am kinda stuck on it as well.
  • n

    numerous-kangaroo-93739

    01/20/2022, 10:18 PM
    const {username, password} = cy.task('getSecrets') cy.visit('https://....') cy.get('#username').click() cy.get('#username').type(username) So the test fails telling me type only takes a string or numbers but when const runs it assigns them the correct username and password... am i suppose to code this differently?
  • f

    fancy-match-96032

    01/20/2022, 10:48 PM
    Have you tried wrapping your .visit and .gets in a .then()? Like cy.task(‘getSecrets’).then((username, password) => { ….
  • n

    numerous-kangaroo-93739

    01/20/2022, 11:17 PM
    Hmm I will have to try it
  • g

    gray-kilobyte-89541

    01/21/2022, 3:37 PM
    please look at cy.task documentation https://on.cypress.io/task - it has a lot of examples, and in your case you must use
    .then
    to get the result from the task
  • n

    numerous-kangaroo-93739

    01/21/2022, 3:56 PM
    Thank you everyone, actually was able to accomplish it with @User input.
  • n

    numerous-kangaroo-93739

    01/21/2022, 3:56 PM
    just got it to run and pass actually like 15 min ago
  • f

    fancy-match-96032

    01/21/2022, 7:13 PM
    @User for some more context about the issue you were seeing, check out this doc on handling return values from
    cy
    commands https://docs.cypress.io/guides/core-concepts/variables-and-aliases#Return-Values
  • f

    few-carpenter-48515

    01/22/2022, 5:16 PM
    I need to perform test cases on testing environment that is protected by a token on cookie. I am trying setting the cookie in global before(() => cy.setCookie(...)) hook but it doesn't seems to works very stable, also the cookie often got changed.
  • f

    few-carpenter-48515

    01/22/2022, 5:16 PM
    Is there any way to do that for all the requests in all suites?
  • b

    bulky-sundown-74498

    01/22/2022, 5:17 PM
    Absolutely, use the beforeEach function in the support file
  • b

    bulky-sundown-74498

    01/22/2022, 5:18 PM
    The support file will be loaded above any spec file run in cypress
  • f

    few-carpenter-48515

    01/22/2022, 5:20 PM
    yes, this was what I did, also added
    beforeEach(() => Cypress.Cookies.preserveOnce('stasesstok'))
    but I see in the debugger a lot of sets and removes of this cookie.
  • b

    bulky-sundown-74498

    01/22/2022, 5:28 PM
    Oh! Then you might simply want the before function
  • f

    few-carpenter-48515

    01/22/2022, 5:40 PM
    I'd think, it could be because of the apache's mod_session which seems to have an issue and send's Cookie header twice, it could be an issue then with the overrides
  • f

    few-carpenter-48515

    01/22/2022, 5:40 PM
    do the cy.request() benefit from the cookie set by cy.setCookie() ?
  • b

    bulky-sundown-74498

    01/22/2022, 5:41 PM
    Do you use the experimental session support ?
  • b

    bulky-sundown-74498

    01/22/2022, 5:42 PM
    session | Cypress Documentation https://docs.cypress.io/api/commands/session#Syntax
  • u

    user

    01/22/2022, 6:02 PM
    I would like to try to use cypress to find untranslated strings in my app. Untranslated strings are easily spotted in my app since they have special symbols added to them to indicate that they're untranslated. I was thinking I could extend my existing test suite to continuously look for these symbols as the test walks through the app. So: Is there a way to tell cypress to make these type of checks generally? For example (pseudo code):
    Copy code
    ts
    it('does things', () => {
        cy.get(".open-dialog-button").click();    
        cy.get(".dialog").get(".close-button").click();
        cy.get(".toggle-something").click();
    });
    afterEachAssertion(() => {
       cy.findByText(untranslatedTextIndicator).should("not.exist");
    });
    const untranslatedTextIndicator = "_*#¤_";
    I know I could add these assertions manually at every stage of an expected visual change of my test suites, but I would like to avoid that if possible. Preferably this should be automated.
  • f

    fancy-match-96032

    01/22/2022, 9:00 PM
    @User one option could be to wrap the ‘should’ command by overwriting it, so the new ‘should’ could make the assertion you’re talking about if appropriate, then pass the element along its way to the actual .should . The behavior would be invisible to anything invoking .should. Check out this page in the docs for more info about overwriting https://docs.cypress.io/api/cypress-api/custom-commands
  • l

    loud-monitor-58963

    01/24/2022, 2:44 AM
    Hello all! Relatively new to cypress and using v.7.0.0. The app I'm trying to test allows a form to be filled in and submitted. When submitted, I am caching information from various fields. When another form is submitted during that session, I detect the presence of session data autofill the 2nd form and hide fields that are prefilled from the previous form submission. The problem: Apparently cypress starts with a fresh environment on subsequent get(). Therefore the behavior is wrong (i.e., the 2nd form is treated as though the anonymous user has never logged in). Is there a way to retain the session? I see some experimental session support on V8. But, 1) it is experimental. 2) I'm running v7.x
  • a

    adorable-smartphone-87280

    01/25/2022, 4:04 PM
    Is there a reason you don't just use the latest version? We are using the (experimental) session support in production and it's great.
  • a

    astonishing-apple-58598

    01/31/2022, 8:57 PM
    Quick question, I'd be so grateful if someone knows the answer, Is there a way to configure Slack notifications to only report Cypress failures on one branch? We are getting notifications on Slack for every PR and it's muddying up our Slack channel.
  • f

    fancy-match-96032

    01/31/2022, 10:13 PM
    @User this isn't currently supported, but makes sense to have it. i'll pass the idea along to our product team. edit: this (along with other slack integration improvements) are already being tracked, but not currently worked on.
  • a

    astonishing-apple-58598

    01/31/2022, 11:15 PM
    Thank you! Our organization would be thrilled about this addition.
1...272829...127Latest