Skip to content

Commit

Permalink
Release build 6.13.0 [ci release]
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathanKingston authored and github-actions[bot] committed Sep 3, 2024
1 parent 5876a5d commit 3ce4894
Show file tree
Hide file tree
Showing 10 changed files with 287 additions and 115 deletions.
67 changes: 47 additions & 20 deletions Sources/ContentScopeScripts/dist/contentScopeIsolated.js
Original file line number Diff line number Diff line change
Expand Up @@ -11008,6 +11008,36 @@
return elementValue
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

function generateStreetAddress () {
const streetDigits = generateRandomInt(1, 5);
const streetNumber = generateRandomInt(2, streetDigits * 1000);
const streetNames = ['Main', 'Elm', 'Maple', 'Oak', 'Pine', 'Cedar', 'Hill', 'Lake', 'Sunset', 'Washington', 'Lincoln', 'Marshall', 'Spring', 'Ridge', 'Valley', 'Meadow', 'Forest'];
const streetName = streetNames[generateRandomInt(0, streetNames.length - 1)];
const suffixes = ['', 'St', 'Ave', 'Blvd', 'Rd', 'Ct', 'Dr', 'Ln', 'Pkwy', 'Pl', 'Ter', 'Way'];
const suffix = suffixes[generateRandomInt(0, suffixes.length - 1)];

return `${streetNumber} ${streetName}${suffix ? ' ' + suffix : ''}`
}

/**
* @param {Record<string, any>} action
* @param {Record<string, any>} userData
Expand Down Expand Up @@ -11039,7 +11069,7 @@
/**
* Try to fill form elements. Collecting results + warnings for reporting.
* @param {HTMLElement} root
* @param {{selector: string; type: string}[]} elements
* @param {{selector: string; type: string; min?: string; max?: string;}[]} elements
* @param {Record<string, any>} data
* @return {({result: true} | {result: false; error: string})[]}
*/
Expand All @@ -11059,6 +11089,22 @@
results.push(setValueForInput(inputElem, generatePhoneNumber()));
} else if (element.type === '$generated_zip_code$') {
results.push(setValueForInput(inputElem, generateZipCode()));
} else if (element.type === '$generated_random_number$') {
if (!element.min || !element.max) {
results.push({ result: false, error: `element found with selector '${element.selector}', but missing min and/or max values` });
continue
}
const minInt = parseInt(element?.min);
const maxInt = parseInt(element?.max);

if (isNaN(minInt) || isNaN(maxInt)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but min or max was not a number` });
continue
}

results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -11171,25 +11217,6 @@
}
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

/**
* @param {object} args
* @param {string} args.token
Expand Down
67 changes: 47 additions & 20 deletions build/contentScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -20942,6 +20942,36 @@
return elementValue
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

function generateStreetAddress () {
const streetDigits = generateRandomInt(1, 5);
const streetNumber = generateRandomInt(2, streetDigits * 1000);
const streetNames = ['Main', 'Elm', 'Maple', 'Oak', 'Pine', 'Cedar', 'Hill', 'Lake', 'Sunset', 'Washington', 'Lincoln', 'Marshall', 'Spring', 'Ridge', 'Valley', 'Meadow', 'Forest'];
const streetName = streetNames[generateRandomInt(0, streetNames.length - 1)];
const suffixes = ['', 'St', 'Ave', 'Blvd', 'Rd', 'Ct', 'Dr', 'Ln', 'Pkwy', 'Pl', 'Ter', 'Way'];
const suffix = suffixes[generateRandomInt(0, suffixes.length - 1)];

return `${streetNumber} ${streetName}${suffix ? ' ' + suffix : ''}`
}

/**
* @param {Record<string, any>} action
* @param {Record<string, any>} userData
Expand Down Expand Up @@ -20973,7 +21003,7 @@
/**
* Try to fill form elements. Collecting results + warnings for reporting.
* @param {HTMLElement} root
* @param {{selector: string; type: string}[]} elements
* @param {{selector: string; type: string; min?: string; max?: string;}[]} elements
* @param {Record<string, any>} data
* @return {({result: true} | {result: false; error: string})[]}
*/
Expand All @@ -20993,6 +21023,22 @@
results.push(setValueForInput(inputElem, generatePhoneNumber()));
} else if (element.type === '$generated_zip_code$') {
results.push(setValueForInput(inputElem, generateZipCode()));
} else if (element.type === '$generated_random_number$') {
if (!element.min || !element.max) {
results.push({ result: false, error: `element found with selector '${element.selector}', but missing min and/or max values` });
continue
}
const minInt = parseInt(element?.min);
const maxInt = parseInt(element?.max);

if (isNaN(minInt) || isNaN(maxInt)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but min or max was not a number` });
continue
}

results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -21105,25 +21151,6 @@
}
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

/**
* @param {object} args
* @param {string} args.token
Expand Down
67 changes: 47 additions & 20 deletions build/integration/contentScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -20942,6 +20942,36 @@
return elementValue
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

function generateStreetAddress () {
const streetDigits = generateRandomInt(1, 5);
const streetNumber = generateRandomInt(2, streetDigits * 1000);
const streetNames = ['Main', 'Elm', 'Maple', 'Oak', 'Pine', 'Cedar', 'Hill', 'Lake', 'Sunset', 'Washington', 'Lincoln', 'Marshall', 'Spring', 'Ridge', 'Valley', 'Meadow', 'Forest'];
const streetName = streetNames[generateRandomInt(0, streetNames.length - 1)];
const suffixes = ['', 'St', 'Ave', 'Blvd', 'Rd', 'Ct', 'Dr', 'Ln', 'Pkwy', 'Pl', 'Ter', 'Way'];
const suffix = suffixes[generateRandomInt(0, suffixes.length - 1)];

return `${streetNumber} ${streetName}${suffix ? ' ' + suffix : ''}`
}

/**
* @param {Record<string, any>} action
* @param {Record<string, any>} userData
Expand Down Expand Up @@ -20973,7 +21003,7 @@
/**
* Try to fill form elements. Collecting results + warnings for reporting.
* @param {HTMLElement} root
* @param {{selector: string; type: string}[]} elements
* @param {{selector: string; type: string; min?: string; max?: string;}[]} elements
* @param {Record<string, any>} data
* @return {({result: true} | {result: false; error: string})[]}
*/
Expand All @@ -20993,6 +21023,22 @@
results.push(setValueForInput(inputElem, generatePhoneNumber()));
} else if (element.type === '$generated_zip_code$') {
results.push(setValueForInput(inputElem, generateZipCode()));
} else if (element.type === '$generated_random_number$') {
if (!element.min || !element.max) {
results.push({ result: false, error: `element found with selector '${element.selector}', but missing min and/or max values` });
continue
}
const minInt = parseInt(element?.min);
const maxInt = parseInt(element?.max);

if (isNaN(minInt) || isNaN(maxInt)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but min or max was not a number` });
continue
}

results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -21105,25 +21151,6 @@
}
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

/**
* @param {object} args
* @param {string} args.token
Expand Down
67 changes: 47 additions & 20 deletions build/windows/contentScope.js
Original file line number Diff line number Diff line change
Expand Up @@ -16247,6 +16247,36 @@
return elementValue
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

function generateStreetAddress () {
const streetDigits = generateRandomInt(1, 5);
const streetNumber = generateRandomInt(2, streetDigits * 1000);
const streetNames = ['Main', 'Elm', 'Maple', 'Oak', 'Pine', 'Cedar', 'Hill', 'Lake', 'Sunset', 'Washington', 'Lincoln', 'Marshall', 'Spring', 'Ridge', 'Valley', 'Meadow', 'Forest'];
const streetName = streetNames[generateRandomInt(0, streetNames.length - 1)];
const suffixes = ['', 'St', 'Ave', 'Blvd', 'Rd', 'Ct', 'Dr', 'Ln', 'Pkwy', 'Pl', 'Ter', 'Way'];
const suffix = suffixes[generateRandomInt(0, suffixes.length - 1)];

return `${streetNumber} ${streetName}${suffix ? ' ' + suffix : ''}`
}

/**
* @param {Record<string, any>} action
* @param {Record<string, any>} userData
Expand Down Expand Up @@ -16278,7 +16308,7 @@
/**
* Try to fill form elements. Collecting results + warnings for reporting.
* @param {HTMLElement} root
* @param {{selector: string; type: string}[]} elements
* @param {{selector: string; type: string; min?: string; max?: string;}[]} elements
* @param {Record<string, any>} data
* @return {({result: true} | {result: false; error: string})[]}
*/
Expand All @@ -16298,6 +16328,22 @@
results.push(setValueForInput(inputElem, generatePhoneNumber()));
} else if (element.type === '$generated_zip_code$') {
results.push(setValueForInput(inputElem, generateZipCode()));
} else if (element.type === '$generated_random_number$') {
if (!element.min || !element.max) {
results.push({ result: false, error: `element found with selector '${element.selector}', but missing min and/or max values` });
continue
}
const minInt = parseInt(element?.min);
const maxInt = parseInt(element?.max);

if (isNaN(minInt) || isNaN(maxInt)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but min or max was not a number` });
continue
}

results.push(setValueForInput(inputElem, generateRandomInt(parseInt(element.min), parseInt(element.max)).toString()));
} else if (element.type === '$generated_street_address$') {
results.push(setValueForInput(inputElem, generateStreetAddress()));
} else {
if (!Object.prototype.hasOwnProperty.call(data, element.type)) {
results.push({ result: false, error: `element found with selector '${element.selector}', but data didn't contain the key '${element.type}'` });
Expand Down Expand Up @@ -16410,25 +16456,6 @@
}
}

function generatePhoneNumber () {
/**
* 3 digits, 2-8, last two digits technically can't end in two 1s, but we'll ignore that requirement
* Source: https://math.stackexchange.com/questions/920972/how-many-different-phone-numbers-are-possible-within-an-area-code/1115411#1115411
*/
const areaCode = generateRandomInt(200, 899).toString();

// 555-0100 through 555-0199 are for fictional use (https://en.wikipedia.org/wiki/555_(telephone_number)#Fictional_usage)
const exchangeCode = '555';
const lineNumber = generateRandomInt(100, 199).toString().padStart(4, '0');

return `${areaCode}${exchangeCode}${lineNumber}`
}

function generateZipCode () {
const zipCode = generateRandomInt(10000, 99999).toString();
return zipCode
}

/**
* @param {object} args
* @param {string} args.token
Expand Down
8 changes: 8 additions & 0 deletions integration-test/playwright/page-objects/broker-protection.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,16 @@ export class BrokerProtectionPage {
await expect(this.page.getByLabel('First Name:')).toHaveValue('John')
await expect(this.page.getByLabel('Last Name:')).toHaveValue('Smith')
await expect(this.page.getByLabel('Phone Number:')).toHaveValue(/^\d{10}$/)
await expect(this.page.getByLabel('Street Address:')).toHaveValue(/^\d+ [A-Za-z]+(?: [A-Za-z]+)?$/)
await expect(this.page.getByLabel('State:')).toHaveValue('IL')
await expect(this.page.getByLabel('Zip Code:')).toHaveValue(/^\d{5}$/)

const randomValue = await this.page.getByLabel('Random number between 5 and 15:').inputValue()
const randomValueInt = parseInt(randomValue)

expect(Number.isInteger(randomValueInt)).toBe(true)
expect(randomValueInt).toBeGreaterThanOrEqual(5)
expect(randomValueInt).toBeLessThanOrEqual(15)
}

/**
Expand Down
Loading

0 comments on commit 3ce4894

Please sign in to comment.