UBER-629 Fix Kick Employee action (#3523)

Signed-off-by: Alexander Onnikov <alexander.onnikov@xored.com>
This commit is contained in:
Alexander Onnikov 2023-07-26 17:22:03 +07:00 committed by GitHub
parent 3058d902fc
commit 1260c8770c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 72 additions and 9 deletions

View File

@ -1,5 +1,6 @@
//
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -764,7 +765,7 @@ export function createModel (builder: Builder): void {
},
secured: true
},
contact.action.KickEmployee
contact.action.DeleteEmployee
)
createAction(

View File

@ -1,5 +1,6 @@
//
// Copyright © 2020 Anticrm Platform Contributors.
// Copyright © 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -112,6 +113,7 @@ export default mergeIds(contactId, contact, {
},
action: {
KickEmployee: '' as Ref<Action>,
DeleteEmployee: '' as Ref<Action>,
MergeEmployee: '' as Ref<Action>
},
actionImpl: {

View File

@ -28,7 +28,8 @@
"Person": "Person",
"Organization": "Company",
"Employee": "Employee",
"DeleteEmployee": "Delete",
"DeleteEmployee": "Delete employee",
"DeleteEmployeeDescr": "Are you sure you want to delete the employee from the workspace?",
"Value": "Value",
"FullDescription": "Full description",
"Phone": "Phone",
@ -61,7 +62,7 @@
"Members": "Members",
"NoMembers": "No members added",
"AddMember": "Add member",
"KickEmployee": "Kick an employee",
"KickEmployee": "Kick employee",
"KickEmployeeDescr": "Are you sure you want to kick the employee out of the workspace? This action cannot be undone",
"Email": "Email",
"CreateEmployee": "Employee",
@ -70,7 +71,7 @@
"UseImage": "Attached photo",
"UseGravatar": "Gravatar",
"UseColor": "Color",
"NotSpecified": "Not specified",
"NotSpecified": "Not specified",
"Whatsapp": "Whatsapp",
"WhatsappPlaceholder": "Whatsapp",
"Skype": "Skype",

View File

@ -29,6 +29,7 @@
"Organization": "Компания",
"Employee": "Сотрудник",
"DeleteEmployee": "Удалить",
"DeleteEmployeeDescr": "Вы действительно хотите удалить сотрудника из рабочего пространства?",
"Value": "Значение",
"FullDescription": "Полное описание",
"Phone": "Телефон",

View File

@ -218,7 +218,7 @@ async function kickEmployee (doc: Employee): Promise<void> {
MessageBox,
{
label: contact.string.DeleteEmployee,
message: contact.string.DeleteEmployee
message: contact.string.DeleteEmployeeDescr
},
undefined,
(res?: boolean) => {

View File

@ -1,6 +1,6 @@
//
// Copyright © 2020, 2021 Anticrm Platform Contributors.
// Copyright © 2021 Hardcore Engineering Inc.
// Copyright © 2021, 2023 Hardcore Engineering Inc.
//
// Licensed under the Eclipse Public License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License. You may
@ -77,6 +77,7 @@ export default mergeIds(contactId, contact, {
CategoryComponentLead: '' as IntlString,
CategoryOther: '' as IntlString,
DeleteEmployee: '' as IntlString,
DeleteEmployeeDescr: '' as IntlString,
HasMessagesIn: '' as IntlString,
HasNewMessagesIn: '' as IntlString
},

View File

@ -6,10 +6,12 @@ docker-compose -p sanity up -d --force-recreate --renew-anon-volumes
./wait-elastic.sh 9201
# Creae workspace record in accounts
# Create workspace record in accounts
./tool.sh create-workspace sanity-ws -o SanityTest
# Create user record in accounts
./tool.sh create-account user1 -f John -l Appleseed -p 1234
# Make user the workspace maintainer
./tool.sh set-user-role user1 sanity-ws 1
./tool.sh confirm-email user1
./restore-workspace.sh

View File

@ -88,15 +88,70 @@ test.describe('contact tests', () => {
await page.locator('.antiCard button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
await expect(page.locator(`td:has-text("${last} ${first}")`)).toHaveCount(1)
// Click #context-menu svg
await page.hover(`td:has-text("${last} ${first}")`)
await page.click(`td:has-text("${last} ${first}")`, {
button: 'right'
})
await page.click('text="Delete"')
// Click text=Ok
// Click text=Yes
await page.click('text=Yes')
await expect(page.locator(`td:has-text("${first} ${last}")`)).toHaveCount(0)
await expect(page.locator(`td:has-text("${last} ${first}")`)).toHaveCount(0)
})
test('kick-and-delete-employee', async ({ page }) => {
// Create a new context with the saved storage state.
await page.locator('[id="app-contact\\:string\\:Contacts"]').click()
// Create employee
await page.click('.antiNav-element:has-text("Employee")')
await page.click('button:has-text("Employee")')
const first = 'Elton-' + generateId(5)
const last = 'John-' + generateId(5)
const mail = 'eltonjohn@' + generateId(5)
const firstName = page.locator('[placeholder="First name"]')
await firstName.click()
await firstName.fill(first)
const lastName = page.locator('[placeholder="Last name"]')
await lastName.click()
await lastName.fill(last)
const email = page.locator('[placeholder="Email"]')
await email.click()
await email.fill(mail)
await page.locator('.antiCard button:has-text("Create")').click()
await page.waitForSelector('form.antiCard', { state: 'detached' })
// Kick employee
// Click #context-menu svg
await page.hover(`td:has-text("${last} ${first}")`)
await page.click(`td:has-text("${last} ${first}")`, { button: 'right' })
await page.click('text="Kick employee"')
// Click text=Ok
await page.click('text=Ok')
await expect(page.locator(`td:has-text("${last} ${first}")`)).toHaveCount(1)
// We need some time to ensure that the status is proper one
await page.waitForTimeout(1000)
// Delete employee
// Click #context-menu svg
await page.hover(`td:has-text("${last} ${first}")`)
await page.click(`td:has-text("${last} ${first}")`, { button: 'right' })
await page.click('text="Delete employee"')
// Click text=Ok
await page.click('text=Ok')
await expect(page.locator(`td:has-text("${last} ${first}")`)).toHaveCount(0)
})
})