mirror of
https://github.com/zitadel/zitadel.git
synced 2025-02-28 21:47:23 +00:00
fix(console, e2e): optimize console and activate tests (#4207)
* activate some tests * unskip remove project tests * focus input elements before typing * fix: prune permissions observable * cleanup * remove timeout * remove ngIf * test with chrome * with ngIf * single observable * juhu * maybe better * fix isAllowed response * cleanup Co-authored-by: Max Peintner <max@caos.ch>
This commit is contained in:
parent
adb5394ae3
commit
f0250a3fdb
2
.github/workflows/test-code.yml
vendored
2
.github/workflows/test-code.yml
vendored
@ -42,7 +42,7 @@ jobs:
|
|||||||
- name: Build Docker Image
|
- name: Build Docker Image
|
||||||
run: docker build -t zitadel:pr --file build/Dockerfile .artifacts/zitadel
|
run: docker build -t zitadel:pr --file build/Dockerfile .artifacts/zitadel
|
||||||
- name: Run E2E Tests
|
- name: Run E2E Tests
|
||||||
run: docker compose run e2e
|
run: docker compose run e2e --browser chrome
|
||||||
working-directory: e2e
|
working-directory: e2e
|
||||||
env:
|
env:
|
||||||
ZITADEL_IMAGE: zitadel:pr
|
ZITADEL_IMAGE: zitadel:pr
|
||||||
|
@ -265,7 +265,7 @@ export class AppComponent implements OnDestroy {
|
|||||||
|
|
||||||
public changedOrg(org: Org.AsObject): void {
|
public changedOrg(org: Org.AsObject): void {
|
||||||
this.themeService.loadPrivateLabelling();
|
this.themeService.loadPrivateLabelling();
|
||||||
this.authService.zitadelPermissionsChanged.pipe(take(1)).subscribe(() => {
|
this.authService.zitadelPermissions$.pipe(take(1)).subscribe(() => {
|
||||||
this.router.navigate(['/org'], { fragment: org.id });
|
this.router.navigate(['/org'], { fragment: org.id });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -12,8 +12,6 @@ export class RoleGuard implements CanActivate {
|
|||||||
constructor(private authService: GrpcAuthService) {}
|
constructor(private authService: GrpcAuthService) {}
|
||||||
|
|
||||||
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
public canActivate(route: ActivatedRouteSnapshot, state: RouterStateSnapshot): Observable<boolean> {
|
||||||
return this.authService.fetchedZitadelPermissions
|
return this.authService.isAllowed(route.data['roles'], route.data['requiresAll']);
|
||||||
.pipe(filter((permissionsFetched) => !!permissionsFetched))
|
|
||||||
.pipe(switchMap((_) => this.authService.isAllowed(route.data['roles'], route.data['requiresAll'])));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -97,7 +97,7 @@ export class OrgTableComponent {
|
|||||||
public selectOrg(item: Org.AsObject, event?: any): void {
|
public selectOrg(item: Org.AsObject, event?: any): void {
|
||||||
this.authService.setActiveOrg(item);
|
this.authService.setActiveOrg(item);
|
||||||
this.themeService.loadPrivateLabelling();
|
this.themeService.loadPrivateLabelling();
|
||||||
this.authService.zitadelPermissionsChanged.pipe(take(1)).subscribe(() => {
|
this.authService.zitadelPermissions$.pipe(take(1)).subscribe(() => {
|
||||||
this.router.navigate(['/org'], { fragment: item.id });
|
this.router.navigate(['/org'], { fragment: item.id });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -146,7 +146,7 @@ export class OrgTableComponent {
|
|||||||
public setAndNavigateToOrg(org: Org.AsObject): void {
|
public setAndNavigateToOrg(org: Org.AsObject): void {
|
||||||
this.authService.setActiveOrg(org);
|
this.authService.setActiveOrg(org);
|
||||||
this.themeService.loadPrivateLabelling();
|
this.themeService.loadPrivateLabelling();
|
||||||
this.authService.zitadelPermissionsChanged.pipe(take(1)).subscribe(() => {
|
this.authService.zitadelPermissions$.pipe(take(1)).subscribe(() => {
|
||||||
this.router.navigate(['/org'], { fragment: org.id });
|
this.router.navigate(['/org'], { fragment: org.id });
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -52,12 +52,12 @@
|
|||||||
(filterOpen)="filterOpen = $event"
|
(filterOpen)="filterOpen = $event"
|
||||||
></cnsl-filter-user>
|
></cnsl-filter-user>
|
||||||
<a
|
<a
|
||||||
*ngIf="!selection.hasValue()"
|
|
||||||
[routerLink]="['/users', type === Type.TYPE_HUMAN ? 'create' : 'create-machine']"
|
[routerLink]="['/users', type === Type.TYPE_HUMAN ? 'create' : 'create-machine']"
|
||||||
color="primary"
|
color="primary"
|
||||||
mat-raised-button
|
mat-raised-button
|
||||||
[disabled]="!canWrite"
|
[disabled]="!canWrite"
|
||||||
class="cnsl-action-button"
|
class="cnsl-action-button"
|
||||||
|
*ngIf="!selection.hasValue()"
|
||||||
data-e2e="create-user-button"
|
data-e2e="create-user-button"
|
||||||
>
|
>
|
||||||
<mat-icon class="icon">add</mat-icon>
|
<mat-icon class="icon">add</mat-icon>
|
||||||
|
@ -2,91 +2,102 @@ import { Injectable } from '@angular/core';
|
|||||||
import { SortDirection } from '@angular/material/sort';
|
import { SortDirection } from '@angular/material/sort';
|
||||||
import { OAuthService } from 'angular-oauth2-oidc';
|
import { OAuthService } from 'angular-oauth2-oidc';
|
||||||
import { BehaviorSubject, from, merge, Observable, of, Subject } from 'rxjs';
|
import { BehaviorSubject, from, merge, Observable, of, Subject } from 'rxjs';
|
||||||
import { catchError, filter, finalize, map, mergeMap, switchMap, take, timeout } from 'rxjs/operators';
|
import {
|
||||||
|
catchError,
|
||||||
|
distinctUntilChanged,
|
||||||
|
filter,
|
||||||
|
finalize,
|
||||||
|
map,
|
||||||
|
mergeMap,
|
||||||
|
switchMap,
|
||||||
|
take,
|
||||||
|
timeout,
|
||||||
|
withLatestFrom,
|
||||||
|
} from 'rxjs/operators';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
AddMyAuthFactorOTPRequest,
|
AddMyAuthFactorOTPRequest,
|
||||||
AddMyAuthFactorOTPResponse,
|
AddMyAuthFactorOTPResponse,
|
||||||
AddMyAuthFactorU2FRequest,
|
AddMyAuthFactorU2FRequest,
|
||||||
AddMyAuthFactorU2FResponse,
|
AddMyAuthFactorU2FResponse,
|
||||||
AddMyPasswordlessLinkRequest,
|
AddMyPasswordlessLinkRequest,
|
||||||
AddMyPasswordlessLinkResponse,
|
AddMyPasswordlessLinkResponse,
|
||||||
AddMyPasswordlessRequest,
|
AddMyPasswordlessRequest,
|
||||||
AddMyPasswordlessResponse,
|
AddMyPasswordlessResponse,
|
||||||
GetMyEmailRequest,
|
GetMyEmailRequest,
|
||||||
GetMyEmailResponse,
|
GetMyEmailResponse,
|
||||||
GetMyLabelPolicyRequest,
|
GetMyLabelPolicyRequest,
|
||||||
GetMyLabelPolicyResponse,
|
GetMyLabelPolicyResponse,
|
||||||
GetMyPasswordComplexityPolicyRequest,
|
GetMyPasswordComplexityPolicyRequest,
|
||||||
GetMyPasswordComplexityPolicyResponse,
|
GetMyPasswordComplexityPolicyResponse,
|
||||||
GetMyPhoneRequest,
|
GetMyPhoneRequest,
|
||||||
GetMyPhoneResponse,
|
GetMyPhoneResponse,
|
||||||
GetMyPrivacyPolicyRequest,
|
GetMyPrivacyPolicyRequest,
|
||||||
GetMyPrivacyPolicyResponse,
|
GetMyPrivacyPolicyResponse,
|
||||||
GetMyProfileRequest,
|
GetMyProfileRequest,
|
||||||
GetMyProfileResponse,
|
GetMyProfileResponse,
|
||||||
GetMyUserRequest,
|
GetMyUserRequest,
|
||||||
GetMyUserResponse,
|
GetMyUserResponse,
|
||||||
GetSupportedLanguagesRequest,
|
GetSupportedLanguagesRequest,
|
||||||
GetSupportedLanguagesResponse,
|
GetSupportedLanguagesResponse,
|
||||||
ListMyAuthFactorsRequest,
|
ListMyAuthFactorsRequest,
|
||||||
ListMyAuthFactorsResponse,
|
ListMyAuthFactorsResponse,
|
||||||
ListMyLinkedIDPsRequest,
|
ListMyLinkedIDPsRequest,
|
||||||
ListMyLinkedIDPsResponse,
|
ListMyLinkedIDPsResponse,
|
||||||
ListMyMembershipsRequest,
|
ListMyMembershipsRequest,
|
||||||
ListMyMembershipsResponse,
|
ListMyMembershipsResponse,
|
||||||
ListMyMetadataRequest,
|
ListMyMetadataRequest,
|
||||||
ListMyMetadataResponse,
|
ListMyMetadataResponse,
|
||||||
ListMyPasswordlessRequest,
|
ListMyPasswordlessRequest,
|
||||||
ListMyPasswordlessResponse,
|
ListMyPasswordlessResponse,
|
||||||
ListMyProjectOrgsRequest,
|
ListMyProjectOrgsRequest,
|
||||||
ListMyProjectOrgsResponse,
|
ListMyProjectOrgsResponse,
|
||||||
ListMyUserChangesRequest,
|
ListMyUserChangesRequest,
|
||||||
ListMyUserChangesResponse,
|
ListMyUserChangesResponse,
|
||||||
ListMyUserGrantsRequest,
|
ListMyUserGrantsRequest,
|
||||||
ListMyUserGrantsResponse,
|
ListMyUserGrantsResponse,
|
||||||
ListMyUserSessionsRequest,
|
ListMyUserSessionsRequest,
|
||||||
ListMyUserSessionsResponse,
|
ListMyUserSessionsResponse,
|
||||||
ListMyZitadelPermissionsRequest,
|
ListMyZitadelPermissionsRequest,
|
||||||
ListMyZitadelPermissionsResponse,
|
ListMyZitadelPermissionsResponse,
|
||||||
RemoveMyAuthFactorOTPRequest,
|
RemoveMyAuthFactorOTPRequest,
|
||||||
RemoveMyAuthFactorOTPResponse,
|
RemoveMyAuthFactorOTPResponse,
|
||||||
RemoveMyAuthFactorU2FRequest,
|
RemoveMyAuthFactorU2FRequest,
|
||||||
RemoveMyAuthFactorU2FResponse,
|
RemoveMyAuthFactorU2FResponse,
|
||||||
RemoveMyAvatarRequest,
|
RemoveMyAvatarRequest,
|
||||||
RemoveMyAvatarResponse,
|
RemoveMyAvatarResponse,
|
||||||
RemoveMyLinkedIDPRequest,
|
RemoveMyLinkedIDPRequest,
|
||||||
RemoveMyLinkedIDPResponse,
|
RemoveMyLinkedIDPResponse,
|
||||||
RemoveMyPasswordlessRequest,
|
RemoveMyPasswordlessRequest,
|
||||||
RemoveMyPasswordlessResponse,
|
RemoveMyPasswordlessResponse,
|
||||||
RemoveMyPhoneRequest,
|
RemoveMyPhoneRequest,
|
||||||
RemoveMyPhoneResponse,
|
RemoveMyPhoneResponse,
|
||||||
RemoveMyUserRequest,
|
RemoveMyUserRequest,
|
||||||
RemoveMyUserResponse,
|
RemoveMyUserResponse,
|
||||||
ResendMyEmailVerificationRequest,
|
ResendMyEmailVerificationRequest,
|
||||||
ResendMyEmailVerificationResponse,
|
ResendMyEmailVerificationResponse,
|
||||||
ResendMyPhoneVerificationRequest,
|
ResendMyPhoneVerificationRequest,
|
||||||
ResendMyPhoneVerificationResponse,
|
ResendMyPhoneVerificationResponse,
|
||||||
SendMyPasswordlessLinkRequest,
|
SendMyPasswordlessLinkRequest,
|
||||||
SendMyPasswordlessLinkResponse,
|
SendMyPasswordlessLinkResponse,
|
||||||
SetMyEmailRequest,
|
SetMyEmailRequest,
|
||||||
SetMyEmailResponse,
|
SetMyEmailResponse,
|
||||||
SetMyPhoneRequest,
|
SetMyPhoneRequest,
|
||||||
SetMyPhoneResponse,
|
SetMyPhoneResponse,
|
||||||
UpdateMyPasswordRequest,
|
UpdateMyPasswordRequest,
|
||||||
UpdateMyPasswordResponse,
|
UpdateMyPasswordResponse,
|
||||||
UpdateMyProfileRequest,
|
UpdateMyProfileRequest,
|
||||||
UpdateMyProfileResponse,
|
UpdateMyProfileResponse,
|
||||||
UpdateMyUserNameRequest,
|
UpdateMyUserNameRequest,
|
||||||
UpdateMyUserNameResponse,
|
UpdateMyUserNameResponse,
|
||||||
VerifyMyAuthFactorOTPRequest,
|
VerifyMyAuthFactorOTPRequest,
|
||||||
VerifyMyAuthFactorOTPResponse,
|
VerifyMyAuthFactorOTPResponse,
|
||||||
VerifyMyAuthFactorU2FRequest,
|
VerifyMyAuthFactorU2FRequest,
|
||||||
VerifyMyAuthFactorU2FResponse,
|
VerifyMyAuthFactorU2FResponse,
|
||||||
VerifyMyPasswordlessRequest,
|
VerifyMyPasswordlessRequest,
|
||||||
VerifyMyPasswordlessResponse,
|
VerifyMyPasswordlessResponse,
|
||||||
VerifyMyPhoneRequest,
|
VerifyMyPhoneRequest,
|
||||||
VerifyMyPhoneResponse,
|
VerifyMyPhoneResponse,
|
||||||
} from '../proto/generated/zitadel/auth_pb';
|
} from '../proto/generated/zitadel/auth_pb';
|
||||||
import { ChangeQuery } from '../proto/generated/zitadel/change_pb';
|
import { ChangeQuery } from '../proto/generated/zitadel/change_pb';
|
||||||
import { MetadataQuery } from '../proto/generated/zitadel/metadata_pb';
|
import { MetadataQuery } from '../proto/generated/zitadel/metadata_pb';
|
||||||
@ -103,9 +114,26 @@ export class GrpcAuthService {
|
|||||||
private _activeOrgChanged: Subject<Org.AsObject> = new Subject();
|
private _activeOrgChanged: Subject<Org.AsObject> = new Subject();
|
||||||
public user!: Observable<User.AsObject | undefined>;
|
public user!: Observable<User.AsObject | undefined>;
|
||||||
public userSubject: BehaviorSubject<User.AsObject | undefined> = new BehaviorSubject<User.AsObject | undefined>(undefined);
|
public userSubject: BehaviorSubject<User.AsObject | undefined> = new BehaviorSubject<User.AsObject | undefined>(undefined);
|
||||||
private zitadelPermissions: BehaviorSubject<string[]> = new BehaviorSubject(['user.resourceowner']);
|
private triggerPermissionsRefresh: Subject<void> = new Subject();
|
||||||
|
public zitadelPermissions$: Observable<string[]> = this.triggerPermissionsRefresh.pipe(
|
||||||
public readonly fetchedZitadelPermissions: BehaviorSubject<boolean> = new BehaviorSubject(false as boolean);
|
switchMap(() =>
|
||||||
|
from(this.listMyZitadelPermissions()).pipe(
|
||||||
|
map((rolesResp) => rolesResp.resultList),
|
||||||
|
filter((roles) => !!roles.length),
|
||||||
|
catchError((_) => {
|
||||||
|
return of([]);
|
||||||
|
}),
|
||||||
|
distinctUntilChanged((a, b) => {
|
||||||
|
return JSON.stringify(a.sort()) === JSON.stringify(b.sort());
|
||||||
|
}),
|
||||||
|
finalize(() => {
|
||||||
|
this.fetchedZitadelPermissions.next(true);
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
),
|
||||||
|
);
|
||||||
|
private zitadelPermissions: BehaviorSubject<string[]> = new BehaviorSubject<string[]>([]);
|
||||||
|
public readonly fetchedZitadelPermissions: BehaviorSubject<boolean> = new BehaviorSubject<boolean>(false);
|
||||||
|
|
||||||
private cachedOrgs: Org.AsObject[] = [];
|
private cachedOrgs: Org.AsObject[] = [];
|
||||||
|
|
||||||
@ -114,6 +142,8 @@ export class GrpcAuthService {
|
|||||||
private oauthService: OAuthService,
|
private oauthService: OAuthService,
|
||||||
private storage: StorageService,
|
private storage: StorageService,
|
||||||
) {
|
) {
|
||||||
|
this.zitadelPermissions$.subscribe(this.zitadelPermissions);
|
||||||
|
|
||||||
this.user = merge(
|
this.user = merge(
|
||||||
of(this.oauthService.getAccessToken()).pipe(filter((token) => (token ? true : false))),
|
of(this.oauthService.getAccessToken()).pipe(filter((token) => (token ? true : false))),
|
||||||
this.oauthService.events.pipe(
|
this.oauthService.events.pipe(
|
||||||
@ -223,19 +253,7 @@ export class GrpcAuthService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private loadPermissions(): void {
|
private loadPermissions(): void {
|
||||||
from(this.listMyZitadelPermissions())
|
this.triggerPermissionsRefresh.next();
|
||||||
.pipe(
|
|
||||||
map((rolesResp) => rolesResp.resultList),
|
|
||||||
catchError((_) => {
|
|
||||||
return of([]);
|
|
||||||
}),
|
|
||||||
finalize(() => {
|
|
||||||
this.fetchedZitadelPermissions.next(true);
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
.subscribe((roles) => {
|
|
||||||
this.zitadelPermissions.next(roles);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -244,7 +262,17 @@ export class GrpcAuthService {
|
|||||||
*/
|
*/
|
||||||
public isAllowed(roles: string[] | RegExp[], requiresAll: boolean = false): Observable<boolean> {
|
public isAllowed(roles: string[] | RegExp[], requiresAll: boolean = false): Observable<boolean> {
|
||||||
if (roles && roles.length > 0) {
|
if (roles && roles.length > 0) {
|
||||||
return this.zitadelPermissions.pipe(switchMap((zroles) => of(this.hasRoles(zroles, roles, requiresAll))));
|
return this.fetchedZitadelPermissions.pipe(
|
||||||
|
withLatestFrom(this.zitadelPermissions),
|
||||||
|
filter(([hL, p]) => {
|
||||||
|
return hL === true && !!p.length;
|
||||||
|
}),
|
||||||
|
map(([_, zroles]) => {
|
||||||
|
const what = this.hasRoles(zroles, roles, requiresAll);
|
||||||
|
return what;
|
||||||
|
}),
|
||||||
|
distinctUntilChanged(),
|
||||||
|
);
|
||||||
} else {
|
} else {
|
||||||
return of(false);
|
return of(false);
|
||||||
}
|
}
|
||||||
@ -356,10 +384,6 @@ export class GrpcAuthService {
|
|||||||
return this.grpcService.auth.updateMyProfile(req, null).then((resp) => resp.toObject());
|
return this.grpcService.auth.updateMyProfile(req, null).then((resp) => resp.toObject());
|
||||||
}
|
}
|
||||||
|
|
||||||
public get zitadelPermissionsChanged(): Observable<string[]> {
|
|
||||||
return this.zitadelPermissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public listMyUserSessions(): Promise<ListMyUserSessionsResponse.AsObject> {
|
public listMyUserSessions(): Promise<ListMyUserSessionsResponse.AsObject> {
|
||||||
const req = new ListMyUserSessionsRequest();
|
const req = new ListMyUserSessionsRequest();
|
||||||
return this.grpcService.auth.listMyUserSessions(req, null).then((resp) => resp.toObject());
|
return this.grpcService.auth.listMyUserSessions(req, null).then((resp) => resp.toObject());
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
} from "../../support/api/users";
|
} from "../../support/api/users";
|
||||||
import { loginname } from "../../support/login/users";
|
import { loginname } from "../../support/login/users";
|
||||||
|
|
||||||
describe.skip("humans", () => {
|
describe("humans", () => {
|
||||||
const humansPath = `/users?type=human`;
|
const humansPath = `/users?type=human`;
|
||||||
const testHumanUserNameAdd = "e2ehumanusernameadd";
|
const testHumanUserNameAdd = "e2ehumanusernameadd";
|
||||||
const testHumanUserNameRemove = "e2ehumanusernameremove";
|
const testHumanUserNameRemove = "e2ehumanusernameremove";
|
||||||
@ -22,18 +22,20 @@ describe.skip("humans", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should add a user", () => {
|
it("should add a user", () => {
|
||||||
cy.get('[data-e2e="action-key-add"]')
|
cy.get('[data-e2e="create-user-button"]')
|
||||||
.parents('[data-e2e="create-user-button"]')
|
|
||||||
.click();
|
.click();
|
||||||
cy.url().should("contain", "users/create");
|
cy.url().should("contain", "users/create");
|
||||||
cy.get('[formcontrolname="email"]').type(loginname("e2ehuman"));
|
cy.get('[formcontrolname="email"]')
|
||||||
|
.type(loginname("e2ehuman", Cypress.env("ORGANIZATION")));
|
||||||
//force needed due to the prefilled username prefix
|
//force needed due to the prefilled username prefix
|
||||||
cy.get('[formcontrolname="userName"]').type(testHumanUserNameAdd, {
|
cy.get('[formcontrolname="userName"]')
|
||||||
force: true,
|
.type(testHumanUserNameAdd);
|
||||||
});
|
cy.get('[formcontrolname="firstName"]')
|
||||||
cy.get('[formcontrolname="firstName"]').type("e2ehumanfirstname");
|
.type("e2ehumanfirstname");
|
||||||
cy.get('[formcontrolname="lastName"]').type("e2ehumanlastname");
|
cy.get('[formcontrolname="lastName"]')
|
||||||
cy.get('[formcontrolname="phone"]').type("+41 123456789");
|
.type("e2ehumanlastname");
|
||||||
|
cy.get('[formcontrolname="phone"]')
|
||||||
|
.type("+41 123456789");
|
||||||
cy.get('[data-e2e="create-button"]').click();
|
cy.get('[data-e2e="create-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
@ -55,10 +57,10 @@ describe.skip("humans", () => {
|
|||||||
// doesn't work, need to force click.
|
// doesn't work, need to force click.
|
||||||
// .trigger('mouseover')
|
// .trigger('mouseover')
|
||||||
.find('[data-e2e="enabled-delete-button"]')
|
.find('[data-e2e="enabled-delete-button"]')
|
||||||
.click({ force: true });
|
.click({force: true});
|
||||||
cy.get('[data-e2e="confirm-dialog-input"]')
|
cy.get('[data-e2e="confirm-dialog-input"]')
|
||||||
.click()
|
.focus()
|
||||||
.type(loginname(testHumanUserNameRemove, Cypress.env("org")));
|
.type(loginname(testHumanUserNameRemove, Cypress.env("ORGANIZATION")));
|
||||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
|
@ -5,7 +5,7 @@ import {
|
|||||||
} from "../../support/api/users";
|
} from "../../support/api/users";
|
||||||
import { loginname } from "../../support/login/users";
|
import { loginname } from "../../support/login/users";
|
||||||
|
|
||||||
describe.skip("machines", () => {
|
describe("machines", () => {
|
||||||
const machinesPath = `/users?type=machine`;
|
const machinesPath = `/users?type=machine`;
|
||||||
const testMachineUserNameAdd = "e2emachineusernameadd";
|
const testMachineUserNameAdd = "e2emachineusernameadd";
|
||||||
const testMachineUserNameRemove = "e2emachineusernameremove";
|
const testMachineUserNameRemove = "e2emachineusernameremove";
|
||||||
@ -22,16 +22,16 @@ describe.skip("machines", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should add a machine", () => {
|
it("should add a machine", () => {
|
||||||
cy.get('[data-e2e="action-key-add"]')
|
cy.get('[data-e2e="create-user-button"]')
|
||||||
.parents('[data-e2e="create-user-button"]')
|
|
||||||
.click();
|
.click();
|
||||||
cy.url().should("contain", "users/create-machine");
|
cy.url().should("contain", "users/create-machine");
|
||||||
//force needed due to the prefilled username prefix
|
//force needed due to the prefilled username prefix
|
||||||
cy.get('[formcontrolname="userName"]').type(testMachineUserNameAdd, {
|
cy.get('[formcontrolname="userName"]')
|
||||||
force: true,
|
.type(testMachineUserNameAdd);
|
||||||
});
|
cy.get('[formcontrolname="name"]')
|
||||||
cy.get('[formcontrolname="name"]').type("e2emachinename");
|
.type("e2emachinename");
|
||||||
cy.get('[formcontrolname="description"]').type("e2emachinedescription");
|
cy.get('[formcontrolname="description"]')
|
||||||
|
.type("e2emachinedescription");
|
||||||
cy.get('[data-e2e="create-button"]').click();
|
cy.get('[data-e2e="create-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
@ -49,14 +49,14 @@ describe.skip("machines", () => {
|
|||||||
});
|
});
|
||||||
|
|
||||||
it("should delete a machine", () => {
|
it("should delete a machine", () => {
|
||||||
cy.contains("tr", testMachineUserNameRemove, { timeout: 1000 })
|
cy.contains("tr", testMachineUserNameRemove)
|
||||||
// doesn't work, need to force click.
|
// doesn't work, need to force click.
|
||||||
// .trigger('mouseover')
|
// .trigger('mouseover')
|
||||||
.find('[data-e2e="enabled-delete-button"]')
|
.find('[data-e2e="enabled-delete-button"]')
|
||||||
.click({ force: true });
|
.click({force: true});
|
||||||
cy.get('[data-e2e="confirm-dialog-input"]')
|
cy.get('[data-e2e="confirm-dialog-input"]')
|
||||||
.click()
|
.focus()
|
||||||
.type(loginname(testMachineUserNameRemove, Cypress.env("org")));
|
.type(loginname(testMachineUserNameRemove, Cypress.env("ORGANIZATION")));
|
||||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import { apiAuth } from "../../support/api/apiauth";
|
import { apiAuth } from "../../support/api/apiauth";
|
||||||
import { ensureProjectExists, ensureProjectResourceDoesntExist, Roles } from "../../support/api/projects";
|
import { ensureProjectExists, ensureProjectResourceDoesntExist, Roles } from "../../support/api/projects";
|
||||||
|
|
||||||
describe.skip('permissions', () => {
|
describe('permissions', () => {
|
||||||
|
|
||||||
const testProjectName = 'e2eprojectpermission'
|
const testProjectName = 'e2eprojectpermission'
|
||||||
const testAppName = 'e2eapppermission'
|
const testAppName = 'e2eapppermission'
|
||||||
@ -28,12 +28,16 @@ describe.skip('permissions', () => {
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
it('should add a role', () => {
|
it('should add a role', () => {
|
||||||
cy.get('[data-e2e="add-new-role"]').click()
|
cy.get('[data-e2e="add-new-role"]').click()
|
||||||
cy.get('[formcontrolname="key"]').type(testRoleName)
|
cy.get('[formcontrolname="key"]')
|
||||||
cy.get('[formcontrolname="displayName"]').type(testRoleDisplay)
|
.type(testRoleName)
|
||||||
cy.get('[formcontrolname="group"]').type(testRoleGroup)
|
cy.get('[formcontrolname="displayName"]')
|
||||||
cy.get('[data-e2e="save-button"]').click()
|
.type(testRoleDisplay)
|
||||||
|
cy.get('[formcontrolname="group"]')
|
||||||
|
.type(testRoleGroup)
|
||||||
|
cy.get('[data-e2e="save-button"]')
|
||||||
|
.click()
|
||||||
cy.get('.data-e2e-success')
|
cy.get('.data-e2e-success')
|
||||||
cy.wait(200)
|
cy.wait(200)
|
||||||
cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist')
|
cy.get('.data-e2e-failure', { timeout: 0 }).should('not.exist')
|
||||||
|
@ -42,9 +42,9 @@ describe("projects", () => {
|
|||||||
cy.contains("tr", testProjectNameDeleteList, { timeout: 1000 })
|
cy.contains("tr", testProjectNameDeleteList, { timeout: 1000 })
|
||||||
.find('[data-e2e="delete-project-button"]')
|
.find('[data-e2e="delete-project-button"]')
|
||||||
.click({ force: true });
|
.click({ force: true });
|
||||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(
|
cy.get('[data-e2e="confirm-dialog-input"]')
|
||||||
testProjectNameDeleteList
|
.focus()
|
||||||
);
|
.type(testProjectNameDeleteList);
|
||||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
@ -63,11 +63,10 @@ describe("projects", () => {
|
|||||||
it("removes the project", () => {
|
it("removes the project", () => {
|
||||||
cy.contains('[data-e2e="grid-card"]', testProjectNameDeleteGrid)
|
cy.contains('[data-e2e="grid-card"]', testProjectNameDeleteGrid)
|
||||||
.find('[data-e2e="delete-project-button"]')
|
.find('[data-e2e="delete-project-button"]')
|
||||||
.trigger("mouseover")
|
.click({force: true});
|
||||||
.click();
|
cy.get('[data-e2e="confirm-dialog-input"]')
|
||||||
cy.get('[data-e2e="confirm-dialog-input"]').focus().type(
|
.focus()
|
||||||
testProjectNameDeleteGrid
|
.type(testProjectNameDeleteGrid);
|
||||||
);
|
|
||||||
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
cy.get('[data-e2e="confirm-dialog-button"]').click();
|
||||||
cy.get(".data-e2e-success");
|
cy.get(".data-e2e-success");
|
||||||
cy.wait(200);
|
cy.wait(200);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user