Skip to content

Commit

Permalink
Add a responses counter (mockoon#1539)
Browse files Browse the repository at this point in the history
  • Loading branch information
255kb authored Oct 7, 2024
1 parent 97de73f commit e0a9e5e
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -182,33 +182,44 @@
*ngIf="data.activeRouteResponse"
class="dropdown-toggle-label"
>
<span *ngIf="data.activeRoute.type === 'ws'" class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }}
</span>
<span *ngIf="data.activeRoute?.type === 'http'" class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }} ({{
data.activeRouteResponse?.statusCode
}})
</span>
<span
*ngIf="
data.activeRoute?.type === 'crud' &&
!data.activeRouteResponse?.default
"
class="pe-2"
>Response {{ data.activeRouteResponseIndex }} ({{
data.activeRouteResponse?.statusCode
}})
</span>
<span
*ngIf="
data.activeRoute?.type === 'crud' &&
data.activeRouteResponse?.default
"
class="pe-2"
>CRUD operations
</span>
{{ data.activeRouteResponse?.label }}
<div class="d-flex">
<div class="text-truncate me-2">
<span *ngIf="data.activeRoute.type === 'ws'" class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }}
</span>
<span
*ngIf="data.activeRoute?.type === 'http'"
class="pe-2"
>Response {{ data.activeRouteResponseIndex + 1 }} ({{
data.activeRouteResponse?.statusCode
}})
</span>
<span
*ngIf="
data.activeRoute?.type === 'crud' &&
!data.activeRouteResponse?.default
"
class="pe-2"
>Response {{ data.activeRouteResponseIndex }} ({{
data.activeRouteResponse?.statusCode
}})
</span>
<span
*ngIf="
data.activeRoute?.type === 'crud' &&
data.activeRouteResponse?.default
"
class="pe-2"
>CRUD operations
</span>
{{ data.activeRouteResponse?.label }}
</div>
<div
class="d-flex align-items-center badge badge-hollow fw-bold ms-auto"
>
{{ data.activeRoute?.responses.length }}
</div>
</div>
</div>
</button>

Expand Down
6 changes: 6 additions & 0 deletions packages/desktop/src/renderer/styles/boostrap-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,12 @@ label {
}
}

// remove bootstrap fix for badges in buttons (it's not working when using flex)
.btn .badge {
position: initial;
top: 0;
}

.btn.btn-icon {
text-decoration: none;

Expand Down
5 changes: 4 additions & 1 deletion packages/desktop/test/libs/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,10 @@ class Routes {
}

public async assertSelectedRouteResponseLabel(expected: string) {
await utils.assertElementText(this.routeResponseDropdownlabel, expected);
await utils.assertElementTextContains(
this.routeResponseDropdownlabel,
expected
);
}

public async assertDefaultRouteResponseClass(
Expand Down
7 changes: 7 additions & 0 deletions packages/desktop/test/libs/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,13 @@ class Utils {
);
}

public async assertElementTextContains(
element: ChainablePromiseElement<WebdriverIO.Element>,
text: string
): Promise<void> {
expect(await element.getText()).toContain(text);
}

public async assertElementTextContain(
element: ChainablePromiseElement<WebdriverIO.Element>,
text: string
Expand Down

0 comments on commit e0a9e5e

Please sign in to comment.