mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge pull request #1420 from gradido/test-row-toggling
feat: Test Table Row Details Toggling
This commit is contained in:
commit
165dba92a4
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -448,7 +448,7 @@ jobs:
|
|||||||
report_name: Coverage Admin Interface
|
report_name: Coverage Admin Interface
|
||||||
type: lcov
|
type: lcov
|
||||||
result_path: ./coverage/lcov.info
|
result_path: ./coverage/lcov.info
|
||||||
min_coverage: 88
|
min_coverage: 91
|
||||||
token: ${{ github.token }}
|
token: ${{ github.token }}
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
|
|||||||
@ -9,10 +9,35 @@ const apolloQueryMock = jest.fn().mockResolvedValue({
|
|||||||
userCount: 1,
|
userCount: 1,
|
||||||
userList: [
|
userList: [
|
||||||
{
|
{
|
||||||
|
userId: 1,
|
||||||
firstName: 'Bibi',
|
firstName: 'Bibi',
|
||||||
lastName: 'Bloxberg',
|
lastName: 'Bloxberg',
|
||||||
email: 'bibi@bloxberg.de',
|
email: 'bibi@bloxberg.de',
|
||||||
creation: [200, 400, 600],
|
creation: [200, 400, 600],
|
||||||
|
emailChecked: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userId: 2,
|
||||||
|
firstName: 'Benjamin',
|
||||||
|
lastName: 'Blümchen',
|
||||||
|
email: 'benjamin@bluemchen.de',
|
||||||
|
creation: [1000, 1000, 1000],
|
||||||
|
emailChecked: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userId: 3,
|
||||||
|
firstName: 'Peter',
|
||||||
|
lastName: 'Lustig',
|
||||||
|
email: 'peter@lustig.de',
|
||||||
|
creation: [0, 0, 0],
|
||||||
|
emailChecked: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
userId: 4,
|
||||||
|
firstName: 'New',
|
||||||
|
lastName: 'User',
|
||||||
|
email: 'new@user.ch',
|
||||||
|
creation: [1000, 1000, 1000],
|
||||||
emailChecked: false,
|
emailChecked: false,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
@ -24,7 +49,7 @@ const toastErrorMock = jest.fn()
|
|||||||
|
|
||||||
const mocks = {
|
const mocks = {
|
||||||
$t: jest.fn((t) => t),
|
$t: jest.fn((t) => t),
|
||||||
$d: jest.fn((d) => d),
|
$d: jest.fn((d) => String(d)),
|
||||||
$apollo: {
|
$apollo: {
|
||||||
query: apolloQueryMock,
|
query: apolloQueryMock,
|
||||||
},
|
},
|
||||||
@ -63,6 +88,100 @@ describe('UserSearch', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
describe('row toggling', () => {
|
||||||
|
it('has 4 users in the table', () => {
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(4)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('user with email not activated', () => {
|
||||||
|
it('has no details button', () => {
|
||||||
|
expect(
|
||||||
|
wrapper.findAll('tbody > tr').at(3).findAll('td').at(4).find('button').exists(),
|
||||||
|
).toBeFalsy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it('has a red confirmed button with envelope item', () => {
|
||||||
|
const row = wrapper.findAll('tbody > tr').at(3)
|
||||||
|
expect(row.findAll('td').at(5).find('button').exists()).toBeTruthy()
|
||||||
|
expect(row.findAll('td').at(5).find('button').classes('btn-danger')).toBeTruthy()
|
||||||
|
expect(row.findAll('td').at(5).find('svg').classes('bi-envelope')).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('click on envelope', () => {
|
||||||
|
it('opens the details', async () => {
|
||||||
|
await wrapper
|
||||||
|
.findAll('tbody > tr')
|
||||||
|
.at(3)
|
||||||
|
.findAll('td')
|
||||||
|
.at(5)
|
||||||
|
.find('button')
|
||||||
|
.trigger('click')
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(6)
|
||||||
|
expect(wrapper.findAll('tbody > tr').at(5).find('input').element.value).toBe(
|
||||||
|
'new@user.ch',
|
||||||
|
)
|
||||||
|
expect(wrapper.findAll('tbody > tr').at(5).text()).toContain(
|
||||||
|
'unregister_mail.text_false',
|
||||||
|
)
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('click on envelope again', () => {
|
||||||
|
it('closes the details', async () => {
|
||||||
|
await wrapper
|
||||||
|
.findAll('tbody > tr')
|
||||||
|
.at(3)
|
||||||
|
.findAll('td')
|
||||||
|
.at(5)
|
||||||
|
.find('button')
|
||||||
|
.trigger('click')
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(4)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('click on close details', () => {
|
||||||
|
it('closes the details', async () => {
|
||||||
|
await wrapper
|
||||||
|
.findAll('tbody > tr')
|
||||||
|
.at(3)
|
||||||
|
.findAll('td')
|
||||||
|
.at(5)
|
||||||
|
.find('button')
|
||||||
|
.trigger('click')
|
||||||
|
await wrapper.findAll('tbody > tr').at(5).findAll('button').at(1).trigger('click')
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(4)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
describe('different details', () => {
|
||||||
|
it.skip('shows the creation formular for second user', async () => {
|
||||||
|
await wrapper
|
||||||
|
.findAll('tbody > tr')
|
||||||
|
.at(1)
|
||||||
|
.findAll('td')
|
||||||
|
.at(4)
|
||||||
|
.find('button')
|
||||||
|
.trigger('click')
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(6)
|
||||||
|
expect(
|
||||||
|
wrapper.findAll('tbody > tr').at(3).find('div.component-creation-formular').exists(),
|
||||||
|
).toBeTruthy()
|
||||||
|
})
|
||||||
|
|
||||||
|
it.skip('shows the transactions for third user', async () => {
|
||||||
|
await wrapper
|
||||||
|
.findAll('tbody > tr')
|
||||||
|
.at(4)
|
||||||
|
.findAll('td')
|
||||||
|
.at(6)
|
||||||
|
.find('button')
|
||||||
|
.trigger('click')
|
||||||
|
expect(wrapper.findAll('tbody > tr')).toHaveLength(6)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
describe('unconfirmed emails', () => {
|
describe('unconfirmed emails', () => {
|
||||||
beforeEach(async () => {
|
beforeEach(async () => {
|
||||||
await wrapper.find('button.btn-block').trigger('click')
|
await wrapper.find('button.btn-block').trigger('click')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user