Initial version of smartbooking generated by generator-jhipster@9.0.0-beta.0

This commit is contained in:
2025-12-10 16:41:34 +01:00
commit e4b8486f4b
376 changed files with 44072 additions and 0 deletions

View File

@@ -0,0 +1,28 @@
/* eslint-disable @typescript-eslint/no-namespace */
export type Account = Record<string, string | boolean | number>;
Cypress.Commands.add('getAccount', () => {
return cy
.authenticatedRequest({
method: 'GET',
url: '/api/account',
})
.then(response => response.body as Account);
});
Cypress.Commands.add('saveAccount', (account: Account) => {
return cy.authenticatedRequest({
method: 'POST',
url: '/api/account',
body: account,
});
});
declare global {
namespace Cypress {
interface Chainable {
getAccount(): Cypress.Chainable<Account>;
saveAccount(account: Account): Cypress.Chainable<Cypress.Response<Account>>;
}
}
}

View File

@@ -0,0 +1,123 @@
/* eslint-disable @typescript-eslint/no-namespace */
// ***********************************************
// This commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
// ***********************************************
// Begin Specific Selector Attributes for Cypress
// ***********************************************
// Navbar
export const navbarSelector = '[data-cy="navbar"]';
export const adminMenuSelector = '[data-cy="adminMenu"]';
export const accountMenuSelector = '[data-cy="accountMenu"]';
export const registerItemSelector = '[data-cy="register"]';
export const settingsItemSelector = '[data-cy="settings"]';
export const passwordItemSelector = '[data-cy="passwordItem"]';
export const loginItemSelector = '[data-cy="login"]';
export const logoutItemSelector = '[data-cy="logout"]';
export const entityItemSelector = '[data-cy="entity"]';
// Login
export const titleLoginSelector = '[data-cy="loginTitle"]';
export const errorLoginSelector = '[data-cy="loginError"]';
export const usernameLoginSelector = '[data-cy="username"]';
export const passwordLoginSelector = '[data-cy="password"]';
export const forgetYourPasswordSelector = '[data-cy="forgetYourPasswordSelector"]';
export const submitLoginSelector = '[data-cy="submit"]';
// Register
export const usernameRegisterSelector = '[data-cy="username"]';
export const emailRegisterSelector = '[data-cy="email"]';
export const firstPasswordRegisterSelector = '[data-cy="firstPassword"]';
export const secondPasswordRegisterSelector = '[data-cy="secondPassword"]';
export const submitRegisterSelector = '[data-cy="submit"]';
// Settings
export const firstNameSettingsSelector = '[data-cy="firstname"]';
export const lastNameSettingsSelector = '[data-cy="lastname"]';
export const emailSettingsSelector = '[data-cy="email"]';
export const submitSettingsSelector = '[data-cy="submit"]';
// Password
export const currentPasswordSelector = '[data-cy="currentPassword"]';
export const newPasswordSelector = '[data-cy="newPassword"]';
export const confirmPasswordSelector = '[data-cy="confirmPassword"]';
export const submitPasswordSelector = '[data-cy="submit"]';
// Reset Password
export const emailResetPasswordSelector = '[data-cy="emailResetPassword"]';
export const submitInitResetPasswordSelector = '[data-cy="submit"]';
// Administration
export const userManagementPageHeadingSelector = '[data-cy="userManagementPageHeading"]';
export const swaggerFrameSelector = 'iframe[data-cy="swagger-frame"]';
export const swaggerPageSelector = '[id="swagger-ui"]';
export const metricsPageHeadingSelector = '[data-cy="metricsPageHeading"]';
export const healthPageHeadingSelector = '[data-cy="healthPageHeading"]';
export const logsPageHeadingSelector = '[data-cy="logsPageHeading"]';
export const configurationPageHeadingSelector = '[data-cy="configurationPageHeading"]';
// ***********************************************
// End Specific Selector Attributes for Cypress
// ***********************************************
export const classInvalid = 'is-invalid';
export const classValid = 'is-valid';
Cypress.Commands.add('authenticatedRequest', data => {
return cy.getCookie('XSRF-TOKEN').then(csrfCookie => {
return cy.request({
...data,
headers: {
...data.headers,
'X-XSRF-TOKEN': csrfCookie?.value,
},
});
});
});
Cypress.Commands.add('login', (username: string, password: string) => {
cy.session(
[username, password],
() => {
cy.request({
method: 'GET',
url: '/api/account',
failOnStatusCode: false,
});
cy.authenticatedRequest({
method: 'POST',
body: { username, password },
url: Cypress.env('authenticationUrl'),
form: true,
});
},
{
validate() {
cy.authenticatedRequest({ url: '/api/account' }).its('status').should('eq', 200);
},
},
);
});
declare global {
namespace Cypress {
interface Chainable {
authenticatedRequest(data): Cypress.Chainable;
login(username: string, password: string): Cypress.Chainable;
}
}
}
import 'cypress-audit/commands';
// Convert this to a module instead of a script (allows import/export)
export {};

View File

@@ -0,0 +1,77 @@
/* eslint-disable @typescript-eslint/no-namespace */
// ***********************************************
// Begin Specific Selector Attributes for Cypress
// ***********************************************
// Entity
export const entityTableSelector = '[data-cy="entityTable"]';
export const entityCreateButtonSelector = '[data-cy="entityCreateButton"]';
export const entityCreateSaveButtonSelector = '[data-cy="entityCreateSaveButton"]';
export const entityCreateCancelButtonSelector = '[data-cy="entityCreateCancelButton"]';
export const entityDetailsButtonSelector = '[data-cy="entityDetailsButton"]'; // can return multiple elements
export const entityDetailsBackButtonSelector = '[data-cy="entityDetailsBackButton"]';
export const entityEditButtonSelector = '[data-cy="entityEditButton"]';
export const entityDeleteButtonSelector = '[data-cy="entityDeleteButton"]';
export const entityConfirmDeleteButtonSelector = '[data-cy="entityConfirmDeleteButton"]';
// ***********************************************
// End Specific Selector Attributes for Cypress
// ***********************************************
Cypress.Commands.add('getEntityHeading', (entityName: string) => cy.get(`[data-cy="${entityName}Heading"]`));
Cypress.Commands.add('getEntityCreateUpdateHeading', (entityName: string) => cy.get(`[data-cy="${entityName}CreateUpdateHeading"]`));
Cypress.Commands.add('getEntityDetailsHeading', (entityInstanceName: string) => cy.get(`[data-cy="${entityInstanceName}DetailsHeading"]`));
Cypress.Commands.add('getEntityDeleteDialogHeading', (entityInstanceName: string) =>
cy.get(`[data-cy="${entityInstanceName}DeleteDialogHeading"]`),
);
Cypress.Commands.add('setFieldImageAsBytesOfEntity', (fieldName: string, fileName: string, mimeType: string) => {
// fileName is the image which you have already put in cypress fixture folder
// should be like: 'integration-test.png', 'image/png'
cy.fixture(fileName)
.as('image')
.get(`[data-cy="${fieldName}"]`)
.then(function (el) {
const blob = Cypress.Blob.base64StringToBlob(this.image, mimeType);
const file = new File([blob], fileName, { type: mimeType });
const list = new DataTransfer();
list.items.add(file);
(el[0] as HTMLInputElement).files = list.files;
el[0].dispatchEvent(new Event('change', { bubbles: true }));
});
});
Cypress.Commands.add('setFieldSelectToLastOfEntity', (fieldName: string) => {
return cy.get(`[data-cy="${fieldName}"]`).then(select => {
const selectSize = (select[0] as HTMLSelectElement)?.options?.length || Number(select.attr('size')) || 0;
if (selectSize > 0) {
return cy.get(`[data-cy="${fieldName}"] option`).then((options: JQuery<HTMLElement>) => {
const elements = [...options].map((o: HTMLElement) => (o as HTMLOptionElement).label);
const lastElement = elements.length - 1;
cy.get(`[data-cy="${fieldName}"]`).select(lastElement);
cy.get(`[data-cy="${fieldName}"]`).type('{downarrow}');
});
}
return cy.get(`[data-cy="${fieldName}"]`).type('{downarrow}');
});
});
declare global {
namespace Cypress {
interface Chainable {
getEntityHeading(entityName: string): Cypress.Chainable;
getEntityCreateUpdateHeading(entityName: string): Cypress.Chainable;
getEntityDetailsHeading(entityInstanceName: string): Cypress.Chainable;
getEntityDeleteDialogHeading(entityInstanceName: string): Cypress.Chainable;
setFieldImageAsBytesOfEntity(fieldName: string, fileName: string, mimeType: string): Cypress.Chainable;
setFieldSelectToLastOfEntity(fieldName: string): Cypress.Chainable;
}
}
}
// Convert this to a module instead of a script (allows import/export)
export {};

View File

@@ -0,0 +1,20 @@
// ***********************************************************
// This support/index.js is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************
import './account';
import './commands';
import './navbar';
import './entity';
import './management';

View File

@@ -0,0 +1,22 @@
/* eslint-disable @typescript-eslint/no-namespace */
/* eslint-disable @typescript-eslint/no-unsafe-return */
Cypress.Commands.add('getManagementInfo', () => {
return cy
.request({
method: 'GET',
url: '/management/info',
})
.then(response => response.body);
});
declare global {
namespace Cypress {
interface Chainable {
getManagementInfo(): Cypress.Chainable;
}
}
}
// Convert this to a module instead of a script (allows import/export)
export {};

View File

@@ -0,0 +1,65 @@
/* eslint-disable @typescript-eslint/no-namespace */
import {
accountMenuSelector,
adminMenuSelector,
entityItemSelector,
loginItemSelector,
logoutItemSelector,
navbarSelector,
passwordItemSelector,
registerItemSelector,
settingsItemSelector,
} from './commands';
Cypress.Commands.add('clickOnLoginItem', () => {
cy.get(navbarSelector).get(accountMenuSelector).click();
return cy.get(navbarSelector).get(accountMenuSelector).get(loginItemSelector).click();
});
Cypress.Commands.add('clickOnLogoutItem', () => {
cy.get(navbarSelector).get(accountMenuSelector).click();
return cy.get(navbarSelector).get(accountMenuSelector).get(logoutItemSelector).click();
});
Cypress.Commands.add('clickOnRegisterItem', () => {
cy.get(navbarSelector).get(accountMenuSelector).click();
return cy.get(navbarSelector).get(accountMenuSelector).get(registerItemSelector).click();
});
Cypress.Commands.add('clickOnSettingsItem', () => {
cy.get(navbarSelector).get(accountMenuSelector).click();
return cy.get(navbarSelector).get(accountMenuSelector).get(settingsItemSelector).click();
});
Cypress.Commands.add('clickOnPasswordItem', () => {
cy.get(navbarSelector).get(accountMenuSelector).click();
return cy.get(navbarSelector).get(accountMenuSelector).get(passwordItemSelector).click();
});
Cypress.Commands.add('clickOnAdminMenuItem', (item: string) => {
cy.get(navbarSelector).get(adminMenuSelector).click();
return cy.get(navbarSelector).get(adminMenuSelector).get(`.dropdown-item[href="/admin/${item}"]`).click();
});
Cypress.Commands.add('clickOnEntityMenuItem', (entityName: string) => {
cy.get(navbarSelector).get(entityItemSelector).click();
return cy.get(navbarSelector).get(entityItemSelector).get(`.dropdown-item[href="/${entityName}"]`).click();
});
declare global {
namespace Cypress {
interface Chainable {
clickOnLoginItem(): Cypress.Chainable;
clickOnLogoutItem(): Cypress.Chainable;
clickOnRegisterItem(): Cypress.Chainable;
clickOnSettingsItem(): Cypress.Chainable;
clickOnPasswordItem(): Cypress.Chainable;
clickOnAdminMenuItem(item: string): Cypress.Chainable;
clickOnEntityMenuItem(entityName: string): Cypress.Chainable;
}
}
}
// Convert this to a module instead of a script (allows import/export)
export {};