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

Props are undefined when e2e testing before passing them in with $eval #2053

Closed
guidoknoll opened this issue Dec 2, 2019 · 2 comments
Closed
Labels

Comments

@guidoknoll
Copy link

Stencil version:

 @stencil/core@1.8.0

I'm submitting a:

[x] bug report
[ ] feature request
[ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:

When e2e testing a component, it is suggested to pass in props with the page.$eval function. The problem with this is, that the component initializes already after await page.setContent('<my-comp/>');, so that the props are undefined at this moment and errors are thrown:
image

Expected behavior:

Prop definition should be possible right before component initialization/loading in e2e tests. A tsx/jsx syntax like in the unit tests would be perfect:

    const page = await newE2EPage({
       template: () => (
         <custom-select searchable={true} />
      )
    });

Steps to reproduce:

No steps to reproduce.

Related code:

it('renders searchable list', async () => {
    const page = await newE2EPage();

    await page.setContent(`
      <custom-select/>
    `);

    await page.$eval('custom-select', (elm: any) => {
      elm.messages = {
        facets: {
            close: 'schlie\u00DFen',
            noResults: 'Leider keine Treffer gefunden.'
        }
      },
      elm.searchable = true;
    });

    await page.waitForChanges();

Other information:

@ionitron-bot ionitron-bot bot added the triage label Dec 2, 2019
@chmerk
Copy link

chmerk commented Nov 21, 2022

Well, you could do something like

const searchable = true;

await page.setContent(`
  <custom-select searchable=${searchable} />
`);

... I guess

@christian-bromann
Copy link
Member

Hi @guidoknoll 👋

We apologize for the delay in addressing this issue. The StencilJS team has been hard at work, and we appreciate your patience.

As StencilJS has undergone significant updates and improvements since this issue was originally posted, we believe that this specific concern may no longer be relevant with the latest version. Therefore, we are closing this issue.

If you are still experiencing this problem or have any new issues, please feel free to open a new issue with the latest details, and we will be happy to assist you.

Thank you for your understanding and support of StencilJS!

@ionic-team ionic-team locked and limited conversation to collaborators Jun 14, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants