diff --git a/docs/guide/frameworks.md b/docs/guide/frameworks.md index 4dec853f717..3b0cd6f39c1 100644 --- a/docs/guide/frameworks.md +++ b/docs/guide/frameworks.md @@ -98,3 +98,39 @@ describe('Testing the application', () => { }); }); ``` + +## Playwright + +Integration with [Playwright](https://playwright.dev/) is also easy: + +```ts +import { faker } from '@faker-js/faker/locale/en'; +import { expect, test } from '@playwright/test'; + +test.describe('Testing the application', () => { + test('should create an account with username and password', async ({ + page, + }) => { + const username = faker.internet.userName(); + const password = faker.internet.password(); + const email = faker.internet.exampleEmail(); + + // Visit the webpage and create an account. + await page.goto('https://www.example.com/register'); + await page.getByLabel('email').fill(email); + await page.getByLabel('username').fill(username); + await page.getByLabel('password', { exact: true }).fill(password); + await page.getByLabel('confirm password').fill(password); + await page.getByRole('button', { name: 'Register' }).click(); + + // Now, we try to login with these credentials. + await page.goto('https://www.example.com/login'); + await page.getByLabel('email').fill(email); + await page.getByLabel('password').fill(password); + await page.getByRole('button', { name: 'Login' }).click(); + + // We should have logged in successfully to the dashboard page. + await expect(page).toHaveURL(/.*dashboard/); + }); +}); +``` diff --git a/src/locales/cs_CZ/person/index.ts b/src/locales/cs_CZ/person/index.ts index bf1b1484c96..91d426993ec 100644 --- a/src/locales/cs_CZ/person/index.ts +++ b/src/locales/cs_CZ/person/index.ts @@ -16,7 +16,6 @@ import male_prefix from './male_prefix'; import name_ from './name'; import prefix from './prefix'; import suffix from './suffix'; -import title from './title'; const person: PersonDefinition = { female_first_name, @@ -32,7 +31,6 @@ const person: PersonDefinition = { name: name_, prefix, suffix, - title, }; export default person; diff --git a/src/locales/cs_CZ/person/title.ts b/src/locales/cs_CZ/person/title.ts deleted file mode 100644 index 6372cc11839..00000000000 --- a/src/locales/cs_CZ/person/title.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default { - descriptor: [ - 'Lead', - 'Senior', - 'Direct', - 'Corporate', - 'Dynamic', - 'Future', - 'Product', - 'National', - 'Regional', - 'District', - 'Central', - 'Global', - 'Customer', - 'Investor', - 'International', - 'Legacy', - 'Forward', - 'Internal', - 'Human', - 'Chief', - 'Principal', - ], - level: [ - 'Solutions', - 'Program', - 'Brand', - 'Security', - 'Research', - 'Marketing', - 'Directives', - 'Implementation', - 'Integration', - 'Functionality', - 'Response', - 'Paradigm', - 'Tactics', - 'Identity', - 'Markets', - 'Group', - 'Division', - 'Applications', - 'Optimization', - 'Operations', - 'Infrastructure', - 'Intranet', - 'Communications', - 'Web', - 'Branding', - 'Quality', - 'Assurance', - 'Mobility', - 'Accounts', - 'Data', - 'Creative', - 'Configuration', - 'Accountability', - 'Interactions', - 'Factors', - 'Usability', - 'Metrics', - ], - job: [ - 'Supervisor', - 'Associate', - 'Executive', - 'Liason', - 'Officer', - 'Manager', - 'Engineer', - 'Specialist', - 'Director', - 'Coordinator', - 'Administrator', - 'Architect', - 'Analyst', - 'Designer', - 'Planner', - 'Orchestrator', - 'Technician', - 'Developer', - 'Producer', - 'Consultant', - 'Assistant', - 'Facilitator', - 'Agent', - 'Representative', - 'Strategist', - ], -}; diff --git a/src/locales/he/person/index.ts b/src/locales/he/person/index.ts index 05882d87243..9c2d4241aa5 100644 --- a/src/locales/he/person/index.ts +++ b/src/locales/he/person/index.ts @@ -12,7 +12,6 @@ import male_first_name from './male_first_name'; import male_prefix from './male_prefix'; import name_ from './name'; import prefix from './prefix'; -import title from './title'; const person: PersonDefinition = { female_first_name, @@ -24,7 +23,6 @@ const person: PersonDefinition = { male_prefix, name: name_, prefix, - title, }; export default person; diff --git a/src/locales/he/person/title.ts b/src/locales/he/person/title.ts deleted file mode 100644 index 98af89275ef..00000000000 --- a/src/locales/he/person/title.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default { - descriptor: [ - 'Lead', - 'Senior', - 'Direct', - 'Corporate', - 'Dynamic', - 'Future', - 'Product', - 'National', - 'Regional', - 'District', - 'Central', - 'Global', - 'Customer', - 'Investor', - 'International', - 'Legacy', - 'Forward', - 'Internal', - 'Human', - 'Chief', - 'Principal', - ], - level: [ - 'Solutions', - 'Program', - 'Brand', - 'Security', - 'Research', - 'Marketing', - 'Directives', - 'Implementation', - 'Integration', - 'Functionality', - 'Response', - 'Paradigm', - 'Tactics', - 'Identity', - 'Markets', - 'Group', - 'Division', - 'Applications', - 'Optimization', - 'Operations', - 'Infrastructure', - 'Intranet', - 'Communications', - 'Web', - 'Branding', - 'Quality', - 'Assurance', - 'Mobility', - 'Accounts', - 'Data', - 'Creative', - 'Configuration', - 'Accountability', - 'Interactions', - 'Factors', - 'Usability', - 'Metrics', - ], - job: [ - 'Supervisor', - 'Associate', - 'Executive', - 'Liaison', - 'Officer', - 'Manager', - 'Engineer', - 'Specialist', - 'Director', - 'Coordinator', - 'Administrator', - 'Architect', - 'Analyst', - 'Designer', - 'Planner', - 'Orchestrator', - 'Technician', - 'Developer', - 'Producer', - 'Consultant', - 'Assistant', - 'Facilitator', - 'Agent', - 'Representative', - 'Strategist', - ], -}; diff --git a/src/locales/pl/person/index.ts b/src/locales/pl/person/index.ts index 788b53ff3f8..3ce4c67ddc8 100644 --- a/src/locales/pl/person/index.ts +++ b/src/locales/pl/person/index.ts @@ -14,7 +14,6 @@ import male_prefix from './male_prefix'; import name_ from './name'; import prefix from './prefix'; import sex from './sex'; -import title from './title'; const person: PersonDefinition = { female_first_name, @@ -28,7 +27,6 @@ const person: PersonDefinition = { name: name_, prefix, sex, - title, }; export default person; diff --git a/src/locales/pl/person/title.ts b/src/locales/pl/person/title.ts deleted file mode 100644 index 98af89275ef..00000000000 --- a/src/locales/pl/person/title.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default { - descriptor: [ - 'Lead', - 'Senior', - 'Direct', - 'Corporate', - 'Dynamic', - 'Future', - 'Product', - 'National', - 'Regional', - 'District', - 'Central', - 'Global', - 'Customer', - 'Investor', - 'International', - 'Legacy', - 'Forward', - 'Internal', - 'Human', - 'Chief', - 'Principal', - ], - level: [ - 'Solutions', - 'Program', - 'Brand', - 'Security', - 'Research', - 'Marketing', - 'Directives', - 'Implementation', - 'Integration', - 'Functionality', - 'Response', - 'Paradigm', - 'Tactics', - 'Identity', - 'Markets', - 'Group', - 'Division', - 'Applications', - 'Optimization', - 'Operations', - 'Infrastructure', - 'Intranet', - 'Communications', - 'Web', - 'Branding', - 'Quality', - 'Assurance', - 'Mobility', - 'Accounts', - 'Data', - 'Creative', - 'Configuration', - 'Accountability', - 'Interactions', - 'Factors', - 'Usability', - 'Metrics', - ], - job: [ - 'Supervisor', - 'Associate', - 'Executive', - 'Liaison', - 'Officer', - 'Manager', - 'Engineer', - 'Specialist', - 'Director', - 'Coordinator', - 'Administrator', - 'Architect', - 'Analyst', - 'Designer', - 'Planner', - 'Orchestrator', - 'Technician', - 'Developer', - 'Producer', - 'Consultant', - 'Assistant', - 'Facilitator', - 'Agent', - 'Representative', - 'Strategist', - ], -}; diff --git a/src/locales/sk/person/index.ts b/src/locales/sk/person/index.ts index d839b4e1be1..64c89b1124f 100644 --- a/src/locales/sk/person/index.ts +++ b/src/locales/sk/person/index.ts @@ -15,7 +15,6 @@ import male_prefix from './male_prefix'; import name_ from './name'; import prefix from './prefix'; import suffix from './suffix'; -import title from './title'; const person: PersonDefinition = { female_first_name, @@ -30,7 +29,6 @@ const person: PersonDefinition = { name: name_, prefix, suffix, - title, }; export default person; diff --git a/src/locales/sk/person/title.ts b/src/locales/sk/person/title.ts deleted file mode 100644 index 98af89275ef..00000000000 --- a/src/locales/sk/person/title.ts +++ /dev/null @@ -1,91 +0,0 @@ -export default { - descriptor: [ - 'Lead', - 'Senior', - 'Direct', - 'Corporate', - 'Dynamic', - 'Future', - 'Product', - 'National', - 'Regional', - 'District', - 'Central', - 'Global', - 'Customer', - 'Investor', - 'International', - 'Legacy', - 'Forward', - 'Internal', - 'Human', - 'Chief', - 'Principal', - ], - level: [ - 'Solutions', - 'Program', - 'Brand', - 'Security', - 'Research', - 'Marketing', - 'Directives', - 'Implementation', - 'Integration', - 'Functionality', - 'Response', - 'Paradigm', - 'Tactics', - 'Identity', - 'Markets', - 'Group', - 'Division', - 'Applications', - 'Optimization', - 'Operations', - 'Infrastructure', - 'Intranet', - 'Communications', - 'Web', - 'Branding', - 'Quality', - 'Assurance', - 'Mobility', - 'Accounts', - 'Data', - 'Creative', - 'Configuration', - 'Accountability', - 'Interactions', - 'Factors', - 'Usability', - 'Metrics', - ], - job: [ - 'Supervisor', - 'Associate', - 'Executive', - 'Liaison', - 'Officer', - 'Manager', - 'Engineer', - 'Specialist', - 'Director', - 'Coordinator', - 'Administrator', - 'Architect', - 'Analyst', - 'Designer', - 'Planner', - 'Orchestrator', - 'Technician', - 'Developer', - 'Producer', - 'Consultant', - 'Assistant', - 'Facilitator', - 'Agent', - 'Representative', - 'Strategist', - ], -}; diff --git a/src/modules/phone/index.ts b/src/modules/phone/index.ts index b677ec4a6b8..448cdf784f8 100644 --- a/src/modules/phone/index.ts +++ b/src/modules/phone/index.ts @@ -17,6 +17,9 @@ export class PhoneModule { /** * Generates a random phone number. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number() // '961-770-7727' * @@ -28,13 +31,16 @@ export class PhoneModule { * * @param format Format of the phone number. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number('501-###-###') // '501-039-841' * faker.phone.number('+48 91 ### ## ##') // '+48 91 463 61 70' * * @since 7.3.0 * - * @deprecated Use `faker.phone.number()` without an argument instead. + * @deprecated Use `faker.phone.number()` without an argument, `faker.string.numeric()` or `faker.helpers.fromRegExp()` instead. */ number(format: string): string; /** @@ -42,6 +48,9 @@ export class PhoneModule { * * @param format Format of the phone number. Defaults to a random phone number format. * + * @see faker.string.numeric(): For generating a random string of numbers. + * @see faker.helpers.fromRegExp(): For generating a phone number matching a regular expression. + * * @example * faker.phone.number() // '961-770-7727' * @@ -52,7 +61,8 @@ export class PhoneModule { if (format != null) { deprecated({ deprecated: 'faker.phone.number(format)', - proposed: 'faker.phone.number()', + proposed: + 'faker.phone.number(), faker.string.numeric() or faker.helpers.fromRegExp()', since: '8.1', until: '9.0', });