https://cypress.io logo
Join Discord
Powered by
# react
  • b

    brave-doctor-62978

    12/08/2022, 3:51 PM
    Copy code
    import { PureComponent } from 'react';
    import PropTypes from 'prop-types';
    
    import SpriteIcon from 'shared/ui/SpriteIcon';
    
    import classnames from 'classnames';
    
    import 'profile/styles/profile.scss';
    
    
    export class PasswordCheck extends PureComponent {
      static propTypes = {
        ok: PropTypes.bool.isRequired,
        children: PropTypes.node,
      };
    
      render() {
        const className = classnames('password-check', { 'ok': this.props.ok });
    
        return (
          <div className={ className }>
            <SpriteIcon
              icon="checkmark"
              style={ { color: this.props.ok ? '#51a33d' : null } }
            />
            <span className="check-text">
              { this.props.children }
            </span>
          </div>
        );
      }
    }
    
    export default PasswordCheck;
  • e

    elegant-wire-18957

    12/09/2022, 3:57 PM
    I am having no joy in trying to get a create-react-app generating coverage using cypress - I have tried following this https://github.com/cypress-io/code-coverage/issues/461 - but i am not sure what i should be installing Cypress runs just fine when I run it locally but if i try use this package https://www.npmjs.com/package/@cypress/instrument-cra I get to start the server and just see
    Uncaught SyntaxError: Unexpected token '<' bundle.js:1
    Uncaught SyntaxError: Unexpected token '<' The browser fires up + it tries run the tests but falls over - I suspect its something to do with the bundling but I am at a loss on how to fix it. I have a very simple test which just visits a landing page + I have some api calls being mocked My cypress.config.js is as below
    Copy code
    const { defineConfig } = require('cypress');
    
    module.exports = defineConfig({
      e2e: {
        setupNodeEvents(on, config) {
          // implement node event listeners here
        },
        baseUrl: 'http://localhost:3000/ui',
        env: {
          PUBLIC_URL: '/ui',
        },
        video: false,
      },
    
      component: {
        devServer: {
          framework: 'create-react-app',
          bundler: 'webpack',
        },
      },
    });
    I am using "react-scripts": "4.0.3", && "cypress": "^11.2.0",
  • c

    cold-cat-63632

    12/09/2022, 5:00 PM
    hi guys sorry i am new to discord and this channel .. simple question .. is there a way to always start electron in incognito mode?
  • b

    brave-doctor-62978

    12/12/2022, 2:58 PM
    has anyone else run into cypress not being able to resolve sass with webpack?
  • b

    brave-doctor-62978

    12/12/2022, 2:58 PM
    like no matter what i do the sass-loader will not generate any ouput. im at a loss
  • m

    magnificent-finland-58048

    12/12/2022, 3:08 PM
    2 examples, react scripts 4 and 5 https://github.com/muratkeremozcan/react-hooks-in-action-with-cypress https://github.com/muratkeremozcan/tour-of-heroes-react-cypress-ts full guide https://muratkerem.gitbook.io/cctdd/ch30-appendix/combined-code-coverage
  • e

    elegant-wire-18957

    12/12/2022, 6:45 PM
    I had some good success today using
    craco
    and
    @bahmutov/cypress-code-coverage/support
    - Need to build it out now to amalgamate the results with my jest output but very happy with the progress.
  • q

    quick-wolf-87390

    12/13/2022, 4:00 PM
    Hey guys! Can anyone help me out with following: I have a table and it has a edit functionality. When i edit i have to check whether I am getting the updated data or not from graphql file.
  • f

    fresh-doctor-14925

    12/13/2022, 4:13 PM
    !duplicate
  • n

    nutritious-analyst-96582

    12/13/2022, 4:13 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! πŸ˜€
  • m

    magnificent-finland-58048

    12/13/2022, 6:01 PM
    you were faster than the bot! πŸ˜„
  • f

    fresh-doctor-14925

    12/13/2022, 6:03 PM
    ah the bot isn't that smart! all it does is add that text after one of us types
    !duplicate
    That would be cool for a future iteration though!
  • b

    brave-doctor-62978

    12/13/2022, 7:17 PM
    can anyone help me with this simple (i hope issue)...
  • b

    brave-doctor-62978

    12/13/2022, 7:17 PM
    Copy code
    cy.intercept('POST', '**/2/account', { body: {} }).as('createChildAccount');
    
        cy.mount(<AddAccountDialog{ ...defaultProps } />, { store });
    
        cy.get('.button-loader').should('not.exist');
        cy.getByLabelText('Account Name').type('TestCo LLC');
        cy.getByLabelText('Purchased Seats').type('1337');
        cy.contains('button', 'Create Account')
          .click();
        cy.contains('button', 'Create Account').should('have.class', 'button-loader');
        cy.get('@createChildAccount').its('response.status').should('be', 200);
  • b

    brave-doctor-62978

    12/13/2022, 7:18 PM
    when the Create Account button is clicked, it fires off a promise that im intercepting above, and while the promise is inflight the button gets a loading state. but i cannot seem to get it to assert the button state fast enough since the intercepted promise instantly resolves....
  • g

    gray-kilobyte-89541

    12/13/2022, 8:03 PM
    it fires a network call, right? You can slow it down, see
    cy.intercept
    documentation and / or my paid network testing course https://cypress.tips/courses/network-testing (this was a lesson recently in my training advent calendar https://cypresstips.substack.com/p/cypress-training-advent-lesson-day-6ec but it already reverted to be behind the paywall)
  • b

    brave-doctor-62978

    12/13/2022, 8:06 PM
    sweet upsell though
  • g

    gray-kilobyte-89541

    12/13/2022, 9:54 PM
    cy.intercept documentation is pretty thorough
  • f

    fresh-doctor-14925

    12/14/2022, 7:28 AM
    I don't really get this. I presume you're paid for the work you're doing with Cypress? He doesn't work for Cypress and he's put his spare time into expanding the documentation and producing a series of lessons. Isn't it reasonable for him to be paid for his time as well? (Not to mention he spends a lot of time creating plugins and helping folks on here for free)
  • b

    brave-doctor-62978

    12/14/2022, 2:04 PM
    yeah, i ended up buying a subscription the lessons are great
  • m

    magnificent-finland-58048

    12/21/2022, 5:45 PM
    how would be cause a re-render of the component in a component test?
  • c

    creamy-angle-90546

    12/28/2022, 1:59 PM
    Hi, Im Khriz I have not had previous experience with test automation or e2e testing and Im seeing cypress as a good starting point I have a project created with preact, but I am not sure If cypress supports it, does anyone know something about it? thanks in advance for your help
  • m

    magnificent-finland-58048

    12/30/2022, 1:50 PM
    e2e, yes preact component testing, not officially found this https://github.com/softwareventures/cypress-preact-unit-test P.S. please don't spam multiple channels
  • b

    brave-doctor-62978

    01/03/2023, 8:06 PM
    has anyone else run into the issue of your webpack config not being able to resolve the
    sass
    module?
  • b

    brave-doctor-62978

    01/03/2023, 8:06 PM
    but your app itself can?
  • m

    magnificent-finland-58048

    01/10/2023, 3:42 PM
    I recall something with the versions, in this app which is using sass and webpack https://github.com/muratkeremozcan/tour-of-heroes-react-cypress-ts
  • a

    ancient-solstice-55625

    01/11/2023, 5:46 AM
    Hi i am using bpmnjs with react and testing a drag and drop functionality but founding unexpected ui response meand ui is not responding any thing with drag and drop functionalty
  • m

    magnificent-finland-58048

    01/11/2023, 3:28 PM
    answered elsewhere, please don't spam channels
  • b

    best-alligator-17841

    01/17/2023, 9:48 AM
    Hello guys, can anyone help me with how can I click on the action buttons in order wise?
  • c

    crooked-furniture-33732

    01/17/2023, 10:44 AM
    Hi all, I’m going through a course to do component testing for a React app. However, when I do something like
    cy.mount(<Numbers />)
    , it’s not recognising
    <Numbers />
    . On Cypress, it just throws a red error. What could I have done wrong? When I look at the video of the guy doing it, I have copied their code exactly.
    Copy code
    /// <reference types="cypress" />
    import React from 'react'
    import { Numbers } from './Numbers'
    
    describe('Numbers', () => {
      it('shows numbers', () => {
        cy.mount(<Numbers />)
      })
    })
    Let me know if you need more info