Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
  • 18:41
    jebbench commented #22885
  • 18:33
    Covik opened #23334
  • 16:37
    dartess opened #23333
  • 15:17
    mike-plummer ready_for_review #23332
  • 15:15
    cypress[bot] commented #23332
  • 15:11
    mike-plummer review_requested #23332
  • 15:11
    mike-plummer review_requested #23332
  • 15:11
    mike-plummer review_requested #23332
  • 15:11
    mike-plummer review_requested #23332
  • 15:06
    mike-plummer edited #23332
  • 15:02
    mike-plummer edited #23332
  • 14:48
    mike-plummer synchronize #23332
  • 14:48

    mike-plummer on 23022-fix-e2e-test-flake

    Pluck projectId from config rat… (compare)

  • 14:28
    mike-plummer edited #23332
  • 14:27
    cypress-bot[bot] commented #23332
  • 14:27
    mike-plummer opened #23332
  • 13:46

    mike-plummer on 23022-fix-e2e-test-flake

    Delay cloud modals gql query un… (compare)

  • 13:44

    mike-plummer on 23022-fix-e2e-test-flake

    Revert "fix: Address test failu… (compare)

  • 12:44
    badeball edited #23331
  • 12:44
    badeball opened #23331
Gleb Bahmutov
@bahmutov
Conrad Magnus Kirschner
@conradkirschner
Hey I want to click in an cross domain iframe with cypress
2 replies
is there any tutorial how to do it?
Julia Casciato
@Julia_Casciato_twitter
Hey has anyone here successfully used Auth0 UI to login with Cypress? I'm getting an invalid state error in an Auth0 Callback.
1 reply
Gleb Bahmutov
@bahmutov
New Cypress.io video "Compare Element Attribute Value" https://youtu.be/lj6cIjbPmh8
Gleb Bahmutov
@bahmutov
New Cypress blog post "Test PDFs By Converting Them To HTML" https://glebbahmutov.com/blog/cypress-pdf/
Astral James
@james328_gitlab
Is there an easy way to throw a warning if something takes longer than it should? I have a set timeout of 8 seconds as my default command timeout, but in some cases we'd like to know if it takes longer than 4 seconds for an image thumbnail to load, but only throw a warning and not fail the test unless it exceeds 8 seconds. Is this something that can be easily implemented?
Steven Rutherford
@Srutherford2407

I am having an issue with @faker-js/faker within the index.js file. The index.js does not allow for the import { faker } from '@faker-js/faker'; statement (even though importing it this way does create the correct references). When imported as const faker = require("@faker-js/faker"); is does not create the correct references to faker and thus the data is not created. Here is my index.js for reference.
`const faker = require("@faker-js/faker");

//For Cucumber Integration
const createEsbuildPlugin =
require('@badeball/cypress-cucumber-preprocessor/esbuild').createEsbuildPlugin
const createBundler = require('@bahmutov/cypress-esbuild-preprocessor');
const nodePolyfills =
require('@esbuild-plugins/node-modules-polyfill').NodeModulesPolyfillPlugin
const addCucumberPreprocessorPlugin =
require('@badeball/cypress-cucumber-preprocessor').addCucumberPreprocessorPlugin
module.exports = async (on, config) => {
const firstName = faker.name.firstName();
const lastName = faker.name.lastName();
await addCucumberPreprocessorPlugin(on, config) // to allow json to be produced
// To use esBuild for the bundler when preprocessing
on('file:preprocessor', createBundler({
plugins: [nodePolyfills(), createEsbuildPlugin(config)],
})
);
on('task', {
freshUser() {
user = {
id: null,
loyalty_id: faker.random.alphaNumeric(10),
email: firstName + "." + lastName + "@gmail.com",
password: faker.internet.password(20, false, /^[a-zA-Z0-9!@#%]+$/),
phone_number: faker.phone.phoneNumber("##########"),
preferred_store_id: "7909108e-0b44-4182-9124-ba3180f24212",
birth_day_of_month: faker.datatype.number({ min: 1, max: 31 }),
birth_month: faker.datatype.number({ min: 1, max: 12 }),
address: faker.address.streetAddress(true),
city: faker.address.city(),
postal_code: faker.address.zipCode("#####"),
state: faker.address.state(),
};
return user;
},
});
return config;
}`

Juan Pablo
@jprealini
@bahmutov hi there! quick one... I upgraded from Cypress 9.7 to Cypress 10.3 (I have typescript also). I'm seeing that the custom commands used in my specs are not being resolved unless I add /// <reference types="../support/e2e" /> to al least one of my specs (I have my e2e.ts files and my e2e.d.ts for types declarations for the custom commands)... I tried adding "cypress/support/e2e" to my "types" section in the tsconfig.json file, but that didn't work (similar to what you do here - > https://www.youtube.com/watch?v=XIaA8k7TOA4 )
Same thing happens with cypress-each. Even though I am importing it in my e2e.ts file, if I don't also import it in at least one spec, then it.each is not recognized anywhere..... I am sure I'm missing something, but can't figure out what... have you seen this happenning before? Thanks!
Alexandra Costa
@alexandra-costa
I'm having an issue with cypress-cucumber-preprocessor within tags after upgrade to Cypress 10+. I've installed the badeball's version but it still didn't work. The plugin is waiting for read cypress.json but in that new version of Cypress this configuration file changed to cypress.config.js. How can I fix it?
Mayara Luiza
@mayaraLUIZA

@bahmutov
Good evening!
I'm trying to get the value of the button-toggle attribute, but even though it was active in then(cy) it returns false and never returns true:

cy.get('.col > .btn').invoke('attr', '.active').then(Boolean).then(cy.log).then((isActive) => {
if(isActive){
cy.get('.col > .btn').should('have.attr', 'active');
cy.log('passou aqui esta ativo')
}else{
cy.get('.col > .btn').should('not.have.attr', 'active')

image.png
Gleb Bahmutov
@bahmutov
@jprealini ohh TypeScript, sigh. This is the best I can do https://glebbahmutov.com/blog/cypress-js-to-ts/#step-14-define-custom-commands
@mayaraLUIZA please check your code. I see the typo there causing it to always be false
Joel Stransky
@joelstransky
@jprealini I just add a index.d.ts to /cypress/support. Looks like this
/// <reference types="cypress" />

declare namespace Cypress {
  interface Chainable {
    login(): void;
    scrollToPercentage(pct: number): void;
    scrollToTrigger(triggerAttr: string, offset): void;
  }
}
@mayaraLUIZA You're checking for .active but it's not a class. invoke('attr', '.active')
Joel Stransky
@joelstransky
@mayaraLUIZA This seems to be what you're after cy.get('.col > .btn').invoke('attr', 'active').should('eq', 'true')
7 replies
Gleb Bahmutov
@bahmutov
I am happy to announce that I will talk online at QA Global Summit'22 Vol. 2 on October 8th, the talk title is "The Fuzzy Line Between End-to-End And Component Tests" all about Cypress E2E vs Component tests https://events.geekle.us/qa22/
Juan Pablo
@jprealini
@bahmutov yeah, sigh! haha...
@joelstransky I have the index.d.ts file just like that (I had named it e2e.d.ts cuz I read somewhere that TS looks for a "d" file names exactly as your "main" file, which in our case for Cypress 10 is e2e.ts, but now I renamed it just to see)... but Intellisense keeps yelling at me if I don't also add the reference types to at least one spec... it's weird
@joelstransky probably something wrong with my tsconfig.json file? It's placed in the cypress root, and looks like this:
{  
  "compilerOptions": {
    /* Visit https://aka.ms/tsconfig.json to read more about this file */
    "target": "es2016", /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */
    "module": "commonjs", /* Specify what module code is generated. */
    "declaration": true, /* Generate .d.ts files from TypeScript and JavaScript files in your project. */
    "outDir": "./dist", /* Specify an output folder for all emitted files. */
    "esModuleInterop": true, /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables `allowSyntheticDefaultImports` for type compatibility. */
    "forceConsistentCasingInFileNames": true, /* Ensure that casing is correct in imports. */
    "strict": true, /* Enable all strict type-checking options. */
    "skipLibCheck": true, /* Skip type checking all .d.ts files. */
    "resolveJsonModule": true,    
    "types": [
      "cypress",
      "cypress-each",
      "node"
    ]
  },
  "include": [
    "./support/index.d.ts",
    "./pages/**/*.ts",
    "./support/**/*.ts",
    "./plugins/environmentVars/*.json",
    "./support/fixtureTemplate/*.json"
  ],
  "exclude": [
    "../cypress/dist/",
    "../cypress/e2e/"
  ]
}
Joel Stransky
@joelstransky
@jprealini Here's my tsconfig from the same location
{
  "compilerOptions": {
    "target": "es6",
    "lib": ["es2017", "dom", "DOM.Iterable"],
    "types": ["jquery", "cypress", "cypress-localstorage-commands"],
    "moduleResolution": "Node",
    "baseUrl": ".",
    "paths": {
      "integration/*": ["tests/integration/*"], 
      "e2e/*": ["tests/e2e/*"], 
    }
  },
  "include": [
    "**/*.ts"
  ]
}
4 replies
running Cypress 9.5 btw
Jose Virgen
@HeavyTech

Has any one had an issue with uploading images using selectFile() on the pipeline?

I have the following code

  cy.get("#browseFiles)
    .as("upload file")
    .selectFile(`cypress/fixtures/${image}.${fileType}`);

It currently passes on the Test runner/ Headless mode, but when we run it on the pipeline it fails and get the following error

It error out saying selectFile() is not a function

Gleb Bahmutov
@bahmutov
@HeavyTech are you sure you are using the same Cypress version on CI?
Jose Virgen
@HeavyTech
@bahmutov Big thank you!!! We had forgotten to update our docker file 😅
Tymoteusz Stępień
@403-html

Hello! How to add to each request header as default? No matter if it's visit, request or request by an app. Just intercept? Because my approach doesn't work. I get this error:

When invoking cy.intercept() with a RouteMatcher as the second parameter, a handler (function or StaticResponse) must be specified as the third parameter. If you intended to stub out a response body by passing an object as the 2nd parameter, pass an object with a body property containing the desired response body instead

My simple intercept:

cy.intercept('**', {
      headers: {
        'my-custom-header': '',
      },
    });
brahimkraiem
@brahimkraiem
hi
i have a problem i can 't type date
Invalid time value
cy.get('#date-rendez-vous').type('16/08/2022');
@bahmutov can u help me please
Gleb Bahmutov
@bahmutov
@403-html I cover this in my https://cypress.tips/courses/network-testing lesson
@brahimkraiem sure. Give me a reproducible example.
brahimkraiem
@brahimkraiem
@bahmutov this is my code

it('Success crendential', () => {
cy.visit('/');

cy.kcFakeLogin('reparateur', '');
cy.get('#detail-btn').click();

cy.get('[data-testid=tab-1]').click();

cy.get('#motifs-rdv').focus().type('Risque VGE{enter}', { force: true });

cy.get('#date-rendez-vous').click();
cy.get('#date-rendez-vous').type('16/08/2022');

cy.get('#submit-btn').click();
cy.get('form').submit();
cy.intercept('*/api/jourpassage', { statusCode: 200 }).as('checkRDV');
cy.get('#success-toast').contains(
  'Demande de rendez-vous a été envoyé avec succès'
);

});

Craig1f
@Craig1f
Hey, I'm having an issue with a Vue2 project using Vite. Component tests seem to take a VERY long time to start running, possibly because Vite's cold-start is slow. Is anyone else having this problem, and do you know if there is some solution? It's really only a problem when I try to run component tests, so I thought I'd try here first.
Gleb Bahmutov
@bahmutov
@brahimkraiem I cannot run this code unfortunately. So I have no idea what your date input is checking. You should check your date input
brahimkraiem
@brahimkraiem
how can i check my date input @bahmutov ??
Gleb Bahmutov
@bahmutov
well, check where it reports the error "invalid time value"
New Cypress.io video "Find row by the exact table cell text" https://youtu.be/ag8dClTP-kw
Marek Alexa
@coding_hedgehog_gitlab
Cypress container runs with a read-only filesystem. How can I work around it ? I want to use docker cp command on the container to copy videos out
but I'm getting error saying it is read-only filesystem. Any feedback @bahmutov ?
Gleb Bahmutov
@bahmutov
@coding_hedgehog_gitlab map the docker volume
1 reply
frogger-hop
@frogger-hop
image.png
Hi. Just today I'm getting the error shown above when I try to launch Cypress (cypress open --e2e --browser=chrome). I haven't made any changes to my config though. Any assistance is appreciated.
FWIW, I'm using a cypress.config.ts file, the latest Cypress, and Windows 10 Enterprise.
frogger-hop
@frogger-hop
Seems to be fixed now, thanks to git bisect. I had made a few changes to my tsconfig days ago, but they just started causing the issue today. Strange, but glad to have things working again.
Jade Barben
@barbenjade
image.png
Hi, So I am having trouble loading files in my automation test. I am in a DOM modal (not browser modal) so I should be able to click the upload button (in this case the upload option is the clickable "browse" as seen in the first image below) and then use the .attachFile() method to load a png image I have saved in my fixtures directory. Instead what happens is the button is clicked but not file is retrieved or uploaded into the DOM. I know I have the correct file path to the image because it was giving me an error for that before but no longer is. I noticed all the examples I see online for the .attachFile method use input fields, but the browse option for me is not an input element so I may need to use another method. Does anyone know what I can do to load the file I need?
Here is the browser option I am talking about
image.png
Here is the html its a span element not an input...