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

    handsome-dress-30825

    07/18/2022, 10:11 AM
    Hi everyone I am having a strange issue
  • g

    green-flag-2140

    07/18/2022, 11:40 AM
    Hello, how can I get or filter cypress elements via css style?
  • g

    gray-kilobyte-89541

    07/18/2022, 2:10 PM
    https://on.cypress.io/best-practices#Selecting-Elements and https://glebbahmutov.com/cypress-examples/commands/querying.html
    g
    • 2
    • 2
  • l

    limited-lawyer-57746

    07/18/2022, 2:32 PM
    Hey, I have the following code for cy.session and Auth0. Wondering if I'm using cy.session correctly here. My thinking is after the initial login, I should be able to use the existing session completed in the beforeEach for subsequent tests. Is this wrong or am I missing something? I'm also running into an issue with tests on chrome being flaky, sometimes I'm able to successfully login to my app and view the dashboard, other times I get redirected again to login
    Copy code
    // commands.js
    Cypress.Commands.add('login', (email, password, { cacheSession = true } = {}) => {
      const args = { email, password }
      Cypress.log({
        name: 'loginViaAuth0',
      });
      const login = () => {
        cy.visit("/auth/login")
        cy.origin('https://myDomain.us.auth0.com', {args}, ({ email, password }) => {
          cy.get('[id=organizationName]').type("orgNameHere")
          cy.get('button').contains('Continue').click()
          cy.get('[id=username]').type(email)
          cy.get('[id=password]').type(password)
          cy.get('[name=action]').click()
      })
      }
      if (cacheSession) {
        cy.session('login', login)
      } else {
        login()
      }
    })
    
    // test.spec.ts
    describe("home page tests", () => {
      beforeEach(() => {
        cy.login(Cypress.env("auth_username"), Cypress.env("auth_password"));
        cy.visit("/app/dashboard");
      });
    
      it("should navigate to dashboard manage sets", () => {
        cy.wait(3000);
        cy.get("div").contains("drawer1").click();
        cy.get("div").contains("Manage Sets").click();
        cy.get("p").contains("Select Set to Login");
      });
    
      it("should navigate to dashboard manage sets", () => {
        cy.wait(3000);
        cy.get("div").contains("drawer2").click();
        cy.get("div").contains("Manage Sets2").click();
        cy.get("p").contains("Select Set to Login2");
      });
    });
  • g

    green-flag-2140

    07/18/2022, 4:14 PM
    Best Practices | Cypress Documentation
  • e

    early-computer-34425

    07/19/2022, 6:18 AM
    yo, is it cypress commands I should use if I want to do a task that is going to be done in several different tests?
  • q

    quick-helicopter-52253

    07/19/2022, 7:57 AM
    I can't get
    blockHosts
    working in Cypress 10.3.0 - am I handling something wrong?
    Copy code
    const { defineConfig } = require("cypress");
    
    module.exports = defineConfig({
      e2e: {
        setupNodeEvents(on, config) {
          // implement node event listeners here
        },
        baseUrl: 'http://X.myshopify.com',
      },
      env: {
        SHOPIFY_THEME_ID: 'X',
      },
      blockHosts: [
        '*.google-analytics.com',
        '*google-analytics.com',
        '*.ipgeolocation.io',
        '*ipgeolocation.io',
      ]
    });
    • 1
    • 1
  • q

    quick-helicopter-52253

    07/19/2022, 8:21 AM
    I can t get
    blockHosts
    working in
  • w

    wooden-teacher-96595

    07/19/2022, 10:24 AM
    has anyone set up testing with rabbitmq in their suite?
  • a

    adventurous-afternoon-66082

    07/19/2022, 11:13 AM
    Hellos!! I am doing a PoC using Cypress for my application my application includes iFrames.....When I click a submit button in iFrame, a new table suppose to be loaded within iframe but the application is getting logged out after clicking the submit button Can anyone help me with this issue i notice that the application is getting logged out while the iframe is reloaded.. your help would be appreciated
  • c

    cuddly-orange-98458

    07/19/2022, 11:41 AM
    Post Cypress 10 migration i am unable to maintain session across spec files ? Anyone knows any solution Earlier i was using cypress-localstorage-commands package to restore caches.
  • c

    cuddly-orange-98458

    07/19/2022, 11:44 AM
    The issue is only coming when i use cypress run and not in case of cypress open
  • w

    wonderful-salesclerk-27570

    07/19/2022, 11:44 AM
    Hello. I'm trying to test an eccomerce website with different viewports. Basically for mobile- the product listing should have 2 collumns of products, and for bigger viewports or desktop- 3 collumns. https://www.gintarine.lt/akcijos-4
  • w

    wonderful-salesclerk-27570

    07/19/2022, 11:45 AM
    the problem for me is that the product listing is probably in CSS grid?
  • w

    wonderful-salesclerk-27570

    07/19/2022, 11:45 AM
    cy.get('.product').should('have.length', 3)
  • w

    wonderful-salesclerk-27570

    07/19/2022, 11:45 AM
    cypress counts all of the products 😐
  • w

    wonderful-salesclerk-27570

    07/19/2022, 11:46 AM
    how do i count only the collumns, or only the products in the top row??
  • b

    brash-ghost-16880

    07/19/2022, 1:51 PM
    I am trying to use a file download option in cypress. So in the website which i click the export button it downloads a pdf file. In cypress i have installed the download file plugin and then added the required code in command.js ( require('cypress-downloadfile/lib/downloadFileCommand')) and in config.js ( const {downloadFile} = require('cypress-downloadfile/lib/addPlugin') module.exports = (on, config) => { on('task', {downloadFile}) } ) now in the test file when i click on the button i should see the file downloaded in the download folder right? or i am missing something?
  • c

    cuddly-orange-98458

    07/19/2022, 3:19 PM
    Can Anyone Help on how can i share localstorage across specs in cypress ?
  • a

    adamant-rose-16948

    07/19/2022, 3:23 PM
    I’m new to cypress, and I’m trying to create test cases for a website. I’m running into an issue where whenever I get an element, it scrolls it to the top of the screen, so they are often covered by the navigation bar and then I am unable to run any .click or .type commands. I can use force:true to make them work, but I don’t want to skip over all the tests. Anyone have some advice?
  • f

    famous-restaurant-30435

    07/19/2022, 3:31 PM
    > I’m running into an issue where whenever I get an element, it scrolls it to the top of the screen Can you elaborate on this or provide a screenshot / screen recording?
  • a

    adamant-rose-16948

    07/19/2022, 3:48 PM
    This is the error message I get, I just need a way to when I use .get to get an element, to have it scroll the element to the center of the screen rather than to the top (where it ends up being covered by other elements)
    f
    • 2
    • 6
  • w

    wonderful-salesclerk-27570

    07/19/2022, 4:53 PM
    any suggestions how can i count grid-template-columns in cypres ?
  • m

    melodic-account-9605

    07/19/2022, 5:22 PM
    Good morning, I have a UI question -- I'm not sure what Cypress is trying to tell me. I'm running a test where I'm stubbing out a graphql endpoint, and my test seems to render okay. But it always hangs here at the end. What is this blue referring to? At first I thought the GraphQL request doesn't return and it's waiting, but I have
    cy.wait('@GraphQL')
    at the beginning of the test, and it moves past that just fine. It stays here forever and never moves onto the next test.
    f
    • 2
    • 3
  • w

    wonderful-salesclerk-27570

    07/19/2022, 5:39 PM
    i see that the css attribute is changing with different viewports. How do i test this in cypress? grid-template-columns: repeat(2,1fr) is not listed in inspect elements. Its an attribute of .category-products__cards
    m
    • 2
    • 8
  • w

    wonderful-salesclerk-27570

    07/19/2022, 5:40 PM
    cy.get('.category-products__cards').should have grid-template-columns: repeat(2,1fr) ???? ive hit a dead end with this one lads 😄 please help out
  • s

    square-smartphone-88014

    07/19/2022, 8:01 PM
    hi! beginner tester here!! I am trying to test a chrome extension that i wrote, which injects a react application onto https://calendar.google.com. when using cy.visit("https://calendar.google.com") it redirects to google login screen. does anyone know how to automatically login to google and visit calendar.google.com?
  • s

    square-smartphone-88014

    07/19/2022, 8:02 PM
    i have tried following these steps with no sucess: https://docs.cypress.io/guides/end-to-end-testing/google-authentication
  • f

    famous-restaurant-30435

    07/20/2022, 12:57 AM
    Theres a lot going on here. First off, using this selector pattern is a bad idea. You dont want to traverse the dom at all if you dont have to. Your better option is to have a UI dev add a data-cy or data-testid attribute to the dom node you are trying to access so you can get to it directly. I genuinely suggest you take some time to go over Cypress best practices for selecting dom nodes. https://docs.cypress.io/guides/references/best-practices#Selecting-Elements https://www.capocaccia.dev/posts/testSelectors
  • r

    rhythmic-agency-74865

    07/20/2022, 12:58 AM
    Thanks for your reply
1...111112113...252Latest