File size: 5,298 Bytes
4d70170 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
import { suite } from '../utils/suite'
const baseInstanceCount = 12
suite('components tab', () => {
beforeEach(() => cy.reload())
it('should detect instances inside shadow DOM', () => {
cy.get('.tree > .instance:last-child').contains('Shadow')
})
it('should select instance', () => {
cy.get('.instance .self').eq(0).click().should('have.class', 'selected')
cy.get('.tree').should('be.visible')
cy.get('.action-header .title').contains('Root')
cy.get('.data-field').contains('$route')
})
it('should expand root by default', () => {
cy.get('.instance').should('have.length', baseInstanceCount)
})
it('should detect functional components', () => {
cy.get('.tree > .instance .instance:nth-child(2)').within(() => {
cy.get('.arrow').click().then(() => {
cy.get('.instance:last-child').contains('Functional')
})
})
})
it('should display 0 key', () => {
cy.get('.tree > .instance .instance:nth-child(2)').within(() => {
cy.get('.arrow').click().then(() => {
cy.get('.instance:nth-child(3) .attr').contains('key=0')
})
})
})
it('should detect components in transition', () => {
cy.get('.tree > .instance .instance:nth-child(7)').within(() => {
cy.get('.arrow').click().then(() => {
cy.get('.instance').eq(1).within(() => {
cy.get('.arrow').click().then(() => {
cy.get('.instance').contains('TestComponent')
})
})
})
})
})
it('should select child instance', () => {
cy.get('.instance .instance:nth-child(1) .self').eq(0).click()
cy.get('.action-header .title').contains('Counter')
cy.get('.data-el.vuex-bindings .data-field').contains('count:0')
cy.get('.data-el.computed .data-field').contains('test:1')
cy.get('.data-el.firebase-bindings .data-field').contains('hello:undefined')
})
it('should display prop of different types', () => {
cy.get('.instance .instance:nth-child(2) .self').eq(0).click()
cy.get('.action-header .title').contains('Target')
cy.get('.data-el.props .data-field:nth-child(1)').contains('ins:Object')
cy.get('.data-el.props .data-field:nth-child(2)').contains('msg:"hi"')
cy.get('.data-el.props .data-field:nth-child(3)').contains('obj:undefined')
// Regexp
cy.get('.data-el.data .data-field:nth-child(8)').then((el) => {
expect(el.text()).to.include('regex:/(a\\w+b)/g')
})
// Literals
cy.get('.data-el.data .data-field:nth-child(5)').contains('NaN')
cy.get('.data-el.data .data-field:nth-child(2)').contains('Infinity')
cy.get('.data-el.data .data-field:nth-child(6)').contains('-Infinity')
})
it('should expand child instance', () => {
cy.get('.instance .instance:nth-child(2) .arrow-wrapper').click()
cy.get('.instance').should('have.length', baseInstanceCount + 10)
})
it('should add/remove component from app side', () => {
cy.get('.instance .instance:nth-child(2) .arrow-wrapper').click()
cy.get('.instance').should('have.length', baseInstanceCount + 10)
cy.get('#target').iframe().then(({ get }) => {
get('.add').click({ force: true })
})
cy.get('.instance').should('have.length', baseInstanceCount + 13)
cy.get('#target').iframe().then(({ get }) => {
get('.remove').click({ force: true })
})
cy.get('.instance').should('have.length', baseInstanceCount + 12)
})
it('should filter components', () => {
cy.get('.left .search input').clear().type('counter')
cy.get('.instance').should('have.length', 2)
cy.get('.left .search input').clear().type('target')
cy.get('.instance').should('have.length', 12)
cy.get('.left .search input').clear()
})
it('should select component', () => {
cy.get('.select-component').click()
cy.get('#target').iframe().then(({ get }) => {
get('.mine').eq(0)
.trigger('mouseover', { force: true })
.click({ force: true })
})
cy.get('.action-header .title').contains('Mine')
cy.get('.tree').then((el) => {
expect(el.text()).to.include('<Mine>')
})
})
it('should display render key', () => {
cy.get('.instance .instance:nth-child(2) .arrow-wrapper').click()
cy.get('.instance .self .attr-title').contains('key')
cy.get('.instance .self .attr-value').contains('1')
})
it('should display injected props', () => {
cy.get('.left .search input').clear().type('Mine')
cy.get('.instance').eq(1).click()
cy.get('.right .data-wrapper')
.should('contain', 'injected')
.should('contain', 'answer:42')
.should('contain', 'foo:"bar"')
.should('contain', 'noop:ƒ noop(a, b, c)')
cy.get('.left .search input').clear()
})
it('should display $refs', () => {
cy.get('.instance .item-name').contains('RefTester').click()
cy.get('.right .data-wrapper')
.should('contain', 'list:Array[4]')
.should('contain', '<li>')
.should('contain', 'tester:<p id="testing"')
})
it('should display $attrs', () => {
cy.get('.instance .instance:nth-child(2) .arrow-wrapper').click()
cy.get('.instance .instance .instance:nth-child(1) .item-name').click()
cy.get('.right .data-wrapper')
.should('contain', '$attrs')
.should('contain', 'attr:"some-attr"')
})
})
|