Skip to content

Commit d2ba6c1

Browse files
committedDec 2, 2024·
Remove tenant plan tests
1 parent 315ec08 commit d2ba6c1

File tree

2 files changed

+12
-196
lines changed

2 files changed

+12
-196
lines changed
 

‎cypress/e2e/tenants/tenants.spec.js

+1-185
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,6 @@ describe('Tenants', () => {
2828
cy.getListingItem(tenant.tenantName).find('.title a').click()
2929
}
3030

31-
const fillPlan = (plan, trial) => {
32-
cy.fillFields(plan)
33-
if (trial) {
34-
cy.checkToggle('test')
35-
} else {
36-
cy.uncheckToggle('test')
37-
}
38-
cy.clickModalAction()
39-
cy.getCy('modal_tenant_plan-edit').should('not.be.visible')
40-
}
41-
42-
const createPlan = (plan, trial, expectActive) => {
43-
cy.getCy('tenant-detail_add-plan').click()
44-
fillPlan(plan, trial)
45-
}
46-
4731
const expectAppName = (tenantName) => {
4832
cy.getCy('detail-page_header-title').contains(tenantName).should('exist')
4933
}
@@ -56,30 +40,12 @@ describe('Tenants', () => {
5640
cy.getCy('detail-page_metadata_enabled').find('.badge.bg-success').contains('Enabled').should('exist')
5741
}
5842

59-
const expectDisabled = () => {
60-
cy.getCy('detail-page_metadata_enabled').find('.badge.bg-danger').contains('Disabled').should('exist')
61-
}
62-
63-
const expectPlan = (plan, trial, expectActive) => {
64-
cy.getCy('plans-list_name').contains(plan.name).should('exist')
65-
if (trial) {
66-
cy.getCy('plans-list_name').find('.badge.bg-secondary').contains('Trial').should('exist')
67-
}
68-
69-
cy.getCy('plans-list_name').find('.badge.bg-success').should(expectActive ? 'exist' : 'not.exist')
70-
cy.getCy('plans-list_users').contains(plan.users || '-').should('exist')
71-
cy.getCy('plans-list_from').contains(`${plan.sinceDay}. ${plan.sinceMonth}. ${plan.sinceYear}`).should('exist')
72-
cy.getCy('plans-list_to').contains(`${plan.untilDay}. ${plan.untilMonth}. ${plan.untilYear}`).should('exist')
73-
}
74-
75-
7643
before(() => {
7744
cy.task('user:delete', { email: superAdmin.email })
7845
cy.createUser(superAdmin)
7946
cy.task('user:addPermission', { perm: 'TENANT_PERM', email: superAdmin.email })
8047
})
8148

82-
8349
beforeEach(() => {
8450
cy.task('tenant:delete', { tenant_id: tenant.tenantId })
8551
cy.task('tenant:delete', { tenant_id: newApp.tenantId })
@@ -112,154 +78,4 @@ describe('Tenants', () => {
11278
expectAppId(newApp.tenantId)
11379
expectEnabled()
11480
})
115-
116-
117-
it('add past plan', () => {
118-
createApp()
119-
120-
const plan = {
121-
name: 'Past plan',
122-
users: '10',
123-
sinceDay: '10',
124-
sinceMonth: '10',
125-
sinceYear: '2020',
126-
untilDay: '20',
127-
untilMonth: '12',
128-
untilYear: '2020',
129-
}
130-
createPlan(plan, true, false)
131-
expectPlan(plan, true, false)
132-
expectDisabled()
133-
})
134-
135-
136-
it('add current plan', () => {
137-
createApp()
138-
139-
const plan = {
140-
name: 'Current plan',
141-
users: '10',
142-
sinceDay: '10',
143-
sinceMonth: '10',
144-
sinceYear: '2020',
145-
untilDay: '20',
146-
untilMonth: '12',
147-
untilYear: '2050',
148-
}
149-
createPlan(plan, false, true)
150-
expectPlan(plan, false, true)
151-
expectEnabled()
152-
})
153-
154-
155-
it('add future plan', () => {
156-
createApp()
157-
158-
const plan = {
159-
name: 'Future plan',
160-
users: '10',
161-
sinceDay: '10',
162-
sinceMonth: '10',
163-
sinceYear: '2070',
164-
untilDay: '20',
165-
untilMonth: '12',
166-
untilYear: '2080',
167-
}
168-
createPlan(plan, false, false)
169-
expectPlan(plan, false, false)
170-
expectDisabled()
171-
})
172-
173-
174-
it('edit plan', () => {
175-
createApp()
176-
177-
// create current plan
178-
const plan = {
179-
name: 'Current plan',
180-
users: '10',
181-
sinceDay: '10',
182-
sinceMonth: '10',
183-
sinceYear: '2020',
184-
untilDay: '24',
185-
untilMonth: '12',
186-
untilYear: '2050',
187-
}
188-
createPlan(plan, false, true)
189-
expectPlan(plan, false, true)
190-
expectEnabled()
191-
192-
// edit it to be a past plan
193-
const plan2 = {
194-
name: 'Past plan now',
195-
users: '13',
196-
sinceDay: '10',
197-
sinceMonth: '10',
198-
sinceYear: '2020',
199-
untilDay: '23',
200-
untilMonth: '12',
201-
untilYear: '2020',
202-
}
203-
cy.getCy('tenant-detail_plan_edit').click()
204-
fillPlan(plan2, true)
205-
expectPlan(plan2, true, false)
206-
expectDisabled()
207-
208-
// edit it to be a future plan
209-
const plan3 = {
210-
name: 'Future plan now',
211-
users: '16',
212-
sinceDay: '10',
213-
sinceMonth: '10',
214-
sinceYear: '2060',
215-
untilDay: '22',
216-
untilMonth: '12',
217-
untilYear: '2070',
218-
}
219-
cy.getCy('tenant-detail_plan_edit').click()
220-
fillPlan(plan3, false)
221-
expectPlan(plan3, false, false)
222-
expectDisabled()
223-
224-
// edit it to be a current plan again
225-
const plan4 = {
226-
name: 'Current plan now',
227-
users: '19',
228-
sinceDay: '10',
229-
sinceMonth: '10',
230-
sinceYear: '2000',
231-
untilDay: '21',
232-
untilMonth: '12',
233-
untilYear: '2070',
234-
}
235-
cy.getCy('tenant-detail_plan_edit').click()
236-
fillPlan(plan4, false)
237-
expectPlan(plan4, false, true)
238-
expectEnabled()
239-
})
240-
241-
242-
it('delete plan', () => {
243-
createApp()
244-
245-
// create current plan
246-
const plan = {
247-
name: 'Current plan',
248-
users: '10',
249-
sinceDay: '10',
250-
sinceMonth: '10',
251-
sinceYear: '2020',
252-
untilDay: '24',
253-
untilMonth: '12',
254-
untilYear: '2050',
255-
}
256-
createPlan(plan, false, true)
257-
expectPlan(plan, false, true)
258-
expectEnabled()
259-
260-
cy.getCy('tenant-detail_plan_delete').click()
261-
cy.clickModalAction()
262-
cy.getCy('modal_tenant_plan-delete').should('not.be.visible')
263-
expectDisabled()
264-
})
265-
})
81+
})

‎cypress/plugins/index.js

+11-11
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ module.exports = (on, config) => {
182182
await userDelete({ tenant_uuid: uuid })
183183
await pg.delete({ table: 'action_key', where: { tenant_uuid: uuid } })
184184
await pg.delete({ table: 'locale', where: { tenant_uuid: uuid } })
185-
await pg.delete({ table: 'tenant_plan', where: { tenant_uuid: uuid } })
186185
await pg.delete({ table: 'tenant', where: { uuid } })
187186
}
188187
return true
@@ -221,16 +220,16 @@ module.exports = (on, config) => {
221220
return pg.update({
222221
table: 'tenant_limit_bundle',
223222
values: {
224-
active_users: null,
225-
branches: null,
226-
document_template_drafts: null,
227-
document_templates: null,
228-
documents: null,
229-
knowledge_models: null,
230-
locales: null,
231-
questionnaires: null,
232-
storage: null,
233-
users: null,
223+
active_users: -10000,
224+
branches: -10000,
225+
document_template_drafts: -10000,
226+
document_templates: -10000,
227+
documents: -10000,
228+
knowledge_models: -10000,
229+
locales: -10000,
230+
questionnaires: -10000,
231+
storage: -10000000000,
232+
users: -10000,
234233
},
235234
where
236235
})
@@ -255,6 +254,7 @@ module.exports = (on, config) => {
255254
const result = await pg.get({ table: 'user_entity', where })
256255
for (let i = 0; i < result.rows.length; i++) {
257256
const { uuid } = result.rows[i]
257+
await pg.delete({ table: 'audit', where: { created_by: uuid } })
258258
await pg.delete({ table: 'action_key', where: { identity: uuid } })
259259
await pg.delete({ table: 'user_token', where: { user_uuid: uuid } })
260260
await pg.delete({ table: 'persistent_command', where: { created_by: uuid } })

0 commit comments

Comments
 (0)
Please sign in to comment.