+
+--------------------------------------------------
+form:
+
+
+
+--------------------------------------------------
+radio:
+
+
+
+
+
+--------------------------------------------------
+textbox:
+
+
+
+
+
+
+
+--------------------------------------------------"
+`;
diff --git a/src/__tests__/element-queries.js b/src/__tests__/element-queries.js
index d1c41bd2..303778c5 100644
--- a/src/__tests__/element-queries.js
+++ b/src/__tests__/element-queries.js
@@ -1,6 +1,8 @@
+import jestSerializerAnsi from 'jest-serializer-ansi'
import {configure} from '../config'
import {render, renderIntoDocument} from './helpers/test-utils'
+expect.addSnapshotSerializer(jestSerializerAnsi)
beforeEach(() => {
document.defaultView.Cypress = null
})
@@ -37,60 +39,60 @@ test('get throws a useful error message', () => {
.toThrowErrorMatchingInlineSnapshot(`
"Unable to find a label with the text of: LucyRicardo
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByPlaceholderText('LucyRicardo'))
.toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the placeholder text of: LucyRicardo
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the text: LucyRicardo. This could be because the text is broken up by multiple elements. In this case, you can provide a function for your text matcher to make your matcher more flexible.
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
-"Unable to find an element by: [data-testid=\\"LucyRicardo\\"]
+"Unable to find an element by: [data-testid="LucyRicardo"]
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the alt text: LucyRicardo
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the title: LucyRicardo.
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByDisplayValue('LucyRicardo'))
.toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element with the value: LucyRicardo.
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
expect(() => getByRole('LucyRicardo')).toThrowErrorMatchingInlineSnapshot(`
"Unable to find an element by [role=LucyRicardo]
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
})
@@ -221,13 +223,13 @@ test('label with no form control', () => {
const {getByLabelText, queryByLabelText} = render(``)
expect(queryByLabelText(/alone/)).toBeNull()
expect(() => getByLabelText(/alone/)).toThrowErrorMatchingInlineSnapshot(`
-"Found a label with the text of: /alone/, however no form control was found associated to that label. Make sure you're using the \\"for\\" attribute or \\"aria-labelledby\\" attribute correctly.
+"Found a label with the text of: /alone/, however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
})
@@ -235,11 +237,11 @@ test('totally empty label', () => {
const {getByLabelText, queryByLabelText} = render(``)
expect(queryByLabelText('')).toBeNull()
expect(() => getByLabelText('')).toThrowErrorMatchingInlineSnapshot(`
-"Found a label with the text of: , however no form control was found associated to that label. Make sure you're using the \\"for\\" attribute or \\"aria-labelledby\\" attribute correctly.
+"Found a label with the text of: , however no form control was found associated to that label. Make sure you're using the "for" attribute or "aria-labelledby" attribute correctly.
-[36m
[39m
- [36m[39m
-[36m
[39m"
+
+
+
"
`)
})
diff --git a/src/__tests__/pretty-dom.js b/src/__tests__/pretty-dom.js
index 002765b3..5acf6cf3 100644
--- a/src/__tests__/pretty-dom.js
+++ b/src/__tests__/pretty-dom.js
@@ -1,14 +1,17 @@
+import jestSerializerAnsi from 'jest-serializer-ansi'
import {prettyDOM} from '../pretty-dom'
import {render} from './helpers/test-utils'
+expect.addSnapshotSerializer(jestSerializerAnsi)
+
test('it prints out the given DOM element tree', () => {
const {container} = render('