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

TestID does not work #145

Open
CristianeMayara opened this issue Jun 22, 2020 · 2 comments
Open

TestID does not work #145

CristianeMayara opened this issue Jun 22, 2020 · 2 comments

Comments

@CristianeMayara
Copy link

CristianeMayara commented Jun 22, 2020

I set the testID on the RadioForm component according to the documentation. However, the testIDs in the RadioButtonInput and RadioButtonLabel components have not been defined.

I'm using Detox with Jest for e2e tests. Below is an example:

Component: RadioFormExample.js

const RadioFormExample = () => {
  var radio_props = [
    { label: 'param1', value: 0 },
    { label: 'param2', value: 1 },
  ];
  return (
    <RadioForm
      testID="my-radio-form"
      radio_props={radio_props}
      onPress={() => console.log('')}
    />
  );
};

Test: RadioFormExample.spec.js

describe('when the component is loaded', () => {
  it('should show all items', async () => {
    await expect(element(by.id('my-radio-formInput0'))).toBeVisible();
    await expect(element(by.id('my-radio-formLabel0'))).toBeVisible();
    await expect(element(by.id('my-radio-formInput1'))).toBeVisible();
    await expect(element(by.id('my-radio-formLabel1'))).toBeVisible();
  });
});

Is the testID generated for the input and label components in this format [testID]Input[index]?
Am I doing something wrong?

@tearjuIce
Copy link

do you have a solution for this? im facing the same problems

@Graren
Copy link

Graren commented Sep 30, 2021

The testId is [testID]Input[testID]|[index] found it the hard way, note there's a | in there

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

3 participants