Separate locator display from other action contexts
This commit is contained in:
parent
366dad572f
commit
6a9e976978
|
|
@ -70,13 +70,20 @@
|
||||||
flex: none;
|
flex: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.action-selector {
|
.action-context {
|
||||||
display: inline;
|
display: inline;
|
||||||
flex: none;
|
flex: none;
|
||||||
padding-left: 5px;
|
padding-left: 5px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.action-locator-context {
|
||||||
color: var(--vscode-charts-orange);
|
color: var(--vscode-charts-orange);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.action-generic-context {
|
||||||
|
color: var(--vscode-charts-purple);
|
||||||
|
}
|
||||||
|
|
||||||
.action-url {
|
.action-url {
|
||||||
display: inline;
|
display: inline;
|
||||||
flex: none;
|
flex: none;
|
||||||
|
|
|
||||||
|
|
@ -15,18 +15,17 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
import type { ActionTraceEvent, AfterActionTraceEventAttachment } from '@trace/trace';
|
import type { ActionTraceEvent, AfterActionTraceEventAttachment } from '@trace/trace';
|
||||||
import { msToString } from '@web/uiUtils';
|
import { clsx, msToString } from '@web/uiUtils';
|
||||||
import * as React from 'react';
|
import * as React from 'react';
|
||||||
import './actionList.css';
|
import './actionList.css';
|
||||||
import * as modelUtil from './modelUtil';
|
import * as modelUtil from './modelUtil';
|
||||||
import { asLocator } from '@isomorphic/locatorGenerators';
|
|
||||||
import type { Language } from '@isomorphic/locatorGenerators';
|
import type { Language } from '@isomorphic/locatorGenerators';
|
||||||
import type { TreeState } from '@web/components/treeView';
|
import type { TreeState } from '@web/components/treeView';
|
||||||
import { TreeView } from '@web/components/treeView';
|
import { TreeView } from '@web/components/treeView';
|
||||||
import type { ActionTraceEventInContext, ActionTreeItem } from './modelUtil';
|
import type { ActionTraceEventInContext, ActionTreeItem } from './modelUtil';
|
||||||
import type { Boundaries } from './geometry';
|
import type { Boundaries } from './geometry';
|
||||||
import { ToolbarButton } from '@web/components/toolbarButton';
|
import { ToolbarButton } from '@web/components/toolbarButton';
|
||||||
import { commandContextString } from './string';
|
import { actionContextString } from './string';
|
||||||
|
|
||||||
export interface ActionListProps {
|
export interface ActionListProps {
|
||||||
actions: ActionTraceEventInContext[],
|
actions: ActionTraceEventInContext[],
|
||||||
|
|
@ -105,6 +104,29 @@ export const ActionList: React.FC<ActionListProps> = ({
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const ActionContext: React.FC<{
|
||||||
|
action: ActionTraceEvent;
|
||||||
|
sdkLanguage: Language;
|
||||||
|
}> = ({ action, sdkLanguage }) => {
|
||||||
|
const contextString = actionContextString(action, sdkLanguage);
|
||||||
|
|
||||||
|
if (contextString === undefined)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div
|
||||||
|
className={clsx(
|
||||||
|
'action-context',
|
||||||
|
action.apiName.startsWith('locator')
|
||||||
|
? 'action-locator-context'
|
||||||
|
: 'action-generic-context',
|
||||||
|
)}
|
||||||
|
>
|
||||||
|
{contextString}
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
};
|
||||||
|
|
||||||
export const renderAction = (
|
export const renderAction = (
|
||||||
action: ActionTraceEvent,
|
action: ActionTraceEvent,
|
||||||
options: {
|
options: {
|
||||||
|
|
@ -117,7 +139,6 @@ export const renderAction = (
|
||||||
}) => {
|
}) => {
|
||||||
const { sdkLanguage, revealConsole, revealAttachment, isLive, showDuration, showBadges } = options;
|
const { sdkLanguage, revealConsole, revealAttachment, isLive, showDuration, showBadges } = options;
|
||||||
const { errors, warnings } = modelUtil.stats(action);
|
const { errors, warnings } = modelUtil.stats(action);
|
||||||
const locator = commandContextString(action, sdkLanguage || 'javascript');
|
|
||||||
const showAttachments = !!action.attachments?.length && !!revealAttachment;
|
const showAttachments = !!action.attachments?.length && !!revealAttachment;
|
||||||
|
|
||||||
let time: string = '';
|
let time: string = '';
|
||||||
|
|
@ -130,7 +151,7 @@ export const renderAction = (
|
||||||
return <>
|
return <>
|
||||||
<div className='action-title' title={action.apiName}>
|
<div className='action-title' title={action.apiName}>
|
||||||
<span>{action.apiName}</span>
|
<span>{action.apiName}</span>
|
||||||
{locator && <div className='action-selector' title={locator}>{locator}</div>}
|
<ActionContext action={action} sdkLanguage={sdkLanguage || 'javascript'} />
|
||||||
{action.method === 'goto' && action.params.url && <div className='action-url' title={action.params.url}>{action.params.url}</div>}
|
{action.method === 'goto' && action.params.url && <div className='action-url' title={action.params.url}>{action.params.url}</div>}
|
||||||
{action.class === 'APIRequestContext' && action.params.url && <div className='action-url' title={action.params.url}>{excludeOrigin(action.params.url)}</div>}
|
{action.class === 'APIRequestContext' && action.params.url && <div className='action-url' title={action.params.url}>{excludeOrigin(action.params.url)}</div>}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ const formatTouchscreenParams = (params: {
|
||||||
return undefined;
|
return undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
export const commandContextString = (
|
export const actionContextString = (
|
||||||
action: ActionTraceEvent,
|
action: ActionTraceEvent,
|
||||||
sdkLanguage: Language,
|
sdkLanguage: Language,
|
||||||
): string | undefined => {
|
): string | undefined => {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue