ToolJet/cypress-tests/cypress/fixtures/fake.js
Midhun Kumar E d36cc44920
test: Add automation for text-input revamp. (#8671)
* init textinput revamp

* updated styles panel

* bugfix

* updates

* fix :: accordion

* fix :: styling

* add box shadow , additional property,tooltip

* fix conditional render for styles

* feat :: fixed order of each property and styles

* feat :: styling input

* bugfix

* feat :: add option to add icon

* add option to add icon

* adding option to toggle visibility

* updated password input with new design

* chnaging component location

* bugfix

* style fixes

* fix :: added loader

* updated :: few detailing

* few bugfixes

* fix :: for form widget label

* fixes

* added option to add icon color

* including label field for password input

* fix for label

* fix

* test fix backward compatibility for height

* updates

* revert

* adding key for distinguishing older and newer widgets

* testing

* test

* test

* update

* update

* migration testing

* limit vertical resizing in textinput

* testing

* throw test

* test

* adding check for label length

* fixing edge cases

* removing resize

* backward compatibility height

* backward compatibility

* number input review fixes

* added exposed items

* fixing csa

* ui fixes

* fix height compatibility

* feat :: csa for all inputs and exposed variables

* backward compatibility fixes and validation fixes

* fixes :: textinput positioning of loader and icon

* fix :: password input

* cleanup and fixes

* fixes

* cleanup

* fixes

* review fixes

* review fixes

* typo fix

* fix padding

* review fixes styles component panel

* fix naming

* fix padding

* fix :: icons position

* updates

* cleanup

* updates events , csa

* backward compatibility

* clean

* feat :: change validation from properties

* ui fixes

* icon name

* removed 'px' text from tooltip

* fixes placeholder

* few updates :: removing label in form

* ui in form

* update :: number input validation behaviour

* testing fixes

* added side handlers

* removing unwanted fx

* disabling fx for padding field

* ordering change

* fix

* label issue + restricted side handler

* fix :: box shadow bug

* on change event doesnt propagate exposed vars correctly

* adding debounce for slider value change

* fix :: for modal ooen bug during onfocus event

* test slider

* Add common utils

* Modify helpers

* Add text input spec

* Add utils for field validation

* Minor spec updates

* Fix for password  basic automation cases

---------

Co-authored-by: stepinfwd <[email protected]>
2024-02-06 10:27:31 +05:30

87 lines
2.3 KiB
JavaScript

import { faker } from "@faker-js/faker";
export let fake = {};
function email() {
return `${faker.name.firstName()}@example.com`;
}
function password() {
return faker.internet.password();
}
function firstName() {
return faker.name.firstName();
}
function lastName() {
return faker.name.lastName();
}
function fullName() {
return `${faker.name.firstName()} ${faker.name.lastName()}`;
}
function companyName() {
const str = `${faker.company.companyName()} ${faker.name.lastName()}`;
return str.substring(0, str.indexOf(" ")).replace(/[^a-zA-Z ]/g, "");
}
function widgetName() {
return faker.name.firstName();
}
function randomSentence() {
return faker.lorem.sentence();
}
function randomRgba() {
let rgba = faker.color.rgb({ format: "decimal", includeAlpha: true });
let alpha = rgba[rgba.length - 1].toPrecision(2) * 100;
alpha = Math.min(Math.max(alpha, 20), 80);
rgba[rgba.length - 1] = alpha;
return rgba;
}
function randomRgb() {
return faker.color.rgb({ format: "decimal" });
}
function boxShadowParam() {
const paramArray = [
faker.datatype.number({
min: -20,
max: 20,
}),
faker.datatype.number({
min: -20,
max: 20,
}),
faker.datatype.number({
min: 0,
max: 20,
}),
faker.datatype.number({
min: 0,
max: 20,
}),
];
return paramArray;
}
function randomRgbaHex() {
let rgba = faker.color.rgb({ format: "hex", casing: "lower" });
return rgba;
}
function tableName() {
return faker.name.firstName();
}
Object.defineProperty(fake, "email", { get: email });
Object.defineProperty(fake, "password", { get: password });
Object.defineProperty(fake, "firstName", { get: firstName });
Object.defineProperty(fake, "lastName", { get: lastName });
Object.defineProperty(fake, "fullName", { get: fullName });
Object.defineProperty(fake, "companyName", { get: companyName });
Object.defineProperty(fake, "widgetName", { get: widgetName });
Object.defineProperty(fake, "randomSentence", { get: randomSentence });
Object.defineProperty(fake, "randomRgba", { get: randomRgba });
Object.defineProperty(fake, "randomRgb", { get: randomRgb });
Object.defineProperty(fake, "boxShadowParam", { get: boxShadowParam });
Object.defineProperty(fake, "randomRgbaHex", { get: randomRgbaHex });
Object.defineProperty(fake, "tableName", { get: tableName });