fix(tests): update timeline item locators and improve response status code assertion (#8202)

This commit is contained in:
sharan-bruno
2026-06-09 10:04:32 +05:30
committed by GitHub
parent 366d85b141
commit 95c75c90c1
4 changed files with 9 additions and 8 deletions

View File

@@ -145,6 +145,7 @@ const TimelineItem = ({
aria-expanded={isExpanded}
onClick={toggleExpand}
onKeyDown={handleRowKeyDown}
data-testid="timeline-item-header"
>
<div className="tl-col-chev">
{isExpanded ? <IconChevronDown size={14} strokeWidth={2} /> : <IconChevronRight size={14} strokeWidth={2} />}

View File

@@ -109,7 +109,7 @@ const Timeline = ({ collection, item }) => {
if (isGrpcRequest) {
return (
<div key={index} className="timeline-event">
<div key={index} className="timeline-event" data-testid="timeline-item">
<GrpcTimelineItem
timestamp={eventTimestamp}
request={request}
@@ -124,7 +124,7 @@ const Timeline = ({ collection, item }) => {
}
return (
<div key={index} className="timeline-event">
<div key={index} className="timeline-event" data-testid="timeline-item">
<TimelineItem
timestamp={timestamp}
request={request}
@@ -139,7 +139,7 @@ const Timeline = ({ collection, item }) => {
if (entry.type === 'oauth2' && entry._oauth2Child) {
return (
<div key={index} className="timeline-event">
<div key={index} className="timeline-event" data-testid="timeline-item">
<TimelineItem
timestamp={entry.timestamp}
request={entry._oauth2Child.request}
@@ -155,7 +155,7 @@ const Timeline = ({ collection, item }) => {
if (entry.type === 'scripted-request') {
return (
<div key={index} className="timeline-event">
<div key={index} className="timeline-event" data-testid="timeline-item">
<TimelineItem
timestamp={entry.timestamp}
request={entry.data?.request}

View File

@@ -62,7 +62,7 @@ test('Request inherits No Auth from the folder — collection Bearer Token is ov
});
await test.step('Verify the response status code is 401 Unauthorized', async () => {
await expect(locators.response.statusCode()).toContainText('401');
await expect(locators.response.statusCode()).toContainText('401 Unauthorized');
});
await test.step('Open the latest timeline entry and verify no Authorization header was sent', async () => {

View File

@@ -130,9 +130,9 @@ export const buildCommonLocators = (page: Page) => ({
jsonTreeLine: () => page.locator('.response-pane .object-content')
},
timeline: {
items: () => page.locator('.timeline-item'),
lastItem: () => page.locator('.timeline-item').last(),
itemHeader: (item: Locator) => item.locator('.oauth-request-item-header'),
items: () => page.getByTestId('timeline-item'),
lastItem: () => page.getByTestId('timeline-item').last(),
itemHeader: (item: Locator) => item.getByTestId('timeline-item-header'),
clearButton: () => page.getByRole('button', { name: 'Clear Timeline' })
},
plusMenu: {