Skip to content

Commit 5df250f

Browse files
authored
fix(web-awesome): expand top-level steps by default; fix keyboard shortcuts styling (#683)
1 parent 2a4bdf8 commit 5df250f

14 files changed

Lines changed: 103 additions & 85 deletions

File tree

packages/web-awesome/src/components/KeyboardShortcuts/styles.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@
2222
overflow: auto;
2323
padding: 12px 16px;
2424
border-radius: 8px;
25-
border: 1px solid var(--on-border-muted);
26-
background: var(--bg-base-primary);
25+
border: 1px solid var(--color-border-default);
26+
background: var(--color-bg-raised);
2727
box-shadow: 0 8px 24px rgb(0 0 0 / 16%);
2828
}
2929

@@ -43,7 +43,7 @@
4343

4444
.groupTitle {
4545
margin-bottom: 6px;
46-
color: var(--on-text-secondary);
46+
color: var(--color-text-secondary);
4747
}
4848

4949
.item {
@@ -58,8 +58,8 @@
5858
flex-shrink: 0;
5959
font-family: var(--font-family-mono);
6060
font-size: var(--font-size-xs);
61-
color: var(--on-text-secondary);
62-
background: var(--bg-base-secondary);
61+
color: var(--color-text-secondary);
62+
background: var(--color-bg-neutral);
6363
border-radius: 4px;
6464
padding: 2px 6px;
6565
}

packages/web-awesome/src/components/MainReport/styles.scss

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,6 @@
1111
.scroll-inside {
1212
display: flex;
1313
flex-direction: column;
14-
overflow: hidden;
15-
height: 100%;
16-
min-height: 0;
1714
border-radius: 0;
1815
@include paneActive.split-pane-indicator;
1916

@@ -27,31 +24,13 @@
2724
}
2825

2926
.main-report-tabs {
30-
display: flex;
31-
flex: 1 1 auto;
32-
flex-direction: column;
33-
min-height: 0;
3427
padding: 0 24px;
35-
overflow: hidden;
36-
}
37-
38-
.main-report-tabs-layout {
39-
display: flex;
40-
flex: 1 1 auto;
41-
flex-direction: column;
42-
min-height: 0;
43-
overflow: hidden;
4428
}
4529

4630
.main-report-tabs-nav {
4731
flex-shrink: 0;
4832
}
4933

5034
.main-report-tabs-content {
51-
display: flex;
52-
flex: 1 1 auto;
53-
flex-direction: column;
54-
min-height: 0;
55-
overflow: hidden;
5635
border-top: 1px solid var(--color-border-default);
5736
}

packages/web-awesome/src/components/ReportBody/index.tsx

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
import { capitalize, statusesList } from "@allurereport/core-api";
22
import { Counter, Loadable } from "@allurereport/web-components";
3-
import clsx from "clsx";
43

54
import { reportStatsStore, statsByEnvStore } from "@/stores";
65
import { currentEnvironment } from "@/stores/env";
7-
import { isSplitMode } from "@/stores/layout";
86
import { useI18n } from "@/stores/locale";
97
import { setTreeStatus, treeStatus } from "@/stores/treeFilters/store";
108

@@ -64,24 +62,17 @@ const Header = () => {
6462
};
6563

6664
const Body = () => {
67-
const split = isSplitMode.value;
68-
6965
return (
70-
<div
71-
className={clsx(styles.body, split && styles["body-split"])}
72-
{...(split ? { "data-tree-scroll-container": true } : {})}
73-
>
66+
<div className={styles.body}>
7467
<TreeList />
7568
</div>
7669
);
7770
};
7871

7972
export const ReportBody = () => {
80-
const split = isSplitMode.value;
81-
8273
return (
8374
<ReportContentProvider>
84-
<section className={clsx(split && styles.split)}>
75+
<section>
8576
<Header />
8677
<Body />
8778
</section>

packages/web-awesome/src/components/ReportBody/styles.scss

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,3 @@
1-
.split {
2-
display: flex;
3-
flex: 1 1 auto;
4-
flex-direction: column;
5-
min-height: 0;
6-
overflow: hidden;
7-
}
8-
91
.header {
102
padding: 24px 0 0;
113
display: flex;
@@ -18,19 +10,6 @@
1810
z-index: 10;
1911
}
2012

21-
.split .header {
22-
position: static;
23-
z-index: auto;
24-
flex-shrink: 0;
25-
}
26-
27-
.split .body-split {
28-
flex: 1 1 auto;
29-
min-height: 0;
30-
overflow: auto;
31-
scrollbar-width: thin;
32-
}
33-
3413
.headerRow {
3514
display: flex;
3615
flex-direction: row;

packages/web-awesome/src/components/SplitLayout/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const MainReportWrapper = () => {
2121
const containerRef = useRef<HTMLDivElement>(null);
2222

2323
return (
24-
<div className={styles.wrapper} ref={containerRef}>
24+
<div className={styles.wrapper} ref={containerRef} data-tree-scroll-container>
2525
<MainReport />
2626
</div>
2727
);

packages/web-awesome/src/components/SplitLayout/styles.scss

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@
1616
position: relative;
1717
height: 100%;
1818
min-height: 0;
19+
overflow-y: auto;
20+
overflow-x: hidden;
21+
scrollbar-width: thin;
1922
}
2023

2124
.content {
@@ -85,7 +88,7 @@
8588

8689
.empty-split-pane {
8790
position: relative;
88-
background: var(--bg-base-primary);
91+
background: var(--color-bg-raised);
8992
border-radius: 12px;
9093
overflow: auto;
9194
@include paneActive.split-pane-indicator;

packages/web-awesome/src/components/TestResult/TrSetup/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export const TrSetup: FunctionalComponent<TrSetupProps> = ({ setup, id }) => {
4646
<div className={styles["test-result-steps-root"]}>
4747
{setup?.map((fixture, key) => (
4848
<div className={styles["test-result-step-root"]} key={fixture.id}>
49-
<TrStep item={fixtureResultToTrStepItem(fixture)} stepIndex={key + 1} />
49+
<TrStep item={fixtureResultToTrStepItem(fixture)} stepIndex={key + 1} isTopLevel={true} />
5050
</div>
5151
))}
5252
</div>

packages/web-awesome/src/components/TestResult/TrSteps/TrBodyItems.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,18 @@ const getBodyItemKey = (item: TrBodyItem, index: number) => {
2020

2121
export type TrBodyItemsProps = {
2222
bodyItems: TrBodyItem[];
23+
isTopLevel?: boolean;
2324
};
2425

25-
export const TrBodyItems: FunctionalComponent<TrBodyItemsProps> = ({ bodyItems }) => {
26+
export const TrBodyItems: FunctionalComponent<TrBodyItemsProps> = ({ bodyItems, isTopLevel }) => {
2627
return (
2728
<>
2829
{bodyItems.map((item, index) => {
2930
switch (item.type) {
3031
case "step":
31-
return <TrStep item={item} stepIndex={index + 1} key={getBodyItemKey(item, index)} />;
32+
return (
33+
<TrStep item={item} stepIndex={index + 1} isTopLevel={isTopLevel} key={getBodyItemKey(item, index)} />
34+
);
3235
case "attachment":
3336
return <TrAttachment item={item} stepIndex={index + 1} key={getBodyItemKey(item, index)} />;
3437
case "error":

packages/web-awesome/src/components/TestResult/TrSteps/TrStep.tsx

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import {
1616
collectExpandableStepNodes,
1717
hasStepContent,
1818
getStepTreeExpansionPolicy,
19+
isOpenByDefaultForPolicy,
1920
isStepOpenedByDefault,
2021
type SubtreeNode,
2122
} from "@/components/TestResult/TrSteps/stepTreeExpansion";
@@ -70,7 +71,8 @@ export const TrStepsContent = (props: { item: TrStepItem }) => {
7071
export const TrStep: FunctionComponent<{
7172
item: TrStepItem;
7273
stepIndex?: number;
73-
}> = ({ item, stepIndex }) => {
74+
isTopLevel?: boolean;
75+
}> = ({ item, stepIndex, isTopLevel }) => {
7476
const { item: stepData, bodyItems, suppressInlineError } = item;
7577
const inlineError = {
7678
message: stepData.message ?? stepData.error?.message,
@@ -85,7 +87,9 @@ export const TrStep: FunctionComponent<{
8587
);
8688
const policy = getStepTreeExpansionPolicy();
8789
const hasContent = hasStepContent(item);
88-
const openedByDefault = isStepOpenedByDefault(policy, stepData.status, bodyItems);
90+
const openedByDefault = isTopLevel
91+
? isOpenByDefaultForPolicy(policy, true)
92+
: isStepOpenedByDefault(policy, stepData.status, bodyItems);
8993
const isOpened = isTreeOpened(stepData.stepId, openedByDefault);
9094
const expandableDescendantNodes = collectExpandableStepNodes(bodyItems, policy);
9195
const hasExpandableDescendants = expandableDescendantNodes.length > 0;

packages/web-awesome/src/components/TestResult/TrSteps/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import { TrDropdown } from "@/components/TestResult/TrDropdown";
88
import {
99
collectExpandableStepNodes,
1010
getStepTreeExpansionPolicy,
11-
hasFailedStepContext,
1211
isOpenByDefaultForPolicy,
1312
isSubtreeFirstLevelOnlyOpened,
1413
type SubtreeNode,
@@ -35,7 +34,7 @@ export type TrStepsProps = {
3534
export const TrSteps: FunctionalComponent<TrStepsProps> = ({ bodyItems, id }) => {
3635
const stepsId = typeof id === "string" ? `${id}-steps` : null;
3736
const policy = getStepTreeExpansionPolicy();
38-
const isRootOpenedByDefault = isOpenByDefaultForPolicy(policy, hasFailedStepContext(bodyItems));
37+
const isRootOpenedByDefault = isOpenByDefaultForPolicy(policy, true);
3938
const isOpened = stepsId !== null ? isTreeOpened(stepsId, isRootOpenedByDefault) : isRootOpenedByDefault;
4039
const expandableTreeNodes = collectExpandableStepNodes(bodyItems, policy);
4140
const hasChildren = stepsId !== null && bodyItems.length > 0;
@@ -118,7 +117,7 @@ export const TrSteps: FunctionalComponent<TrStepsProps> = ({ bodyItems, id }) =>
118117
/>
119118
{isOpened && (
120119
<div data-testid="test-result-steps-root" className={styles["test-result-steps-root"]}>
121-
<TrBodyItems bodyItems={bodyItems} />
120+
<TrBodyItems bodyItems={bodyItems} isTopLevel={true} />
122121
</div>
123122
)}
124123
</div>

0 commit comments

Comments
 (0)