Skip to content

Commit

Permalink
UBERF-8584: Add test runs (#7235)
Browse files Browse the repository at this point in the history
Signed-off-by: Artem Savchenko <[email protected]>
  • Loading branch information
ArtyomSavchenko authored Nov 28, 2024
1 parent 61f7770 commit da85d6d
Show file tree
Hide file tree
Showing 60 changed files with 2,379 additions and 554 deletions.
51 changes: 0 additions & 51 deletions models/test-management/src/defaultTypes.ts

This file was deleted.

197 changes: 151 additions & 46 deletions models/test-management/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
import activity from '@hcengineering/activity'
import chunter from '@hcengineering/chunter'
import core from '@hcengineering/model-core'
import { SortingOrder } from '@hcengineering/core'
import { SortingOrder, type FindOptions } from '@hcengineering/core'

import { type Builder } from '@hcengineering/model'
import view, { createAction } from '@hcengineering/model-view'
Expand All @@ -25,7 +25,7 @@ import print from '@hcengineering/model-print'
import tracker from '@hcengineering/model-tracker'
import { type ViewOptionsModel } from '@hcengineering/view'

import { testManagementId } from '@hcengineering/test-management'
import { testManagementId, type TestResult } from '@hcengineering/test-management'

import {
DOMAIN_TEST_MANAGEMENT,
Expand All @@ -37,8 +37,8 @@ import {
TTestCase,
TDefaultProjectTypeData,
TTestRun,
TTypeTestRunResult,
TTestRunItem
TTypeTestRunStatus,
TTestResult
} from './types'

import testManagement from './plugin'
Expand All @@ -55,7 +55,6 @@ function defineApplication (builder: Builder): void {
icon: testManagement.icon.TestManagementApplication,
alias: testManagementId,
hidden: false,
locationResolver: testManagement.resolver.Location,
navigatorModel: {
spaces: [
{
Expand Down Expand Up @@ -85,6 +84,7 @@ function defineApplication (builder: Builder): void {
mainComponentLabel: testManagement.string.TestCases,
mainComponentIcon: testManagement.icon.TestCases,
createComponent: testManagement.component.CreateTestSuite,
mainHeaderComponent: testManagement.component.RunSelectedTestsButton,
navigationComponentProps: {
_class: testManagement.class.TestSuite,
icon: testManagement.icon.TestSuites,
Expand All @@ -100,21 +100,34 @@ function defineApplication (builder: Builder): void {
},
syncWithLocationQuery: true
}
}
/* TODO: UBERF-8584
},
{
id: opt.testRunsId,
id: 'testRuns',
label: testManagement.string.TestRuns,
icon: testManagement.icon.TestRuns,
component: workbench.component.SpecialView,
componentProps: {
_class: testManagement.class.TestRun,
_class: testManagement.class.TestResult,
icon: testManagement.icon.TestRuns,
title: testManagement.string.TestRuns,
createLabel: testManagement.string.NewTestRun,
createComponent: testManagement.component.CreateTestRun
label: testManagement.string.TestRuns
},
navigationModel: {
navigationComponent: view.component.FoldersBrowser,
navigationComponentLabel: testManagement.string.TestRun,
navigationComponentIcon: testManagement.icon.TestRuns,
mainComponentLabel: testManagement.string.TestResults,
mainComponentIcon: testManagement.icon.TestResult,
navigationComponentProps: {
_class: testManagement.class.TestRun,
icon: testManagement.icon.TestRuns,
title: testManagement.string.TestSuites,
titleKey: 'name',
getFolderLink: testManagement.function.GetTestRunLink,
plainList: true
},
syncWithLocationQuery: true
}
} */
}
]
}
]
Expand All @@ -135,8 +148,8 @@ export function createModel (builder: Builder): void {
TTestCase,
TDefaultProjectTypeData,
TTestRun,
TTestRunItem,
TTypeTestRunResult
TTypeTestRunStatus,
TTestResult
)

builder.mixin(testManagement.class.TestProject, core.class.Class, activity.mixin.ActivityDoc, {})
Expand Down Expand Up @@ -204,7 +217,7 @@ function defineSpaceType (builder: Builder): void {
core.class.SpaceType,
core.space.Model,
{
name: 'Default project type',
name: 'Default Test Management',
descriptor: testManagement.descriptors.ProjectType,
roles: 0,
targetClass: testManagement.mixin.DefaultProjectTypeData
Expand Down Expand Up @@ -250,13 +263,7 @@ function defineTestSuite (builder: Builder): void {
// Actions

builder.mixin(testManagement.class.TestSuite, core.class.Class, view.mixin.IgnoreActions, {
actions: [
view.action.Open,
view.action.OpenInNewTab,
print.action.Print,
tracker.action.EditRelatedTargets,
tracker.action.NewRelatedIssue
]
actions: [print.action.Print, tracker.action.EditRelatedTargets]
})

createAction(
Expand All @@ -276,6 +283,24 @@ function defineTestSuite (builder: Builder): void {
},
testManagement.action.CreateChildTestSuite
)

createAction(
builder,
{
action: testManagement.actionImpl.RunSelectedTests,
label: testManagement.string.CreateTestRun,
icon: testManagement.icon.TestRuns,
category: testManagement.category.TestCase,
input: 'selection',
target: testManagement.class.TestCase,
context: {
mode: ['context'],
application: testManagement.app.TestManagement,
group: 'create'
}
},
testManagement.action.RunSelectedTests
)
}

function defineTestCase (builder: Builder): void {
Expand Down Expand Up @@ -306,6 +331,11 @@ function defineTestCase (builder: Builder): void {
presenter: testManagement.component.TestSuiteRefPresenter
})

builder.mixin(testManagement.class.TestCase, core.class.Class, view.mixin.ClassFilters, {
filters: ['priority', 'status'],
ignoreKeys: ['createdBy', 'modifiedBy', 'createdOn', 'modifiedOn']
})

builder.createDoc(
view.class.Viewlet,
core.space.Model,
Expand Down Expand Up @@ -350,6 +380,7 @@ function defineTestCase (builder: Builder): void {
hiddenKeys: ['title']
},
config: [
{ key: '', displayProps: { fixed: 'left' } },
{
key: 'status',
props: { kind: 'list', size: 'small', shouldShowName: false },
Expand All @@ -368,21 +399,6 @@ function defineTestCase (builder: Builder): void {
},
testManagement.viewlet.ListTestCase
)

builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: testManagement.class.TestCase,
descriptor: view.viewlet.Table,
config: ['', 'assignee', 'modifiedOn'],
configOptions: {
sortable: true
},
variant: 'short'
},
testManagement.viewlet.SuiteTestCases
)
}

function defineTestRun (builder: Builder): void {
Expand All @@ -393,10 +409,6 @@ function defineTestRun (builder: Builder): void {
components: { input: { component: chunter.component.ChatMessageInput } }
})

builder.mixin(testManagement.class.TestRun, core.class.Class, view.mixin.ObjectEditor, {
editor: testManagement.component.EditTestRun
})

builder.mixin(testManagement.class.TestRun, core.class.Class, view.mixin.ObjectPanel, {
component: testManagement.component.EditTestRun
})
Expand All @@ -405,18 +417,111 @@ function defineTestRun (builder: Builder): void {
presenter: testManagement.component.TestRunPresenter
})

builder.mixin(testManagement.class.TestRun, core.class.Class, view.mixin.ObjectIcon, {
component: testManagement.component.TestResultStatusPresenter
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ObjectPresenter, {
presenter: testManagement.component.TestResultPresenter
})

builder.mixin(testManagement.class.TestResult, core.class.Class, activity.mixin.ActivityDoc, {})

builder.createDoc(activity.class.ActivityExtension, core.space.Model, {
ofClass: testManagement.class.TestResult,
components: { input: { component: chunter.component.ChatMessageInput } }
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ObjectEditor, {
editor: testManagement.component.EditTestResult
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ObjectEditorHeader, {
editor: testManagement.component.TestResultHeader
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ObjectPanel, {
component: testManagement.component.EditTestResult
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ObjectPanelFooter, {
editor: testManagement.component.TestResultFooter
})

builder.mixin(testManagement.class.TestResult, core.class.Class, view.mixin.ClassFilters, {
filters: ['assignee', 'status', 'testSuite'],
ignoreKeys: ['createdBy', 'modifiedBy', 'createdOn', 'modifiedOn']
})

const viewOptions: ViewOptionsModel = {
groupBy: ['testSuite'],
orderBy: [
['status', SortingOrder.Ascending],
['modifiedOn', SortingOrder.Descending],
['createdOn', SortingOrder.Descending]
],
other: [
{
key: 'shouldShowAll',
type: 'toggle',
defaultValue: false,
actionTarget: 'category',
action: view.function.ShowEmptyGroups,
label: view.string.ShowEmptyGroups
}
]
}

builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: testManagement.class.TestRun,
attachTo: testManagement.class.TestResult,
descriptor: view.viewlet.List,
configOptions: {
strict: true,
hiddenKeys: ['title', 'status', 'modifiedOn']
},
config: [
{ key: '', displayProps: { fixed: 'left' } },
{
key: 'status',
props: { kind: 'list', size: 'small', shouldShowName: false }
},
{
key: 'assignee',
props: { kind: 'list', shouldShowName: false, avatarSize: 'x-small' },
displayProps: { key: 'assignee', fixed: 'right' }
}
],
viewOptions,
/* eslint-disable @typescript-eslint/consistent-type-assertions */
options: {
lookup: {
testCase: testManagement.class.TestCase
}
} as FindOptions<TestResult>
},
testManagement.viewlet.TestResultList
)

builder.createDoc(
view.class.Viewlet,
core.space.Model,
{
attachTo: testManagement.class.TestResult,
descriptor: view.viewlet.Table,
config: [''],
config: ['', 'testSuite', 'status', 'assignee'],
configOptions: {
strict: true
}
},
options: {
lookup: {
testCase: testManagement.class.TestCase
}
} as FindOptions<TestResult>
},
testManagement.viewlet.TableTestRun
testManagement.viewlet.TableTestResult
)
}

Expand Down
Loading

0 comments on commit da85d6d

Please sign in to comment.