Skip to content

Commit

Permalink
Merge pull request #25 from RahulARanger/dashboard-build
Browse files Browse the repository at this point in the history
Dashboard build
  • Loading branch information
RahulARanger authored Nov 30, 2023
2 parents 68e87b8 + 83dc2ca commit cea3367
Show file tree
Hide file tree
Showing 16 changed files with 167 additions and 75 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/dashboard-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
run: npm install

- name: Install Test Related Packages for mocha
working-directory: ./graspit-reporters/apps/test-mocha
working-directory: ./graspit-reporters/apps/test-wdio-mocha
run: npm install

- name: Install Test Related Packages for cucumber
Expand Down
2 changes: 1 addition & 1 deletion graspit-reporters/apps/test-wdio-cucumber/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@
},
"dependencies": {
"@wdio/cli": "^8.24.4",
"wdio-graspit-reporter": "^3.4.3"
"wdio-graspit-reporter": "^3.4.4"
}
}
2 changes: 1 addition & 1 deletion graspit-reporters/apps/test-wdio-mocha/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"@wdio/mocha-framework": "^8.24.5",
"@wdio/spec-reporter": "^8.24.2",
"ts-node": "^10.9.1",
"wdio-graspit-reporter": "3.4.3"
"wdio-graspit-reporter": "3.4.4"
},
"devDependencies": {
"cross-env": "^7.0.3"
Expand Down
7 changes: 7 additions & 0 deletions graspit-reporters/packages/graspit-commons/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
# graspit-commons

## 3.4.4

### Patch Changes

- Updated dependencies
- graspit@3.4.4

## 3.4.3

### Patch Changes
Expand Down
4 changes: 2 additions & 2 deletions graspit-reporters/packages/graspit-commons/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graspit-commons",
"version": "3.4.3",
"version": "3.4.4",
"types": "./dist/index.d.ts",
"main": "./dist/index.cjs",
"module": "./dist/index.js",
Expand All @@ -21,7 +21,7 @@
"dependencies": {
"async-lock": "^1.4.0",
"cross-env": "^7.0.3",
"graspit": "3.4.3",
"graspit": "3.4.4",
"log4js": "^6.9.1",
"superagent": "^8.1.2"
},
Expand Down
6 changes: 6 additions & 0 deletions graspit-reporters/packages/graspit-dashboard/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# graspit

## 3.4.4

### Patch Changes

- fixed styling issues

## 3.4.3

### Patch Changes
Expand Down
2 changes: 1 addition & 1 deletion graspit-reporters/packages/graspit-dashboard/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "graspit",
"version": "3.4.3",
"version": "3.4.4",
"license": "MIT",
"scripts": {
"dev": "next dev",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,10 +111,7 @@ export default function AreaChartsForRuns(properties: {
type: 'category',
boundaryGap: false,
data: properties.runs.map((run) =>
dayjs
.utc(run.started)
.utcOffset(0, true)
.format(dateTimeFormatUsed),
dayjs(run.started).format(dateTimeFormatUsed),
),
},
yAxis: [
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type TestRunRecord from 'src/types/test-run-records';
import React, { useState, type ReactNode } from 'react';
import { parseDetailedTestRun } from 'src/components/parse-utils';
import { parseDetailedTestRun, sourceUrl } from 'src/components/parse-utils';
import RenderTimeRelativeToStart, {
RenderDuration,
} from 'src/components/utils/renderers';
Expand Down Expand Up @@ -29,6 +29,8 @@ import Text from 'antd/lib/typography/Text';
import Link from 'antd/lib/typography/Link';
import isBetween from 'dayjs/plugin/isBetween';
import Button from 'antd/lib/button/button';
import type { RangePickerProps } from 'antd/es/date-picker';
import GithubOutlined from '@ant-design/icons/GithubOutlined';

dayjs.extend(isBetween);

Expand Down Expand Up @@ -239,7 +241,10 @@ function ListOfCharts(properties: { runs: TestRunRecord[] }): ReactNode {
/>
}
>
<AreaChartForRuns runs={properties.runs} showTest={isTest} />
<AreaChartForRuns
runs={properties.runs.toReversed()}
showTest={isTest}
/>
</Card>
);

Expand Down Expand Up @@ -325,6 +330,17 @@ export default function GridOfRuns(properties: {
...new Set(properties.runs.map((run) => run.projectName)),
].map((projectName) => ({ label: projectName, value: projectName }));

const disabledDate: RangePickerProps['disabledDate'] = (
current: dayjs.Dayjs,
) => {
return !current.isBetween(
dayjs(properties.runs.at(0)?.started),
dayjs(properties.runs.at(-1)?.started),
'date',
'[]',
);
};

return (
<Layout
style={{
Expand All @@ -333,27 +349,45 @@ export default function GridOfRuns(properties: {
}}
>
<Layout.Header className={HeaderStyles.header} spellCheck>
<Space align="baseline" size="large">
<BreadCrumb items={crumbs(false, filteredRuns.length)} />
<Divider type="vertical" />
<Tooltip title="Filters are on the right">
<FilterOutlined />
</Tooltip>
<Select
options={projectNames}
allowClear
value={selectedProjectName}
placeholder="Select Project Name"
style={{ minWidth: '180px' }}
onChange={(selected) => {
filterProjectName(selected);
}}
/>
<DatePicker.RangePicker
value={dateRange}
onChange={(values) => {
setDateRange(values);
}}
<Space
style={{
justifyContent: 'space-between',
width: '100%',
marginRight: '20px',
marginTop: '1px',
}}
align="center"
>
<Space align="baseline" size="large">
<BreadCrumb
items={crumbs(false, filteredRuns.length)}
/>
<Divider type="vertical" />
<Tooltip title="Filters are on the right">
<FilterOutlined />
</Tooltip>
<Select
options={projectNames}
allowClear
value={selectedProjectName}
placeholder="Select Project Name"
style={{ minWidth: '180px' }}
onChange={(selected) => {
filterProjectName(selected);
}}
/>
<DatePicker.RangePicker
value={dateRange}
onChange={(values) => {
setDateRange(values);
}}
disabledDate={disabledDate}
/>
</Space>
<Button
icon={<GithubOutlined style={{ fontSize: 20 }} />}
href={sourceUrl}
target="_blank"
/>
</Space>
</Layout.Header>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ import type {
SuiteRecordDetails,
} from 'src/types/test-entity-related';
import { timelineColor } from 'src/components/parse-utils';
import RenderTimeRelativeToStart, {
RenderDuration,
} from 'src/components/utils/renderers';
import { RenderDuration } from 'src/components/utils/renderers';
import type { PreviewForTests } from 'src/types/parsed-records';

import React, { type ReactNode } from 'react';
Expand All @@ -22,6 +20,7 @@ import Text from 'antd/lib/typography/Text';
import { dateTimeFormatUsed } from 'src/components/utils/Datetime/format';
import { Tag } from 'antd/lib';
import Avatar from 'antd/lib/avatar/avatar';
import RelativeTo from 'src/components/utils/Datetime/relative-time';

export function EntityCollapsibleItem(properties: {
item: PreviewForTests;
Expand All @@ -31,16 +30,15 @@ export function EntityCollapsibleItem(properties: {
const aboutSuite: DescriptionsProps['items'] = [
{
key: 'started',
label: 'Started',
label: 'Range',
children: (
<RenderTimeRelativeToStart value={properties.item.Started} />
),
},
{
key: 'ended',
label: 'Ended',
children: (
<RenderTimeRelativeToStart value={properties.item.Ended} />
<RelativeTo
dateTime={properties.item.Started[0]}
secondDateTime={properties.item.Ended[0]}
style={{
maxWidth: '180px',
}}
/>
),
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
getWrittenAttachments,
} from 'src/components/scripts/helper';
import BadgeForSuiteType from 'src/components/utils/test-status-dot';
import RenderTimeRelativeToStart, {
import {
RenderEntityType,
RenderStatus,
RenderDuration,
Expand Down Expand Up @@ -60,6 +60,7 @@ import Badge from 'antd/lib/badge/index';
import Meta from 'antd/lib/card/Meta';
import TreeSelectionOfSuites, { NavigationButtons } from './header';
import { EntityCollapsibleItem, EntityTimeline } from './entity-item';
import RelativeTo from 'src/components/utils/Datetime/relative-time';

export default function TestEntityDrawer(properties: {
open: boolean;
Expand Down Expand Up @@ -224,33 +225,57 @@ export default function TestEntityDrawer(properties: {
);
});

const testAttachments = Object.values(attachments)
.flat()
.filter(
(attached) =>
tests[attached.entity_id]?.parent ===
selectedSuiteDetails.suiteID,
);

const savedAttachments = Object.values(writtenAttachments)
.flat()
.filter(
(attached) =>
tests[attached.entity_id]?.parent ===
selectedSuiteDetails.suiteID,
);
const aboutSuite: DescriptionsProps['items'] = [
{
key: 'started',
label: 'Started',
key: 'range',
label: 'Range',
children: (
<RenderTimeRelativeToStart
value={[dayjs(selectedSuiteDetails.started), started]}
style={{ minWidth: '120px' }}
<RelativeTo
dateTime={dayjs(selectedSuiteDetails.started)}
secondDateTime={dayjs(selectedSuiteDetails.ended)}
style={{
maxWidth: '180px',
}}
/>
),
span: 1.5,
},
{
key: 'ended',
label: 'Ended',
key: 'duration',
label: 'Duration',
children: (
<RenderTimeRelativeToStart
value={[dayjs(selectedSuiteDetails.ended), started]}
style={{ minWidth: '120px' }}
<RenderDuration
value={dayjs.duration(selectedSuiteDetails.duration)}
style={{ maxWidth: '80px' }}
/>
),
},
{
key: 'duration',
label: 'Duration',
key: 'tests',
label: 'Contribution',
children: (
<RenderDuration
value={dayjs.duration(selectedSuiteDetails.duration)}
<StaticPercent
percent={
((selectedSuiteDetails.rollup_tests ??
selectedSuiteDetails.tests) /
Object.keys(tests).length) *
100
}
/>
),
},
Expand All @@ -266,15 +291,27 @@ export default function TestEntityDrawer(properties: {
),
},
{
key: 'tests',
label: 'Contribution',
key: 'assertions',
label: 'Assertions',
children: (
<StaticPercent
percent={
((selectedSuiteDetails.rollup_tests ??
selectedSuiteDetails.tests) /
Object.keys(tests).length) *
100
<Counter
end={
testAttachments.filter(
(attach) => attach.type === 'ASSERT',
).length
}
/>
),
},
{
key: 'images',
label: 'Images',
children: (
<Counter
end={
savedAttachments.filter(
(attach) => attach.type === 'PNG',
).length
}
/>
),
Expand All @@ -285,6 +322,7 @@ export default function TestEntityDrawer(properties: {
'Passed',
'Failed',
'Skipped',
'Retried',
].map((status) => ({
label: (
<Space>
Expand Down Expand Up @@ -381,6 +419,7 @@ export default function TestEntityDrawer(properties: {
onChange={(value) => {
setFilterStatus(value);
}}
popupMatchSelectWidth={120}
/>
<Button
key="attachments"
Expand Down
Loading

0 comments on commit cea3367

Please sign in to comment.