|
1 | | -import { click, currentURL, fillIn, findAll, waitFor } from '@ember/test-helpers'; |
| 1 | +import { click, currentURL, fillIn, findAll, getSettledState, waitFor } from '@ember/test-helpers'; |
2 | 2 | import { module, test } from 'qunit'; |
3 | 3 |
|
4 | 4 | import percySnapshot from '@percy/ember'; |
@@ -206,7 +206,34 @@ test detail |
206 | 206 |
|
207 | 207 | await visit('/crates/nanomsg'); |
208 | 208 | assert.strictEqual(currentURL(), '/crates/nanomsg'); |
209 | | - await waitFor('[data-test-id="link-crate-report"]'); |
| 209 | + |
| 210 | + try { |
| 211 | + await waitFor('[data-test-id="link-crate-report"]'); |
| 212 | + } catch (error) { |
| 213 | + console.error(error); |
| 214 | + console.log(getSettledState()); |
| 215 | + // display DOM tree for debugging |
| 216 | + const walker = document.createTreeWalker( |
| 217 | + document.querySelector('main'), |
| 218 | + NodeFilter.SHOW_ELEMENT + NodeFilter.SHOW_TEXT, |
| 219 | + ); |
| 220 | + while (walker.nextNode()) { |
| 221 | + let current = walker.currentNode; |
| 222 | + if (current.nodeName === '#text') { |
| 223 | + let text = current.textContent.trim(); |
| 224 | + if (text) { |
| 225 | + console.log(current.textContent, { current }); |
| 226 | + } |
| 227 | + } else if (current.tagName && current.tagName !== 'path') { |
| 228 | + console.log( |
| 229 | + current.tagName, |
| 230 | + [...(current.attributes ?? [])].map(({ value, name }) => `${name}=${value}`).join(','), |
| 231 | + ); |
| 232 | + } |
| 233 | + } |
| 234 | + throw error; |
| 235 | + } |
| 236 | + |
210 | 237 | await click('[data-test-id="link-crate-report"]'); |
211 | 238 | assert.strictEqual(currentURL(), '/support?crate=nanomsg&inquire=crate-violation'); |
212 | 239 | assert.dom('[data-test-id="crate-input"]').hasValue('nanomsg'); |
|
0 commit comments