Skip to content

Commit

Permalink
test: added data-cy test selectors to html elements for better testab…
Browse files Browse the repository at this point in the history
…ility
  • Loading branch information
Melvin Johner committed Aug 19, 2024
1 parent 8fc327e commit 3485183
Show file tree
Hide file tree
Showing 28 changed files with 190 additions and 182 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,29 +14,29 @@ <h2 data-cy="messageHeaderDetailsHeading">
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.id">ID</span></dt>
<dd>
<span>{{ messageHeader.headerId }}</span>
<span data-cy="messageHeaderDetailsId">{{ messageHeader.headerId }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.name">Name</span></dt>
<dd>
<span>{{ messageHeader.name }}</span>
<span data-cy="messageHeaderDetailsName">{{ messageHeader.name }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.value">Value</span></dt>
<dd>
<span>{{ messageHeader.value }}</span>
<span data-cy="messageHeaderDetailsValue">{{ messageHeader.value }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.message">Message</span></dt>
<dd>
<div *ngIf="messageHeader.message">
<a [routerLink]="['/message', messageHeader.message.messageId, 'view']">{{ messageHeader.message.citrusMessageId }}</a>
<a [routerLink]="['/message', messageHeader.message.messageId, 'view']" data-cy="messageHeaderDetailsMessageLink">{{ messageHeader.message.citrusMessageId }}</a>
</div>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.createdDate">Created Date</span></dt>
<dd>
<span>{{ messageHeader.createdDate | formatMediumDatetime }}</span>
<span data-cy="messageHeaderDetailsCreatedDate">{{ messageHeader.createdDate | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.messageHeader.lastModifiedDate">Last Modified Date</span></dt>
<dd>
<span>{{ messageHeader.lastModifiedDate | formatMediumDatetime }}</span>
<span data-cy="messageHeaderDetailsLastModified">{{ messageHeader.lastModifiedDate | formatMediumDatetime }}</span>
</dd>
</dl>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="table-responsive table-entities" id="entities" *ngIf="sortedMessageHeaders && sortedMessageHeaders.length > 0">
<table class="table table-striped table-hover" aria-describedby="page-heading">
<table class="table table-striped table-hover" aria-describedby="page-heading" data-cy="messageHeaderEntityTable">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending" (sortChange)="emitSortChange()">
<th scope="col" jhiSortBy="headerId">
Expand Down Expand Up @@ -41,19 +41,19 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let messageHeader of sortedMessageHeaders; trackBy: trackId" data-cy="entityTable" class='clickable-row' [routerLink]="['/message-header', messageHeader.headerId, 'view']">
<tr *ngFor="let messageHeader of sortedMessageHeaders; trackBy: trackId" class='clickable-row' [routerLink]="['/message-header', messageHeader.headerId, 'view']" data-cy="messageHeaderEntityRow">
<td>
<a [routerLink]="['/message-header', messageHeader.headerId, 'view']">{{ messageHeader.headerId }}</a>
<a [routerLink]="['/message-header', messageHeader.headerId, 'view']" data-cy="messageHeaderEntityId">{{ messageHeader.headerId }}</a>
</td>
<td>{{ messageHeader.name }}</td>
<td>{{ messageHeader.value }}</td>
<td data-cy="messageHeaderEntityName">{{ messageHeader.name }}</td>
<td data-cy="messageHeaderEntityValue">{{ messageHeader.value }}</td>
<td *ngIf="standalone">
<div *ngIf="messageHeader.message">
<a [routerLink]="['/message', messageHeader.message.messageId, 'view']">{{ messageHeader.message.citrusMessageId }}</a>
<a [routerLink]="['/message', messageHeader.message.messageId, 'view']" data-cy="messageHeaderEntityValue">{{ messageHeader.message.citrusMessageId }}</a>
</div>
</td>
<td *ngIf="standalone">{{ messageHeader.createdDate | formatMediumDatetime }}</td>
<td *ngIf="standalone">{{ messageHeader.lastModifiedDate | formatMediumDatetime }}</td>
<td *ngIf="standalone" data-cy="messageHeaderEntityCreatedDate">{{ messageHeader.createdDate | formatMediumDatetime }}</td>
<td *ngIf="standalone" data-cy="messageHeaderEntityLastModified">{{ messageHeader.lastModifiedDate | formatMediumDatetime }}</td>
</tr>
</tbody>
</table>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h2 id="page-heading" data-cy="MessageHeaderHeading">
<span jhiTranslate="citrusSimulatorApp.messageHeader.home.title">Message Headers</span>

<div class="d-flex justify-content-end">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading" data-cy="refreshListButton">
<fa-icon icon="sync" [animation]="isLoading ? 'spin' : undefined"></fa-icon>
<span jhiTranslate="citrusSimulatorApp.messageHeader.home.refreshListLabel">Refresh List</span>
</button>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,37 +12,37 @@ <h2 data-cy="messageDetailsHeading"><span jhiTranslate="citrusSimulatorApp.messa
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="citrusSimulatorApp.message.id">ID</span></dt>
<dd>
<span>{{ message.messageId }}</span>
<span data-cy="messageDetailId">{{ message.messageId }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.direction">Direction</span></dt>
<dt><span jhiTranslate="citrusSimulatorApp.message.direction" >Direction</span></dt>
<dd>
<span>{{ message.direction }}</span>
<span data-cy="messageDetailDirection">{{ message.direction }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.payload">Payload</span></dt>
<dt><span jhiTranslate="citrusSimulatorApp.message.payload" >Payload</span></dt>
<dd>
<span>{{ message.payload }}</span>
<span data-cy="messageDetailPayload">{{ message.payload }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.citrusMessageId">Citrus Message Id</span></dt>
<dd>
<span>{{ message.citrusMessageId }}</span>
<span data-cy="messageDetailCitrusMessageId">{{ message.citrusMessageId }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.scenarioExecution">Scenario Execution</span></dt>
<dt><span jhiTranslate="citrusSimulatorApp.message.scenarioExecution" data-cy="messageDetailScenarioExecution">Scenario Execution</span></dt>
<dd>
<div *ngIf="message.scenarioExecutionId">
<a [routerLink]="['/scenario-execution', message.scenarioExecutionId, 'view']">{{ message.scenarioName }}</a>
<a [routerLink]="['/scenario-execution', message.scenarioExecutionId, 'view']" data-cy="messageDetailViewExecutionLink">{{ message.scenarioName }}</a>
</div>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.createdDate">Created Date</span></dt>
<dd>
<span>{{ message.createdDate | formatMediumDatetime }}</span>
<span data-cy="messageDetailCreatedDate">{{ message.createdDate | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.message.lastModifiedDate">Last Modified Date</span></dt>
<dd>
<span>{{ message.lastModifiedDate | formatMediumDatetime }}</span>
<span data-cy="messageDetailLastModifiedDate">{{ message.lastModifiedDate | formatMediumDatetime }}</span>
</dd>
</dl>

<h3 data-cy="messageDetailsHeading"><span jhiTranslate="citrusSimulatorApp.messageHeader.home.title">Message Headers</span></h3>
<h3 data-cy="messageDetailMessageHeaders"><span jhiTranslate="citrusSimulatorApp.messageHeader.home.title">Message Headers</span></h3>

<hr />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h2 id="page-heading" data-cy="MessageHeading">
<span jhiTranslate="citrusSimulatorApp.message.home.title">Messages</span>

<div class="d-flex justify-content-end">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading" data-cy="refreshListButton">
<fa-icon icon="sync" [animation]="isLoading ? 'spin' : undefined"></fa-icon>
<span jhiTranslate="citrusSimulatorApp.message.home.refreshListLabel">Refresh List</span>
</button>
Expand All @@ -21,7 +21,7 @@ <h2 id="page-heading" data-cy="MessageHeading">
</div>

<div class="table-responsive table-entities" id="entities" *ngIf="messages && messages.length > 0">
<table class="table table-striped table-hover" aria-describedby="page-heading">
<table class="table table-striped table-hover" aria-describedby="page-heading" data-cy="messageEntityTable">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending" (sortChange)="navigateToWithComponentValues()">
<th scope="col" jhiSortBy="messageId">
Expand Down Expand Up @@ -70,23 +70,23 @@ <h2 id="page-heading" data-cy="MessageHeading">
</tr>
</thead>
<tbody>
<tr *ngFor="let message of messages; trackBy: trackId" data-cy="entityTable" class='clickable-row' [routerLink]="['/message', message.messageId, 'view']">
<tr *ngFor="let message of messages; trackBy: trackId" class='clickable-row' [routerLink]="['/message', message.messageId, 'view']" data-cy="messageEntityRow">
<td>
<a [routerLink]="['/message', message.messageId, 'view']">{{ message.messageId }}</a>
<a [routerLink]="['/message', message.messageId, 'view']" data-cy="messageEntityMessageId">{{ message.messageId }}</a>
</td>
<td>{{ message.direction }}</td>
<td>{{ message.payload }}</td>
<td>{{ message.citrusMessageId }}</td>
<td data-cy="messageEntityMessageDirection">{{ message.direction }}</td>
<td data-cy="messageEntityMessagePayload">{{ message.payload }}</td>
<td data-cy="messageEntityMessageCitrusMessage">{{ message.citrusMessageId }}</td>
<td>
<div *ngIf="message.scenarioExecutionId">
<a [routerLink]="['/scenario-execution', message.scenarioExecutionId, 'view']">{{ message.scenarioName }}</a>
<a [routerLink]="['/scenario-execution', message.scenarioExecutionId, 'view']" data-cy="messageEntityMessageScenarioId">{{ message.scenarioName }}</a>
</div>
</td>
<td>{{ message.createdDate | formatMediumDatetime }}</td>
<td>{{ message.lastModifiedDate | formatMediumDatetime }}</td>
<td data-cy="messageEntityMessageCreatedDate">{{ message.createdDate | formatMediumDatetime }}</td>
<td data-cy="messageEntityMessageLastModified">{{ message.lastModifiedDate | formatMediumDatetime }}</td>
<td class="text-end">
<!-- //NOSONAR --><div class="btn-group" (click)="$event.stopPropagation()">
<a [routerLink]="['/message-header']" [queryParams]="{ 'filter[messageId.in]': message.messageId }">
<a [routerLink]="['/message-header']" [queryParams]="{ 'filter[messageId.in]': message.messageId }" data-cy="messageEntityMessageHeaderLink">
<button type="button" class="btn btn-info btn-sm" data-cy="filterOtherEntityButton">
<fa-icon icon="heading"></fa-icon>
<span
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,24 @@ <h2 data-cy="scenarioActionDetailsHeading">
<dl class="row-md jh-entity-details">
<dt><span jhiTranslate="global.field.id">ID</span></dt>
<dd>
<span>{{ scenarioAction.actionId }}</span>
<span data-cy="scenarioActionDetailsId">{{ scenarioAction.actionId }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.scenarioAction.name">Name</span></dt>
<dd>
<span>{{ scenarioAction.name }}</span>
<span data-cy="scenarioActionDetailName">{{ scenarioAction.name }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.scenarioAction.startDate">Start Date</span></dt>
<dd>
<span>{{ scenarioAction.startDate | formatMediumDatetime }}</span>
<span data-cy="scenarioActionDetailsStartDate">{{ scenarioAction.startDate | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.scenarioAction.endDate">End Date</span></dt>
<dd>
<span>{{ scenarioAction.endDate | formatMediumDatetime }}</span>
<span data-cy="scenarioActionDetailsEndDate">{{ scenarioAction.endDate | formatMediumDatetime }}</span>
</dd>
<dt><span jhiTranslate="citrusSimulatorApp.scenarioAction.scenarioExecution">Scenario Execution</span></dt>
<dd>
<div *ngIf="scenarioAction.scenarioExecution">
<a [routerLink]="['/scenario-execution', scenarioAction.scenarioExecution.executionId, 'view']">{{
<a [routerLink]="['/scenario-execution', scenarioAction.scenarioExecution.executionId, 'view']" data-cy="scenarioActionDetailsScenarioExecutionsLink">{{
scenarioAction.scenarioExecution.scenarioName
}}</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ <h2 id="page-heading" data-cy="ScenarioActionHeading">
<span jhiTranslate="citrusSimulatorApp.scenarioAction.home.title">Scenario Actions</span>

<div class="d-flex justify-content-end">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading">
<button class="btn btn-info me-2" (click)="load()" [disabled]="isLoading" data-cy="refreshListButton">
<fa-icon icon="sync" [animation]="isLoading ? 'spin' : undefined"></fa-icon>
<span jhiTranslate="citrusSimulatorApp.scenarioAction.home.refreshListLabel">Refresh List</span>
</button>
Expand All @@ -21,7 +21,7 @@ <h2 id="page-heading" data-cy="ScenarioActionHeading">
</div>

<div class="table-responsive table-entities" id="entities" *ngIf="scenarioActions && scenarioActions.length > 0">
<table class="table table-striped table-hover" aria-describedby="page-heading">
<table class="table table-striped table-hover" aria-describedby="page-heading" data-cy="scenarioActionEntitiesTable">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending" (sortChange)="navigateToWithComponentValues()">
<th scope="col" jhiSortBy="actionId">
Expand Down Expand Up @@ -57,16 +57,16 @@ <h2 id="page-heading" data-cy="ScenarioActionHeading">
</tr>
</thead>
<tbody>
<tr *ngFor="let scenarioAction of scenarioActions; trackBy: trackId" class='clickable-row' data-cy="entityTable" [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']">
<tr *ngFor="let scenarioAction of scenarioActions; trackBy: trackId" class='clickable-row' [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']" data-cy="scenarioActionEntitiesRow">
<td>
<a [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']">{{ scenarioAction.actionId }}</a>
<a [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']" data-cy="scenarioActionEntitiesId">{{ scenarioAction.actionId }}</a>
</td>
<td>{{ scenarioAction.name }}</td>
<td>{{ scenarioAction.startDate | formatMediumDatetime }}</td>
<td>{{ scenarioAction.endDate | formatMediumDatetime }}</td>
<td data-cy="scenarioActionEntitiesName">{{ scenarioAction.name }}</td>
<td data-cy="scenarioActionEntitiesStartDate">{{ scenarioAction.startDate | formatMediumDatetime }}</td>
<td data-cy="scenarioActionEntitiesEndDate">{{ scenarioAction.endDate | formatMediumDatetime }}</td>
<td>
<div *ngIf="scenarioAction.scenarioExecution">
<a [routerLink]="['/scenario-execution', scenarioAction.scenarioExecution.executionId, 'view']">{{
<!-- //NOSONAR --><div *ngIf="scenarioAction.scenarioExecution" (click)="$event.stopPropagation()">
<a [routerLink]="['/scenario-execution', scenarioAction.scenarioExecution.executionId, 'view']" data-cy="scenarioActionEntitiesScenarioExecutionLink">{{
scenarioAction.scenarioExecution.scenarioName
}}</a>
</div>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<div class="table-responsive table-entities" id="entities" *ngIf="sortedActions && sortedActions.length > 0; else noParameters">
<table class="table table-striped table-hover" aria-describedby="page-heading">
<table class="table table-striped table-hover" data-cy="scenarioActionsEntityTable" aria-describedby="page-heading">
<thead>
<tr jhiSort [(predicate)]="predicate" [(ascending)]="ascending" (sortChange)="sortActions()">
<th scope="col" jhiSortBy="actionId">
Expand Down Expand Up @@ -29,13 +29,13 @@
</tr>
</thead>
<tbody>
<tr *ngFor="let scenarioAction of sortedActions; trackBy: trackId" data-cy="entityTable" class='clickable-row' [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']">
<tr *ngFor="let scenarioAction of sortedActions; trackBy: trackId" data-cy="scenarioActionsEntityRow" class='clickable-row' [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']">
<td>
<a [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']">{{ scenarioAction.actionId }}</a>
<a [routerLink]="['/scenario-action', scenarioAction.actionId, 'view']" data-cy="scenarioActionsEntityScenarioActionLink">{{ scenarioAction.actionId }}</a>
</td>
<td>{{ scenarioAction.name }}</td>
<td>{{ scenarioAction.startDate | formatMediumDatetime }}</td>
<td>{{ scenarioAction.endDate | formatMediumDatetime }}</td>
<td data-cy="scenarioActionsEntityName">{{ scenarioAction.name }}</td>
<td data-cy="scenarioActionsEntityStartDate">{{ scenarioAction.startDate | formatMediumDatetime }}</td>
<td data-cy="scenarioActionsEntityEndDate">{{ scenarioAction.endDate | formatMediumDatetime }}</td>
</tr>
</tbody>
</table>
Expand Down
Loading

0 comments on commit 3485183

Please sign in to comment.