Skip to content
Snippets Groups Projects
Commit ef171dc1 authored by OZGCloud's avatar OZGCloud
Browse files

OZG-959 e2e

parent f22e95e0
No related branches found
No related tags found
No related merge requests found
export class ConnectionTimeoutRetryDialogE2EComponent {
private readonly locatorIcon: string = 'icon';
private readonly locatorHeader: string = 'header';
private readonly locatorMessage: string = 'message';
private readonly locatorRoot: string = 'connection-timeout-retry-dialog';
getRoot() {
return cy.getTestElement(this.locatorRoot);
}
getIcon() {
return this.getRoot().getTestElement(this.locatorIcon);
}
getHeader() {
return this.getRoot().getTestElement(this.locatorHeader);
}
getMessage() {
return this.getRoot().getTestElement(this.locatorMessage);
}
}
export class ConnectionTimeoutRetryFailDialogE2EComponent {
private readonly locatorIcon: string = 'icon';
private readonly locatorHeader: string = 'header';
private readonly locatorMessage: string = 'message';
private readonly locatorReloadButton: string = 'reload-button';
private readonly locatorRoot: string = 'connection-timeout-retry-fail-dialog';
getRoot() {
return cy.getTestElement(this.locatorRoot);
}
getIcon() {
return this.getRoot().getTestElement(this.locatorIcon);
}
getHeader() {
return this.getRoot().getTestElement(this.locatorHeader);
}
getMessage() {
return this.getRoot().getTestElement(this.locatorMessage);
}
getReloadButton() {
return this.getRoot().getTestElement(this.locatorReloadButton);
}
}
\ No newline at end of file
......@@ -4,7 +4,7 @@ export class InternalServerErrorDialogE2EComponent {
private readonly locatorHeader: string = 'error-header';
private readonly locatorMessage: string = 'error-message';
private readonly locatoLogoutButton: string = 'logout-button';
private readonly locatorLogoutButton: string = 'logout-button';
getIcon() {
return cy.getTestElement(this.locatorIcon);
......@@ -19,6 +19,6 @@ export class InternalServerErrorDialogE2EComponent {
}
getLogoutButton() {
return cy.getTestElement(this.locatoLogoutButton);
return cy.getTestElement(this.locatorLogoutButton);
}
}
\ No newline at end of file
import { ConnectionTimeoutRetryDialogE2EComponent, ConnectionTimeoutRetryFailDialogE2EComponent } from '../../components/ui/connection-timeout-retry-dialog.e2e.component';
import { VorgangDetailHeaderE2EComponent } from '../../components/vorgang/vorgang-detail-header.e2e.component';
import { VorgangListE2EComponent } from '../../components/vorgang/vorgang-list.e2e.component';
import { VorgangE2E } from '../../model/vorgang';
import { MainPage } from '../../page-objects/main.po';
import { VorgangPage } from '../../page-objects/vorgang.po';
import { interceptWithResponse, waitOfInterceptor } from '../../support/cypress-helper';
import { contains, exist } from '../../support/cypress.util';
import { loginAsTest } from '../../support/user-util';
import { createVorgang, initVorgang } from '../../support/vorgang-util';
describe('Interceptor Connection Timeout', () => {
const mainPage: MainPage = new MainPage();
const vorgangList: VorgangListE2EComponent = mainPage.getVorgangList();
const connectionTimeoutRetryDialog: ConnectionTimeoutRetryDialogE2EComponent = mainPage.getConnectionTimeoutRetryDialog();
const connectionTimeoutRetryFailDialog: ConnectionTimeoutRetryFailDialogE2EComponent = mainPage.getConnectionTimeoutRetryFailDialog();
const vorgangPage: VorgangPage = new VorgangPage();
const vorgangHeader: VorgangDetailHeaderE2EComponent = vorgangPage.getVorgangDetailHeader();
let vorgang: VorgangE2E = createVorgang();
before(() => {
initVorgang(vorgang);
loginAsTest();
exist(vorgangList.getRoot());
})
describe('annehmen', () => {
const interceptor: string = 'doVorgangAnnehmen';
const statusCode: number = 503;
beforeEach(() => {
const url: string = '*/vorgangs/602566a807bb665df9a86111/relations/602566a807bb665df9a86111/0/commands';
interceptWithResponse('POST', url, { statusCode }).as(interceptor);
})
it('should navigate to vorgang detail', () => {
vorgangList.getListItem(vorgang.name).getRoot().click();
exist(vorgangHeader.getRoot());
})
it('should show retry request dialog', () => {
vorgangPage.getFormularContainer().clickAnnehmenByButton();
waitOfInterceptor(interceptor).then((interception) => {
assert(interception.response.statusCode, statusCode.toString());
exist(connectionTimeoutRetryDialog.getIcon());
contains(connectionTimeoutRetryDialog.getHeader(), 'Es ist ein Verbindungsfehler aufgetreten ...');
contains(connectionTimeoutRetryDialog.getMessage(), 'Ihre Anfrage wird wiederholt');
})
})
it.skip('(LOCAL ONLY) should show fail dialog after time is over', () => {
cy.wait(6000);
exist(connectionTimeoutRetryFailDialog.getIcon());
contains(connectionTimeoutRetryFailDialog.getHeader(), 'Zeitüberschreitung der Verbindung');
contains(connectionTimeoutRetryFailDialog.getMessage(), 'Auch nach weiteren Versuchen konnte keine Verbindung aufgebaut werden');
exist(connectionTimeoutRetryFailDialog.getReloadButton());
})
it.skip('(LOCAL ONLY) should reload page on click on button', () => {
connectionTimeoutRetryFailDialog.getReloadButton().click();
exist(vorgangPage.getSpinner());
exist(vorgangPage.getVorgangDetailHeader().getRoot());
})
})
})
\ No newline at end of file
import { ConnectionTimeoutRetryDialogE2EComponent, ConnectionTimeoutRetryFailDialogE2EComponent } from '../components/ui/connection-timeout-retry-dialog.e2e.component';
import { InternalServerErrorDialogE2EComponent } from '../components/ui/internal-server-error-diaog.e2e.component';
import { SnackBarE2EComponent } from '../components/ui/snackbar.e2e.component';
import { VorgangListE2EComponent } from '../components/vorgang/vorgang-list.e2e.component';
......@@ -10,7 +11,9 @@ export class MainPage {
private readonly vorgangList: VorgangListE2EComponent = new VorgangListE2EComponent();
private readonly snackBar: SnackBarE2EComponent = new SnackBarE2EComponent();
private readonly dialog: InternalServerErrorDialogE2EComponent = new InternalServerErrorDialogE2EComponent();
private readonly internalServerErrorDialog: InternalServerErrorDialogE2EComponent = new InternalServerErrorDialogE2EComponent();
private readonly connectionTimeoutRetryDialog: ConnectionTimeoutRetryDialogE2EComponent = new ConnectionTimeoutRetryDialogE2EComponent();
private readonly connectionTimeoutRetryFailDialog: ConnectionTimeoutRetryFailDialogE2EComponent = new ConnectionTimeoutRetryFailDialogE2EComponent();
public open() {
cy.visit('/');
......@@ -33,6 +36,14 @@ export class MainPage {
}
public getInternalServerErrorDialog(): InternalServerErrorDialogE2EComponent {
return this.dialog;
return this.internalServerErrorDialog;
}
public getConnectionTimeoutRetryDialog(): ConnectionTimeoutRetryDialogE2EComponent {
return this.connectionTimeoutRetryDialog;
}
public getConnectionTimeoutRetryFailDialog(): ConnectionTimeoutRetryFailDialogE2EComponent {
return this.connectionTimeoutRetryFailDialog;
}
}
\ No newline at end of file
<div class="notification-dialog">
<div class="notification-dialog" data-test-id="connection-timeout-retry-dialog">
<h2 mat-dialog-title>
<mat-icon data-test-id="error-icon">error_outline</mat-icon>
<span data-test-id="error-header">Es ist ein Verbindungsfehler aufgetreten ...</span>
<mat-icon data-test-id="icon">error_outline</mat-icon>
<span data-test-id="header">Es ist ein Verbindungsfehler aufgetreten ...</span>
</h2>
<mat-dialog-content>
<p data-test-id="error-message">
<p data-test-id="message">
Ihre Anfrage wird wiederholt
</p>
</mat-dialog-content>
......
<div class="notification-dialog">
<div class="notification-dialog" data-test-id="connection-timeout-retry-fail-dialog">
<h2 mat-dialog-title>
<mat-icon data-test-id="error-icon">error_outline</mat-icon>
<span data-test-id="error-header">Zeitüberschreitung der Verbindung</span>
<mat-icon data-test-id="icon">error_outline</mat-icon>
<span data-test-id="header">Zeitüberschreitung der Verbindung</span>
</h2>
<mat-dialog-content>
<p data-test-id="error-message">
<p data-test-id="message">
Auch nach weiteren Versuchen konnte keine Verbindung aufgebaut werden. <br />
Bitte wenden Sie sich an Ihren Administrator
</p>
<goofy-client-button-with-spinner tabindex="-1" class="button" icon="refresh" text="Reload" (click)="reload()"></goofy-client-button-with-spinner>
<goofy-client-button-with-spinner tabindex="-1" class="button" icon="refresh" text="Reload" data-test-id="reload-button"
(click)="reload()">
</goofy-client-button-with-spinner>
</mat-dialog-content>
</div>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment