Skip to content

Commit

Permalink
fixed tests
Browse files Browse the repository at this point in the history
  • Loading branch information
dweinholz committed Nov 26, 2024
1 parent d6b0fac commit a1f8c6a
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
20 changes: 10 additions & 10 deletions src/app/shared/shared_modules/public-key/public-key.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -177,13 +177,13 @@ <h4 class="modal-title">Change public key</h4>
<strong>Info: </strong> Please enter a valid public key!
</alert>

<alert type="success" *ngIf="(this.public_key | isValidKeyPipe) && validated_key">
<alert type="success" *ngIf="(public_key | isValidKeyPipe) && validated_key">
<strong>Info: </strong> This is a valid public key!
</alert>
<alert type="danger" *ngIf="(!(this.public_key | isValidKeyPipe) || !validated_key) && public_key?.length > 0">
<alert type="danger" *ngIf="(!(public_key | isValidKeyPipe) || !validated_key) && public_key?.length > 0">
<strong>Warning</strong> This is not a valid public key!
</alert>
<alert type="danger" *ngIf="(!(this.public_key | isValidKeyPipe) || blocked_key) && validated_key">
<alert type="danger" *ngIf="(!(public_key | isValidKeyPipe) || blocked_key) && validated_key">
<strong>Warning: </strong>Due to security concerns, your key has been blocked permanently, and you won't be
able to use it anymore. It's highly recommended that you change your key immediately to prevent any further
security breaches.
Expand Down Expand Up @@ -214,22 +214,22 @@ <h4 class="modal-title">Change public key</h4>

<div
class="alert"
*ngIf="(this.public_key | isValidKeyPipe) && validated_key && !blocked_key"
*ngIf="(public_key | isValidKeyPipe) && validated_key && !blocked_key"
[ngClass]="acknowledgement_given ? 'alert-info' : 'alert-danger'"
>
<strong>Warning!</strong> Replacing your current public key with a different one will render all your
currently running machines inaccessible.
<div class="form-check">
<input
class="form-check-input"
name="public_key_acknowledgement_checkbox"
name="public_key_acknowledgement_checkbox_replace"
type="checkbox"
[ngClass]="acknowledgement_given ? '' : 'is-invalid'"
id="public_key_acknowledgement_checkbox"
data-test-id="public_key_acknowledgement_checkbox"
id="public_key_acknowledgement_checkbox_replace"
data-test-id="public_key_acknowledgement_checkbox_replace"
[(ngModel)]="acknowledgement_given"
/>
<label class="form-check-label" for="public_key_acknowledgement_checkbox">
<label class="form-check-label" for="public_key_acknowledgement_checkbox_replace">
I hereby confirm that I am aware of the effects of entering a new SSH-key.
</label>
</div>
Expand All @@ -238,7 +238,7 @@ <h4 class="modal-title">Change public key</h4>

<div class="modal-footer">
<button
[disabled]="!(this.public_key | isValidKeyPipe) || !validated_key || !acknowledgement_given || blocked_key"
[disabled]="!(public_key | isValidKeyPipe) || !validated_key || !acknowledgement_given || blocked_key"
class="btn btn-success col-md4"
type="button"
id="set_new_public_key_button"
Expand Down Expand Up @@ -286,7 +286,7 @@ <h4 class="modal-title">Setting of public key of public key</h4>
type="button"
id="close_new_public_key_response_modal_button"
data-test-id="close_new_public_key_response_modal_button"
(click)="this.pubKeyResponseModal.hide()"
(click)="pubKeyResponseModal.hide()"
>
OK
</button>
Expand Down
4 changes: 3 additions & 1 deletion tests/page_objects/profile.po.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,9 @@ export class ProfilePage {
await this.page.fill(Util.by_data_test_id_str(this.ENTER_PUBLIC_KEY_AREA), this.TEST_PUBLIC_KEY);
console.log('Confirming effects of generating a new Key');

await this.page.locator(Util.by_data_test_id_str(this.PUBLIC_KEY_ACKNOWLEDGE_CHECKBOX)).last().click()
await this.page.locator(Util.by_data_test_id_str("public_key_acknowledgement_checkbox_replace")).click();
await this.page.locator(Util.by_data_test_id_str("public_key_acknowledgement_checkbox_replace")).click();

// await this.page.locator(Util.by_data_test_id_str(this.GENERATE_KEY_CHECKBOX)).click();
console.log('Clicking on Set-Button');
await Promise.all([
Expand Down
1 change: 1 addition & 0 deletions tests/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ export class Util {
}

static by_data_test_id_str(data_test_id: string): string {
console.log(`Seaching for ${data_test_id}`)
return `[data-test-id="${data_test_id}"]`;
}

Expand Down

0 comments on commit a1f8c6a

Please sign in to comment.