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

    careful-tent-30457

    06/18/2022, 10:55 AM
    This was my own fault for declaring my "mount" method in the
    cypress/support/commands
    file. thought ppl would like to know
  • l

    limited-room-30929

    06/18/2022, 12:32 PM
    Can someone explain me where this Typeerror is from?
    Copy code
    1) An uncaught error was detected outside of a test
    
      0 passing (219ms)
      1 failing
    
      1) An uncaught error was detected outside of a test:
         TypeError: The following error originated from your test code, not from Cypress.
    
      > Failed to resolve module specifier 'src/components/__tests__/QuasarButton.spec.ts'
    
    When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
    
    Cypress could not associate this error to any specific test.
    
    We dynamically generated a new test to display this failure.
          at importsToLoad (http://localhost:9000/__cypress/src/cypress:client-init-test:9:71)
          at http://localhost:9000/__cypress/runner/cypress_runner.js:179584:86
          at tryCatcher (http://localhost:9000/__cypress/runner/cypress_runner.js:13012:23)
          at Object.gotValue (http://localhost:9000/__cypress/runner/cypress_runner.js:12154:18)
          at Object.gotAccum (http://localhost:9000/__cypress/runner/cypress_runner.js:12143:25)
          at Object.tryCatcher (http://localhost:9000/__cypress/runner/cypress_runner.js:13012:23)
          at Promise._settlePromiseFromHandler (http://localhost:9000/__cypress/runner/cypress_runner.js:10947:31)
          at Promise._settlePromise (http://localhost:9000/__cypress/runner/cypress_runner.js:11004:18)
          at Promise._settlePromise0 (http://localhost:9000/__cypress/runner/cypress_runner.js:11049:10)
          at Promise._settlePromises (http://localhost:9000/__cypress/runner/cypress_runner.js:11129:18)
  • l

    late-house-1562

    06/18/2022, 12:59 PM
    Provide the code causing the error and someone will probably take a look. I've had similar things happen, but haven't always figured them out.
  • l

    limited-room-30929

    06/18/2022, 1:00 PM
    Copy code
    html
    <template>
      <q-btn
        data-cy="button"
        label="test emit"
        color="positive"
        rounded
        icon="edit"
        @click="$emit('test')"
      />
    </template>
    
    <script>
    import { defineComponent } from 'vue';
    
    export default defineComponent({
      name: 'QuasarButton',
      emits: ['test'],
    });
    </script>
  • l

    limited-room-30929

    06/18/2022, 1:03 PM
    Copy code
    ts
    // __test__/QuasarButton.spec.ts
    
    import { mount } from '@cypress/vue';
    import QuasarButton from '../QuasarButton.vue';
    
    describe('QuasarButton', () => {
      it('renders a message', () => {
        const label = 'Hello there';
        mount(QuasarButton, {
          props: {
            label,
          },
        });
    
        cy.dataCy('button').should('contain', label);
      });
    })
  • l

    limited-room-30929

    06/18/2022, 1:04 PM
    Copy code
    ts
    // command.ts
    
    Cypress.Commands.add(
      'dataCy',
      { prevSubject: 'optional' },
      (subject, value, options) => {
        return cy.get(
          `[data-cy=${value}]`,
          Object.assign({ withinSubject: subject }, options)
        );
      }
    );
  • l

    late-house-1562

    06/18/2022, 1:10 PM
    Idk, but maybe focus in on this?
    Copy code
    sh
    When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.
  • l

    limited-room-30929

    06/18/2022, 1:18 PM
    the example is so small I don't know where the error might be
  • l

    late-house-1562

    06/18/2022, 1:19 PM
    When I had a similar error, I was able to point to a specific code change I had made, and roll it back.
  • l

    limited-room-30929

    06/18/2022, 1:22 PM
    this is a default test for component testing pre cypress 10 the error message doesn't tell anything where the problem might be
  • l

    late-house-1562

    06/18/2022, 1:23 PM
    That is the full stack trace?
  • l

    limited-room-30929

    06/18/2022, 1:25 PM
    even this test fails
    Copy code
    ts
    describe('QuasarButton', () => {
      it('renders a message', () => {
        const label = 'Hello there';
      });
    });
  • l

    limited-room-30929

    06/18/2022, 1:25 PM
    yes that is everything
  • l

    late-house-1562

    06/18/2022, 1:29 PM
    My next test would be to comment out the
    commands.ts
    file and see if the error goes away. Do you have any plugins?
  • l

    late-house-1562

    06/18/2022, 1:33 PM
    I'm trying to use a
    commands.ts
    and plugins together for the first time, and I'm finding it a bit difficult to get these right.
  • l

    limited-room-30929

    06/18/2022, 1:35 PM
    all commented out already
  • l

    late-house-1562

    06/18/2022, 1:35 PM
    For exampe -- and I am just realizing this -- but we can only have one argument in a plugin task.
  • l

    limited-room-30929

    06/18/2022, 1:35 PM
    my guess is, cypress does not use the path aliases from vite
  • l

    limited-room-30929

    06/18/2022, 1:36 PM
    src/components/__tests__/QuasarButton.spec.ts
    so this will fail if
    src
    does not get replaced
  • l

    limited-room-30929

    06/18/2022, 1:36 PM
    maybe
  • l

    late-house-1562

    06/18/2022, 1:38 PM
    🤷‍♂️ I wish I could be of more help.
  • l

    limited-room-30929

    06/18/2022, 1:40 PM
    https://github.com/cypress-io/cypress/blob/e5385fe413ae866985c04dfc991f8378673c6159/npm/vite-dev-server/client/initCypressTests.js#L9 this line causes the typeerror
  • l

    limited-room-30929

    06/18/2022, 1:40 PM
    dynamic import with a path that has an alias fails
  • l

    limited-room-30929

    06/18/2022, 1:51 PM
    https://github.com/cypress-io/cypress/issues/22390
  • l

    limited-room-30929

    06/18/2022, 1:52 PM
    if anyone is interested
  • s

    swift-angle-95455

    06/20/2022, 3:31 AM
    What is "Default audience"? I am setting up Auth0 for the
    cypress-realworld-app
    , the local dev server is localhost:3000, then what value should I set in "Default audience"?
    • 1
    • 1
  • s

    swift-angle-95455

    06/20/2022, 4:42 AM
    What is Default audience I am setting up
  • w

    worried-parrot-50579

    06/20/2022, 5:10 AM
    Hi experts, how do you make a certain test to run only once per execution? If it is placed in support/index.js, it runs once for each spec. I want to create users for testing (which should also be a test reported as any other 'it') and then use these users in all the specs. Currently I do it using a parameter and 2 auxiliary tasks I defined in plugins/index.js (see below) and then I use them in the test defined in support/index.js using condition. The condition is true for the first spec only but the test is still counted for every spec (even if the condition is false and the main part of the test is not executed, since the condition is part of the test, the test is entered and therefore counted). I wonder if there is a better approach. Thanks!
    • 1
    • 3
  • p

    prehistoric-apple-68554

    06/20/2022, 6:00 AM
    Hi, how can we pull the data (dynamic value) from commands.js and use it in testFile.cy.js. Scenario - I am accessing my Gmail account using commands.js >> getting the requested email body, then pulling the data from the body, and saving it in a variable >> now I want to .type the pulled email data (stored in a variable) in my testFile.cy.js. commands.js `/// // import xml2js Module import { parseString } from "xml2js"; Cypress.Commands.add('loginByGoogleApi', () => { cy.log('Logging in to Gmail') cy.log(Cypress.env('googleRefreshToken')) cy.request({ method: 'POST', url: 'https://www.googleapis.com/oauth2/v4/token', body: { grant_type: 'refresh_token', client_id: Cypress.env('googleClientId'), client_secret: Cypress.env('googleClientSecret'), refresh_token: Cypress.env('googleRefreshToken'), }, }).then(({ body }) => { const { access_token, id_token } = body cy.log('Opening emails including code to verify') cy.request({ method: 'GET', url: 'https://mail.google.com/mail/feed/atom/verifyCode', headers: { Authorization:
    Bearer ${access_token}
    }, }).then(({ body }) => { parseString(body, function (err, results) { let data = JSON.stringify(results) let codeTitle = JSON.parse(data).feed.entry[0].title[0]; let code = codeTitle.replace('Chaine confirmation code: ',''); cy.log(code) }); }); }) }) ` testFile.cy.js > const { Code } = require("@chaine/keychaine"); > > > describe('Open login page', () => { > it('Enter your email to login', () => { > cy.visit('https://chaineapp.com/staging/login') > cy.get('#field-1').click().type('paras@loadtap.com'); > cy.get('[class*="chakra-button css-yg51i0"]').click(); > cy.get('#pin-input-2-0').type(JSON.stringify(Code)); > > }) > it('get code', () => { > cy.loginByGoogleApi() > > }) > })
  • l

    lively-restaurant-6491

    06/20/2022, 12:18 PM
    Hi, Not able to run feature file after updating cypress version 10.1.0 Getting error message like - Error: We've tried to resolve your step definitions at cypress\integration, but that doesn't seem to exist. As of version 2.0.0 it's required to set step_definitions in your cypress-cucumber-preprocessor configuration. Look for nonGlobalStepDefinitions and add stepDefinitions right next to it. It should match your cypress configuration has set for integrationFolder. We no longer rely on getting information from that file as it was unreliable and problematic across Linux/MacOS/Windows especially since the config file could have been passed as an argument to cypress. please help me in resolving this issue.
1...909192...252Latest