I'm trying to use cypress to automate creating a new record and is having lots of difficulty. I am testing using a GridComponent with React.
cy.get(`button#grid_add`).click({force: true})
cy.wait(100);
cy.get(`input#gridtag`).type(tagName, {timeout: 0, delay: 0, force: true})
cy.get(`div.e-footer-content button.e-flat.e-btn.e-primary`).each(($btn, index) => {
const button = cy.wrap($btn);
if ($btn.text() == 'Save')
button.click({force: true, multiple: true})
});
Here is a screenshot of the dialog when open.
If I close the dialog the spinner is spinning as below:
I saw that you support cypress E2E tests but is there examples or recommendations/suggestion for automating actions using cypress (https://www.cypress.io/)?
Hi Customer,
Greetings from Syncfusion support
Currently we are working on your query with your shared information(Cypress E2E testing difficulties), and we will update you the details on or before 5th Oct 2022. Until then we appreciate your patience.
Rajapandi R
Hi Customer,
Thanks for your patience.
We have prepared a simple sample with a cypress testing case for React Grid
component, and it is working fine. Please find the below sample for your
reference.
Sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/sample-898673973.zip
[app.js] data = []; render() { return (<div> <ButtonComponent id="btn">Button</ButtonComponent> <GridComponent id="Grid" dataSource={this.data} height='350'> <ColumnsDirective> <ColumnDirective field='OrderID' headerText='Order ID' width='120' textAlign='Right'></ColumnDirective> <ColumnDirective field='CustomerName' headerText='Customer Name' width='150'></ColumnDirective> </ColumnsDirective> </GridComponent> </div>); } }
|
[button.cy.js]
describe('button.cy.js', () => { const btnSelector = '[id=btn]' const emptyrowSelector = '[class=e-emptyrow]' const inputElem = '[id=GridOrderID]'
it('mounts', () => { cy.mount(<App />) cy.get('button') cy.get(btnSelector).should('have.text', 'Button') }) it('Empty Grid', () => { cy.mount(<App />) cy.get(emptyrowSelector).should('have.text', 'No records to display') }) it('toolbarclick', () => { cy.mount(<App />) cy.get('.e-add').click({force: true}) cy.get(inputElem).type(10248) cy.get(`div.e-footer-content button.e-flat.e-btn.e-primary`).each(($btn, index) => { const button = cy.wrap($btn);
if ($btn.text() == 'Save') button.trigger("click"); }); }) }) |
Kindly refer to the below documentation for more information,
Documentation: https://docs.cypress.io/guides/component-testing/quickstart-react
Regards,
Rajapandi R
I am using a custom graphql adapter. I think my issue is that I am trying to add a new row before the grid fetching from the api. Which would explain why the spinner is spinning even while new dialog appears. Is there some timeout option?
Hi Customer,
Currently, we are validating your query with your shared information, and we will update you the details on or before 11th Oct 2022. Until then we appreciate your patience.
Rajapandi R
I figured out my issue. In modern browsers you can omit the protocol from the url, unfortunately that doesn't work within iframes which cypress uses. If you have the resources, you should really consider pattern utilizing cypress e2e tests. right now I'm running into an issue with multiselectcomponent where selecting an option does not trigger the on
Hi Customer,
We request you to provide additional details about the query as mentioned below, This will help us validate the query further and provide you with a better solution.
1. Is the MultiSelect component rendered within any other component or alone?
2. Whether the reported issue occurs while rendering the MultiSelect component alone?
3. Issue reproducing runnable sample.
4. Issue replication steps.
5. Video illustration of the issue.
Regards,
Rajapandi R