aloof-minister-25561
03/09/2023, 2:23 PMquaint-battery-7856
03/09/2023, 5:38 PMbrave-doctor-62978
03/09/2023, 10:04 PMmany-holiday-68742
03/10/2023, 4:20 AMts
import { mount } from 'cypress/react18';
const onChange = cy
.stub()
.as('onChange')
.callsFake(moo => {
console.log('onChange called', moo);
});
mount(
<input type="text" data-testid="moo" onChange={onChange} />,
);
cy.get('[data-testid="moo"]').invoke('val', 'how now brown cow');
This test succeeds in updating the input's current value, but does not trigger React's onChange event. 😦
Is there a way to update the input's value, and also trigger React's onChange event at the same time?adventurous-garden-6944
03/10/2023, 9:09 AMflaky-australia-20559
03/10/2023, 11:11 AMTS
.scrollIntoView() (after this it's still covered, however it does scroll, just not enough)
cy.scrollTo('top');
cy.scrollTo('center');
cy.get('.sidebar').scrollTo('top');
Does anyone know a different way of scrolling upwards?mammoth-fall-22117
03/10/2023, 1:04 PMmysterious-tomato-62265
03/10/2023, 1:39 PMclass Default extends HTMLElement {
constructor() {
super();
this.attachShadow({ mode: "open" });
this.shadowRoot.textContent = "Hello, World!";
}
}
customElements.define('acme-default', Default);
I've literally first installed Cypress this morning. I've gone through getting started. If I use the app (from npx cypress open
) and choose the component testing, it asks if I want to use one of the frameworks to do this. Then moves onto picking web pack.
I've struggled to find what I need for this simple scenario.
Thanks
Paulkind-eve-72052
03/10/2023, 2:49 PM@Cypress/code-coverage
for multiple spec/test files run with cypress run
does it generate code coverage for all these files or just the last one? I am seeing code coverage reset step at the beginning of each test file so I am worried it might not be collecting the data for all tests which is what I need in this situation.modern-flower-30680
03/10/2023, 3:28 PM<style id="stitches" dangerouslySetInnerHTML={{ __html: getCssText() }} />
I can't think of a way to load the content of getCssText() properly into the testing environment, whether using the cypress/support/component.tsx
file or the cypress/support/component-index.html file
Has anyone ran into this situation before and successfuly solved it?
Thank you in advance!quiet-answer-70986
03/10/2023, 8:52 PMred-toddler-79937
03/11/2023, 4:51 AMbest-stone-6612
03/11/2023, 11:44 AMlively-balloon-98986
03/12/2023, 11:43 AMacceptable-angle-31500
03/12/2023, 2:11 PMhappy-mouse-72265
03/12/2023, 9:34 PMable-magazine-50000
03/12/2023, 11:51 PMrhythmic-dress-36825
03/13/2023, 8:44 AMhappy-queen-3022
03/13/2023, 9:06 AMpolite-lunch-8069
03/13/2023, 12:49 PMbland-oil-21931
03/13/2023, 2:55 PMcolossal-table-38461
03/13/2023, 6:58 PMmillions-soccer-91794
03/13/2023, 8:54 PMclever-night-39043
03/14/2023, 4:33 AMheaders
from api request by cy.wait. It was working before, and the code is basically copied from Cypress document:
describe('test', function () {
let headers;
beforeEach(function () {
cy.intercept(userApi).as('request');
cy.visit('/')
cy.wait('@request').its('request.headers').then((headers) => {
headers = headers;
})
});
it('test', function () {
...
})
But I get this error:
> Cypress detected that you returned a promise from a command while also invoking one or more cy commands in that promise.
The line it points to is cy.visit()
Any idea why this would happen? Thankslively-balloon-98986
03/14/2023, 11:44 AMincalculable-rainbow-43330
03/14/2023, 12:48 PMred-diamond-5625
03/14/2023, 3:37 PMcommands.ts
file
Cypress.Commands.add('confirmReCAPTCHA', () => {
// Wait until the iframe (Google reCAPTCHA) is totally loaded
return cy.get('iframe')
.first()
.its('0.contentDocument.body')
.should('not.be.undefined')
.and('not.be.empty')
.then(cy.wrap)
.find('#recaptcha-anchor')
.should('be.visible')
});
I get the following error "Argument of type '"confirmReCAPTCHA"' is not assignable to parameter of type 'keyof Chainable'.ts(2345)" , whats wrong am I doing here ? This was working fine with JavaScript , issue seems to be with TypeScript now that we switched. I cannot call the command in my cy.ts specimportant-hydrogen-23885
03/14/2023, 4:14 PMadventurous-policeman-97274
03/14/2023, 4:22 PMfaint-ocean-92094
03/14/2023, 7:28 PM