Skip to content

Commit

Permalink
Fix/fix after reviews 13 12 21 (#616)
Browse files Browse the repository at this point in the history
* fix: add email for no setted firstname and lastname

* feat: update pop up centering

* feat: add user access_locked column

* feat: let's functionnal user create pia

* feat: add decimal to password front validation

* feat: update translation for activate account

* feat: update cypress test and action file

* feat: add retry methods and update focus out method
  • Loading branch information
syl-p authored Dec 14, 2021
1 parent b3709bc commit c453410
Show file tree
Hide file tree
Showing 18 changed files with 67 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: integration-tests
on: [push]
jobs:
cypress-run:
runs-on: ubuntu-18.04
runs-on: ubuntu-20.04
steps:
- name: Checkout
uses: actions/checkout@v2
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,8 @@ describe("Entries_card", () => {
.eq(1)
.click();
// Redirect into entries
cy.visit(`/#/entries`).then(() => {
cy.get(".pia-cardsBlock.pia").should("have.length", 2);
});
cy.wait(5000);
cy.get(".pia-cardsBlock.pia").should("have.length", 2);
});

/**
Expand Down
24 changes: 15 additions & 9 deletions cypress/integration/pia-angular/risk/edit_eval.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,16 +69,22 @@ export function risk_edit_eval() {
});

context("Accès illégitime à des données", () => {
it("should add tags and move gauges", () => {
cy.get_current_pia_id(id => {
// change section and item
cy.go_edited_pia(id, 3, 2).then(() => {
cy.test_add_tags();
cy.test_move_gauges();
cy.test_writing_on_textarea();
it(
"should add tags and move gauges",
{
retries: 1
},
() => {
cy.get_current_pia_id(id => {
// change section and item
cy.go_edited_pia(id, 3, 2).then(() => {
cy.test_add_tags();
cy.test_move_gauges();
cy.test_writing_on_textarea();
});
});
});
});
}
);

it("should valid evaluation", () => {
cy.validateEval();
Expand Down
4 changes: 2 additions & 2 deletions cypress/support/commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Cypress.Commands.add("init", () => {
win.sessionStorage.clear();
cy.reload(true);
});
cy.wait(1000);
});

Cypress.Commands.add("disable_onboarding", () => {
Expand All @@ -30,7 +29,7 @@ Cypress.Commands.add("skip_onboarding", () => {
});

Cypress.Commands.add("focus_out", () => {
cy.get(".pia-knowledgeBaseBlock-searchForm form input").click({
cy.get(".pia-knowledgeBaseBlock-searchForm form input").type("text", {
force: true
});
});
Expand Down Expand Up @@ -70,6 +69,7 @@ Cypress.Commands.add("create_new_pia", () => {
cy.get("#pia-save-card-btn")
.first()
.click();
cy.wait(5000); // Redirection to pia page
});

Cypress.Commands.add("get_current_pia_id", callback => {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "cypress open --config watchForFileChanges=false",
"e2e": "cypress open --config watchForFileChanges=false --browser chrome",
"prod": "ng build --prod --build-optimizer",
"clean": "rimraf ./dist/",
"format:write": "prettier src/**/*.{ts,json,md,scss} --write",
Expand Down
1 change: 0 additions & 1 deletion src/app/modules/entries/entries.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -449,7 +449,6 @@ export class EntriesComponent implements OnInit, OnDestroy {
get showPiaForm(): boolean {
return (
(this.authService.state &&
this.authService.currentUserValue.access_type.includes('technical') &&
this.authService.currentUserValue.access_type.includes('functional')) ||
!this.authService.state
);
Expand Down
5 changes: 4 additions & 1 deletion src/app/modules/entries/forms/new-pia/new-pia.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@ export class NewPiaComponent implements OnInit {
if (changes.users && changes.users.currentValue) {
this.userList = changes.users.currentValue.map(x => {
return {
display: x.firstname + ' ' + x.lastname,
display:
x.firstname && x.lastname
? x.firstname + ' ' + x.lastname
: x.email,
id: x.id
};
});
Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/home/forms/form.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
}
legend {
margin: 0;
font-size: 3rem;
font-size: 2.8rem;
color: #fff;
padding-top: 12px;
font-weight: 400;
Expand Down
23 changes: 21 additions & 2 deletions src/app/modules/home/forms/password/password.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
</legend>
<ng-template #noReset>
<legend>
{{ "authentication.create_account" | translate }}
{{ "authentication.activate_account" | translate }}
</legend>
</ng-template>
<p class="msg" *ngIf="msgFromBack">
Expand Down Expand Up @@ -144,6 +144,25 @@
"
/><span>{{ "authentication.special_character" | translate }}</span>
</p>
<p
[class.is-valid]="
f.password.value.length > 0 &&
!signUp.controls['password'].hasError('hasNumber')
"
[class.is-invalid]="
f.password.value.length > 0 &&
signUp.controls['password'].hasError('hasNumber')
"
>
<input
type="checkbox"
disabled="true"
[checked]="
f.password.value.length > 0 &&
!signUp.controls['password'].hasError('hasNumber')
"
/><span>{{ "authentication.number" | translate }}</span>
</p>
</div>
<div class="validForm">
<button type="reset" (click)="onCanceled()">
Expand All @@ -162,7 +181,7 @@
{{ "authentication.confirm" | translate }}
</ng-container>
<ng-template #noReset>
{{ "authentication.create_account2" | translate }}
{{ "authentication.activate_account" | translate }}
</ng-template>
</ng-template>
</button>
Expand Down
8 changes: 8 additions & 0 deletions src/app/modules/home/forms/password/password.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

.pia-authenticationBlock {
&-login {
legend {
margin-bottom: 15px;
}

#securityPassword {
color: white;
margin-top: 5px;
Expand All @@ -20,5 +24,9 @@
margin: 0;
margin-top: -10px;
}

button.btn.btn-green {
width: 130px !important;
}
}
}
2 changes: 1 addition & 1 deletion src/app/modules/home/forms/password/password.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ export class PasswordComponent implements OnInit {
// 1. Password Field is Required
Validators.required,
// 2. check whether the entered password has a number
// CustomValidators.patternValidator(/\d/, { hasNumber: true }),
CustomValidators.patternValidator(/\d/, { hasNumber: true }),
// 3. check whether the entered password has upper case letter
CustomValidators.patternValidator(/[A-Z]/, {
hasCapitalCase: true
Expand Down
2 changes: 1 addition & 1 deletion src/app/modules/home/forms/sign-in/sign-in.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@
</div>
<div class="validForm">
<button (click)="onCanceled()" type="button">
{{ "authentication.create_account" | translate }}
{{ "authentication.activate_account" | translate }}
</button>
<button
[disabled]="logIn.invalid || loading"
Expand Down
8 changes: 8 additions & 0 deletions src/app/modules/users/users.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,11 @@
><span>{{ "users.email" | translate }}</span></a
>
</th>
<th>
<a
><span>{{ "users.state" | translate }}</span></a
>
</th>
<th>
<a
><span>{{ "users.profile" | translate }}</span></a
Expand Down Expand Up @@ -82,6 +87,9 @@
<td class="pia-listsBlock-item-value">{{ user.lastname }}</td>
<td class="pia-listsBlock-item-value">{{ user.firstname }}</td>
<td class="pia-listsBlock-item-value">{{ user.email }}</td>
<td class="pia-listsBlock-item-value">
{{ "users.access_locked." + user.access_locked | translate }}
</td>
<td class="pia-listsBlock-item-value">
<input
type="checkbox"
Expand Down
2 changes: 1 addition & 1 deletion src/app/shared/components/dialog/dialog.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
[id]="message.data && message.data.modal_id ? message.data.modal_id : null"
*ngIf="message"
>
<div class="pia-modalBlock-content bounceIn">
<div class="pia-modalBlock-content">
<button
*ngIf="!message.data || (message.data && !message.data.no_cross_button)"
tabindex="3"
Expand Down
1 change: 1 addition & 0 deletions src/app/shared/components/modal/modal.component.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
position: absolute;
top: 32.5%;
left: 50%;
margin-left: -300px;
background-color: #fff;
}

Expand Down

0 comments on commit c453410

Please sign in to comment.