Skip to content

Read testID from custom layout props in BaseToast #559

@guiann

Description

@guiann

Is your feature request related to a problem? Please describe.
We'd like to test if the right Toast message is shown using Detox end to end tests.
please see details on this stackoverflow question

Describe the solution you'd like
The solution today is to check with Detox for the internal testIDs ( testID={getTestId('TouchableContainer')} )
Wich can be broken by id update (they are internal ids) and cannot be configured to check which type of toast is shown.

Describe alternatives you've considered
BaseToast should accept a testID props, defaulting to "toast" So the final test id could be
testID=${testID}${elementName};

Users would then be able to set their own test Ids on Base/Success/Error Toasts.
like so :

export const toastConfig = {
  /*
    Overwrite 'success' type,
    by modifying the existing `BaseToast` component
  */
  success: (props) => (
    <BaseToast
      {...props}
      testID="Toast.success" // not found by detox
    />
  ),...

If that's alright I might create the PR myself.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions