Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: remove user from a project (DEV-2328) #2067

Merged
merged 7 commits into from
Feb 3, 2025
Merged
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions apps/dsp-app/cypress/e2e/system-admin/project-members.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import { Project0001Page } from '../../support/pages/existing-ontology-class-page';

describe('Project members', () => {
let project0001Page: Project0001Page;

before(() => {
cy.resetDatabase();
project0001Page = new Project0001Page();
});

it('admin can remove user from a project', () => {
cy.intercept('DELETE', '/admin/users/**').as('deleteRequest');
cy.intercept('GET', '**/members').as('membersRequest');
cy.visit(`/project/${Project0001Page.projectShortCode}/settings/collaboration`);
let memberCount = 0;
cy.get('[data-cy=member-count]')
.should('be.visible')
.invoke('text')
.then(text => {
memberCount = parseInt(text.match(/\d+/)?.[0]);
expect(memberCount).to.be.greaterThan(0);
});

cy.get('[data-cy=user-menu]').should('exist').first().click();
cy.get('[data-cy=remove-member-button]').should('be.visible').click();
cy.get('[data-cy=confirmation-button]').should('be.visible').click();
cy.wait('@deleteRequest').its('response.statusCode').should('eq', 200);
cy.wait('@membersRequest').its('response.statusCode').should('eq', 200);
});
});
Original file line number Diff line number Diff line change
@@ -20,8 +20,12 @@ <h3 class="mat-body subtitle">
(sortKeyChange)="sortList($event)" />
</span>
<h2 class="mat-headline-6">
<span *ngIf="projectUuid">{{ list.length | i18nPlural : itemPluralMapping['member'] }}</span>
<span *ngIf="!projectUuid">{{ list.length | i18nPlural : itemPluralMapping['user'] }}</span>
<span *ngIf="projectUuid" data-cy="member-count"
>{{ list.length | i18nPlural : itemPluralMapping['member'] }}</span
>
<span *ngIf="!projectUuid" data-cy="user-count"
>{{ list.length | i18nPlural : itemPluralMapping['user'] }}</span
>
Comment on lines +23 to +28
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Question about formatting. Is this guys what you have agreed on or just a Prettier bug? I see it looks different and weird for me than in other files touched in this PR.

<tag attributes
  >value</tag>
>

vs what is in below changes and what looks more readable:

<tag
  attributes>
  <tag2>value</tag2>
</tag>

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mpro7 It just exceeds 120 characters in a line which is the rule of prettier

</h2>
<span class="fill-remaining-space"></span>
<span class="app-toolbar-action button right" *ngIf="status && createNew && (isSysAdmin$ | async)">
@@ -76,7 +80,11 @@ <h5 class="mat-subtitle-1 info-names">

<!-- action: menu with edit, remove, etc. -->
<td class="table-action">
<button mat-icon-button [matMenuTriggerFor]="projectUserMenu" [disabled]="disableMenu$ | async">
<button
mat-icon-button
[matMenuTriggerFor]="projectUserMenu"
data-cy="user-menu"
[disabled]="disableMenu$ | async">
<mat-icon>more_horiz</mat-icon>
</button>
<mat-menu #projectUserMenu="matMenu" xPosition="before" class="menu">
@@ -122,6 +130,7 @@ <h5 class="mat-subtitle-1 info-names">
<!-- remove user from project; only in project view -->
<button
mat-menu-item
data-cy="remove-member-button"
*ngIf="projectUuid"
(click)="
askToRemoveFromProject(user)