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

    alert-chef-12385

    10/01/2022, 5:26 PM
    Hello, I'm trying to use cypress to test my flask application and encountering unexpected session persistence issue. Anyone would like to check for reason and try to help me? What do I do: 1. goto https://lubomir.mlich.cz/flasktest/ 2. login link is displayed as I'm not logged in. I'll get my session created by clicking on it. 3. create project form is displayed, I enter project name and submit form 4. Project added successfully message is displayed This works well in browser manually. But step 4. is not working with cypress and I can see resulting page which says that session is invalid instead. Is it possibly some cypress-cookie persistence issue?
    • 1
    • 3
  • l

    limited-agency-13286

    10/01/2022, 5:39 PM
    Hello everyone, I am new to cypress. I want to write a custom command that return the text in the element that I send as parameter. I help would be appreciated. Thanks
  • a

    alert-chef-12385

    10/01/2022, 5:46 PM
    Hi Ash, would:
    Copy code
    cy.get('input[placeholder="Enter new project name"]').type('ProjectNo1')
    be something you are searching for? I choose input where to type by placeholder, maybe you want different criteria to find element you want to write to?
  • l

    limited-agency-13286

    10/01/2022, 5:49 PM
    Hi thanks for the reply. But not exactly. My use case is if I provide a class or id name of an element as parameter then my custom method should return context in that particular class or id element
  • a

    alert-chef-12385

    10/01/2022, 5:59 PM
    would this work for you?
    Copy code
    cy.get('.test').first().contains('hello')
  • l

    limited-agency-13286

    10/01/2022, 6:01 PM
    This work when I know the content in the element. How about a dynamic content scenario. I want get this value and stored in a variable and assert it in the later scenario steps
  • a

    alert-chef-12385

    10/01/2022, 6:07 PM
    maybe simple variable assigment will do? However I'm not sure now if there is not some special way in cypress to do it:
    Copy code
    var for_later_use = cy.get('.test').first()
  • l

    limited-agency-13286

    10/01/2022, 6:09 PM
    I agree I can do that. Thanks. If I have a custom command it would be clean code instead of write like this all the time. Like var context= cy.getContent(‘.test);
  • l

    limited-agency-13286

    10/01/2022, 6:11 PM
    I had another question if anyone facing this issue. I have a big feature file with almost 170 steps divided into 5 scenarios. When I run all together all of sudden my cypress runner blank away and showing a white screen. Anyone facing this kind of issue? Am using 7.6.0 version
  • s

    stale-optician-85950

    10/01/2022, 7:04 PM
    The latest Cypress version is 10.9.0, that's approximately 50 releases ahead of the version you are using (7.6.0). It would be better for everyone if you upgraded to the latest version before deciding if further help was required.
  • s

    stale-optician-85950

    10/01/2022, 7:28 PM
    Copy code
    Cypress.Commands.add('returnElementText', element => {
      cy.get(element).invoke('text');
    });
    Then call in the test as:
    Copy code
    it('Best test ever', () => {
          cy.returnElementText('[data-testid="unique-selector"]').then($elText => {
            cy.log('$elText', $elText);
          });
        });
  • l

    limited-agency-13286

    10/01/2022, 7:30 PM
    Thanks you. In our organization repository we have only 7.6.0 they are working and bring in 10.9.0. Once it available will update.
  • m

    mysterious-belgium-25713

    10/01/2022, 8:29 PM
    You are using the run all spec command right. If the screen blanks out then it runs out of memory. You should set the numTestsKeptInMemory to a lower value. Default value is 50 tests but if you have 5 scenarios with 170 steps it keeps all that in memory. So I think best value would be have 2 specs in memory or not use the run all. If you need to run all specs just use cypress run command instead
  • l

    limited-agency-13286

    10/01/2022, 8:39 PM
    Thanks will try that
  • t

    tall-salesclerk-21702

    10/01/2022, 8:46 PM
    Hi folks. I have to make sure that element doesn't exist ever. Are there any solutions besides should(not.exist)?
  • g

    great-answer-57072

    10/02/2022, 5:55 AM
    I found the answer that
    npx cypress run
    is removed in version 10 and above for now. Use
    npx cypress run --browser chrome
    to solve my problems to run tests headlessly.
  • a

    acceptable-tailor-43291

    10/02/2022, 9:01 AM
    Hi all, I read this blog which can be used to store user credentials in env variables. https://glebbahmutov.com/blog/keep-passwords-secret-in-e2e-tests/ We can pass single test user credentials using env variable. But I need help in finding a way to store multiple user credentials in one place. Then for user A I want to run few test cases and for user B I want to run few other tests suites. How could I do that?
  • l

    limited-agency-13286

    10/02/2022, 12:46 PM
    Hi team, I have use case when I submit my form I have a loader it will appear till the service call return response. How can I make sure that loader is show up and gone. I try with first assert as present then following with. Not.visible(). Is there any better way to handle loader/spinner scenarios?
  • m

    mysterious-belgium-25713

    10/02/2022, 5:00 PM
    Isn't it just a better solution to give the Env users different names. Not just username. Call it User_Bob: his username User_Bob_Password: his password And then just call the Cypress.env('User_Bob') This way you also use personas and not just username and password. This can also help you structure your testcases where in the IT or Describe you mention which user you are using for the test.
  • d

    dazzling-pillow-26039

    10/02/2022, 5:54 PM
    Use .env file and add all usernames and passwords in there. You can also have multiple files and pass the file based on test cases. Later add all these under secrets when running in CI/CD. You can also use this package to make it a bit easier but not mandatory. https://www.npmjs.com/package/cypress-dotenv
  • d

    dazzling-pillow-26039

    10/02/2022, 5:54 PM
    Also do not commit .env file to type repository
  • v

    victorious-queen-73209

    10/03/2022, 6:55 AM
    Hello
  • v

    victorious-queen-73209

    10/03/2022, 7:05 AM
    Can anybody help me out for code coverage thing?
  • l

    little-magazine-63211

    10/03/2022, 11:30 AM
    Hi not able to break line when using writeFile for filling .txt file every time it just adds to previous text in the same line suggestions?
  • r

    ripe-shampoo-28033

    10/03/2022, 11:34 AM
    Hey folks, can anyone help shed some light on how the
    Cy.Intercept
    works under the hood please? I've been reading the docs and I don't understand how it is possible for Cypress to change it's url to match the origin of the application: > After the first cy.visit() command is issued in a test, Cypress changes its URL to match the origin of your remote application, thereby solving the first major hurdle of same-origin policy. Your application's code executes the same as it does outside of Cypress, and everything works as expected. https://docs.cypress.io/guides/guides/web-security#Limitations In my example, I am running cypress tests locally but pointed at a dev environment URL with the Intercept method bypassing my login, but unsure how this can be working / bypass CORS? Much appreciated
  • g

    gray-kilobyte-89541

    10/03/2022, 2:23 PM
    cy.intercept or cy.visit?
  • p

    proud-dinner-80271

    10/03/2022, 2:32 PM
    Hi, when I try to login I get a cross origin issue, but just when I record the run. I'm testing a user journey so I don't want to test it with the intercept function What could I do in orden to avoid this problem?
  • b

    busy-airplane-16603

    10/03/2022, 2:42 PM
    Hi, urgent request... All our tests stop running in parallel since Friday. I have received emails regarding to plan upgrade. Is there anyone who can assist me to verify my plan and help answering questions on upgrades? Thanks!
  • g

    green-diamond-44130

    10/03/2022, 2:43 PM
    Hi, does someone know how to make cucumber scenario run only on specific days with cypress ?
  • m

    mysterious-belgium-25713

    10/03/2022, 2:54 PM
    Can you elaborate more what you mean with on specific days. Do you mean schedule your tests to run on a certain day, wouldnt you just setup your CI/CD system to run specific specs on certain days?
1...112113114...192Latest