Back to Kibana

@kbn/test-subj-selector

src/platform/packages/shared/kbn-test-subj-selector/README.mdx

9.4.0806 B
Original Source

Converts a testSubject selector into a CSS selector.

testSubject selector syntax rules:

  • data-test-subj values can include spaces

  • prefixing a value with ~ will allow matching a single word in a data-test-subj that uses several space delimited list words

    • example: ~foo
    • css equivalent: [data-test-subj~="foo"]
  • the > character is used between two values to indicate that the value on the right must match an element inside an element matched by the value on the left

    • example: foo > bar
    • css equivalent: [data-test-subj=foo] [data-test-subj=bar]
  • the & character is used between two values to indicate that the value on both sides must both match the element

    • example: foo & bar
    • css equivalent: [data-test-subj=foo][data-test-subj=bar]