|
1 | 1 | import {configure} from '../config'
|
2 | 2 | import {render, renderIntoDocument} from './helpers/test-utils'
|
3 | 3 |
|
4 |
| -beforeEach(() => { |
5 |
| - document.defaultView.Cypress = null |
6 |
| -}) |
7 |
| - |
8 | 4 | test('query can return null', () => {
|
9 | 5 | const {
|
10 | 6 | queryByLabelText,
|
@@ -1061,46 +1057,6 @@ test('the debug helper prints the dom state here', () => {
|
1061 | 1057 | process.env.DEBUG_PRINT_LIMIT = originalDebugPrintLimit
|
1062 | 1058 | })
|
1063 | 1059 |
|
1064 |
| -test('get throws a useful error message without DOM in Cypress', () => { |
1065 |
| - document.defaultView.Cypress = {} |
1066 |
| - const { |
1067 |
| - getByLabelText, |
1068 |
| - getByPlaceholderText, |
1069 |
| - getByText, |
1070 |
| - getByTestId, |
1071 |
| - getByAltText, |
1072 |
| - getByTitle, |
1073 |
| - getByDisplayValue, |
1074 |
| - } = render('<div />') |
1075 |
| - expect(() => |
1076 |
| - getByLabelText('LucyRicardo'), |
1077 |
| - ).toThrowErrorMatchingInlineSnapshot( |
1078 |
| - `Unable to find a label with the text of: LucyRicardo`, |
1079 |
| - ) |
1080 |
| - expect(() => |
1081 |
| - getByPlaceholderText('LucyRicardo'), |
1082 |
| - ).toThrowErrorMatchingInlineSnapshot( |
1083 |
| - `Unable to find an element with the placeholder text of: LucyRicardo`, |
1084 |
| - ) |
1085 |
| - expect(() => getByText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot( |
1086 |
| - `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.`, |
1087 |
| - ) |
1088 |
| - expect(() => getByTestId('LucyRicardo')).toThrowErrorMatchingInlineSnapshot( |
1089 |
| - `Unable to find an element by: [data-testid="LucyRicardo"]`, |
1090 |
| - ) |
1091 |
| - expect(() => getByAltText('LucyRicardo')).toThrowErrorMatchingInlineSnapshot( |
1092 |
| - `Unable to find an element with the alt text: LucyRicardo`, |
1093 |
| - ) |
1094 |
| - expect(() => getByTitle('LucyRicardo')).toThrowErrorMatchingInlineSnapshot( |
1095 |
| - `Unable to find an element with the title: LucyRicardo.`, |
1096 |
| - ) |
1097 |
| - expect(() => |
1098 |
| - getByDisplayValue('LucyRicardo'), |
1099 |
| - ).toThrowErrorMatchingInlineSnapshot( |
1100 |
| - `Unable to find an element with the display value: LucyRicardo.`, |
1101 |
| - ) |
1102 |
| -}) |
1103 |
| - |
1104 | 1060 | test('getByText ignores script tags by default', () => {
|
1105 | 1061 | const {getAllByText} = render(
|
1106 | 1062 | '<script>Hello</script><div>Hello</div><style>.Hello{}</style>',
|
|
0 commit comments