Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open Modal or Page with Ionic 3 #1397

Closed
vpivet opened this issue Mar 1, 2018 · 7 comments
Closed

Open Modal or Page with Ionic 3 #1397

vpivet opened this issue Mar 1, 2018 · 7 comments

Comments

@vpivet
Copy link

vpivet commented Mar 1, 2018

  • Operating System: Mac OS 10.13.3
  • Cypress Version: 2.0.0
  • Browser Version: Chrome 64.0.3282.186

Is this a Feature or Bug?

Bug

Current behavior:

When I tap on a button to open an Ionic 3 page or Modal, nothing append and my test fail. Cypress success to click on the button but the page doesn't appear.

Desired behavior:

Open Ionic Modale or Page on button click with Cypress

How to reproduce:

Create an Ionic 3 empty project with a button who open a new page.

Test code:

it('should open page', () => {
        // Button to open my page : OK
        cy.get(my_button).click();

        // Check if a label exists in the opened page : FAIL
        cy.get(a_label_in_my_page).contains("All is ok !");
    });

Question : Is it possible to well test Ionic 3 with Cypress ?

@jennifer-shehane jennifer-shehane added the stage: needs investigating Someone from Cypress needs to look at this label Mar 1, 2018
@jennifer-shehane
Copy link
Member

Is there any error that displays within your Test Runner on click? Could you share the error that is displayed?

Also, you may find success with .click({force: true}) option.

@vpivet
Copy link
Author

vpivet commented Mar 1, 2018

No error in my test runner for the on click. I can see the on click animation when I execute my tests. But my page doesn't appear.

I tried .click({ force: true }) option but nothing more append.

@brian-mann
Copy link
Member

@vpivet can you make this easy on us and setup a reproducible repo with the bare minimum to demonstrate the problem. You did do a good job explaining the steps - but for our team - since we have to investigate these issues, we prioritize whatever is easiest to reproduce and diagnose.

@vpivet
Copy link
Author

vpivet commented Mar 2, 2018

I created a new empty Ionic 3 project with Cypress with simple modal and page to share it with you. But I haven't the problem with this project, my page or modal open without problem.
I noticed that my function on click isn't call when button is clicked. (Can't see my console.log)
I will try to reproduce it in my empty project to share it with you.

In the meantime I hope this new element can help you to understand my problem.

@vpivet
Copy link
Author

vpivet commented Mar 2, 2018

It's ok ! I understand my mistake.
I my code I used (tap) to do on click event. But it doesn't works with cypress.
So I replace all my (tap) by (click) and it works better.

<button ion-button (tap)="doSomething()">My Button</button> => WRONG
<button ion-button (click)="doSomething()">My Button</button> => GOOD

Thanks for your help. Cypress is really good ! ;)

@vpivet vpivet closed this as completed Mar 2, 2018
@jennifer-shehane jennifer-shehane removed stage: needs investigating Someone from Cypress needs to look at this labels Jan 16, 2019
@amiral-jion
Copy link

I have the same problem, I need to use tap instead of click but I can't find how to simulate this event with cypress. any one succeed on simulating the tap event guys?

@jennifer-shehane
Copy link
Member

@vpivet @amiral-jion I would take a look at trigger()

I think this will be easier to achieve once we have native events support: #311

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants