diff --git a/react-checkout/e2e/checkout.spec.ts b/react-checkout/e2e/checkout.spec.ts index 1527043..a7971dc 100644 --- a/react-checkout/e2e/checkout.spec.ts +++ b/react-checkout/e2e/checkout.spec.ts @@ -10,19 +10,19 @@ async function expectNoSidewaysScroll(page: Page) { expect(overflow).toBeLessThanOrEqual(0) } -/** Fills in an order that is valid: two mugs, shipped to Zagreb, paid by card. */ +/** Fills in an order that is valid: two mugs, shipped to Belgrade, paid by card. */ async function fillValidOrder(page: Page) { - await page.getByRole('textbox', { name: 'Email' }).fill('jana@example.com') + await page.getByRole('textbox', { name: 'Email' }).fill('jelena@example.com') await page.getByRole('button', { name: 'Add an item' }).click() const item = page.getByRole('region', { name: 'Item 1' }) await item.getByLabel('Product').selectOption('Ceramic mug') await item.getByLabel('Quantity').fill('2') await page.getByRole('radio', { name: /^Standard/ }).check() - await page.getByLabel('Full name').fill('Jana Kovač') - await page.getByLabel('Street and number').fill('Ilica 1') - await page.getByLabel('Postal code').fill('10000') - await page.getByLabel('City').fill('Zagreb') - await page.getByLabel('Country').selectOption('Croatia') + await page.getByLabel('Full name').fill('Jelena Jovanović') + await page.getByLabel('Street and number').fill('Knez Mihailova 1') + await page.getByLabel('Postal code').fill('11000') + await page.getByLabel('City').fill('Belgrade') + await page.getByLabel('Country').selectOption('Serbia') await page.getByRole('checkbox', { name: /terms of sale/ }).check() } @@ -67,18 +67,18 @@ test('places an order that the server validates and prices again', async ({ // The total comes from the server, which worked it out from the validated order. await expect(page.getByText('Total paid: €42.40')).toBeVisible() expect(await confirmedOrder(page)).toEqual({ - email: 'jana@example.com', + email: 'jelena@example.com', lines: [ { product: 'mug', quantity: 2 }, { product: 'notebook', quantity: 1 }, ], delivery: 'standard', shipping: { - fullName: 'Jana Kovač', - street: 'Ilica 1', - zip: '10000', - city: 'Zagreb', - country: 'HR', + fullName: 'Jelena Jovanović', + street: 'Knez Mihailova 1', + zip: '11000', + city: 'Belgrade', + country: 'RS', }, paymentMethod: 'card', coupon: 'SPRING', @@ -104,7 +104,7 @@ test('stops an invalid order in the browser, before it reaches the server', asyn await expectNoSidewaysScroll(page) // The messages of rules: a format, a whole number in a range, a pattern. - await page.getByRole('textbox', { name: 'Email' }).fill('jana@example') + await page.getByRole('textbox', { name: 'Email' }).fill('jelena@example') await page.getByRole('button', { name: 'Add an item' }).click() await page.getByLabel('Quantity').fill('11') await page.getByLabel('Postal code').fill('ABC') @@ -141,7 +141,7 @@ test('shows the fields a condition asks for, and drops what it hides', async ({ await page.getByRole('radio', { name: /^Invoice/ }).check() await page.getByRole('button', { name: 'Place order' }).click() await expect(page.getByText('Enter the company name')).toBeVisible() - await page.getByLabel('Company name').fill('Kovač d.o.o.') + await page.getByLabel('Company name').fill('Jovanović d.o.o.') await page.getByRole('button', { name: 'Place order' }).click() await expect(page.getByText('Total paid: €28.00')).toBeVisible() @@ -149,7 +149,7 @@ test('shows the fields a condition asks for, and drops what it hides', async ({ delivery: 'pickup', shipping: {}, paymentMethod: 'invoice', - company: 'Kovač d.o.o.', + company: 'Jovanović d.o.o.', }) }) @@ -202,7 +202,7 @@ test('shows the server rejecting an order that got past the browser', async ({ test('speaks German in the browser and on the server, and keeps the input', async ({ page, }) => { - await page.getByRole('textbox', { name: 'Email' }).fill('jana@example') + await page.getByRole('textbox', { name: 'Email' }).fill('jelena@example') await page.getByRole('button', { name: 'Add an item' }).click() await page.getByLabel('Product').selectOption('Canvas tote bag') await page.getByLabel('Quantity').fill('3') @@ -211,7 +211,7 @@ test('speaks German in the browser and on the server, and keeps the input', asyn await page.getByRole('button', { name: 'Deutsch' }).click() await expect(page.getByRole('heading', { name: 'Kasse' })).toBeVisible() await expect(page.getByRole('textbox', { name: 'E-Mail' })).toHaveValue( - 'jana@example', + 'jelena@example', ) await expect(page.getByTestId('summary')).toContainText('3 x Stofftasche') await expect(page.getByTestId('summary')).toContainText('54,00 €') @@ -225,7 +225,7 @@ test('speaks German in the browser and on the server, and keeps the input', asyn await expect(page.getByText('Wählen Sie eine Lieferart')).toBeVisible() await expectNoSidewaysScroll(page) - await page.getByRole('textbox', { name: 'E-Mail' }).fill('jana@example.com') + await page.getByRole('textbox', { name: 'E-Mail' }).fill('jelena@example.com') await page.getByRole('radio', { name: /^Abholung/ }).check() await page.getByRole('checkbox', { name: /Verkaufsbedingungen/ }).check() diff --git a/react-checkout/server/app.test.ts b/react-checkout/server/app.test.ts index 37d8eaa..421c659 100644 --- a/react-checkout/server/app.test.ts +++ b/react-checkout/server/app.test.ts @@ -12,15 +12,15 @@ const app = createApp() /** An order that passes: one item, shipped, paid by card. */ const valid = { - email: 'jana@example.com', + email: 'jelena@example.com', lines: [{ product: 'mug', quantity: 2 }], delivery: 'standard', shipping: { - fullName: 'Jana Kovač', - street: 'Ilica 1', - zip: '10000', - city: 'Zagreb', - country: 'HR', + fullName: 'Jelena Jovanović', + street: 'Knez Mihailova 1', + zip: '11000', + city: 'Belgrade', + country: 'RS', }, paymentMethod: 'card', acceptTerms: true, @@ -79,7 +79,7 @@ describe('POST /api/orders', () => { it('rejects an order the browser would never send, in the language asked for', async () => { const tampered = { ...valid, - email: 'jana', + email: 'jelena', lines: [{ product: 'mug', quantity: 'many' }, { quantity: 11 }], shipping: { ...valid.shipping, zip: 'ABC' }, acceptTerms: false, diff --git a/react-checkout/shared/definition.test.ts b/react-checkout/shared/definition.test.ts index 3a3b24e..2b528c2 100644 --- a/react-checkout/shared/definition.test.ts +++ b/react-checkout/shared/definition.test.ts @@ -55,7 +55,7 @@ describe('the languages', () => { it('give the same schema its messages, each in its own words', () => { const input = { - email: 'jana', + email: 'jelena', lines: [], delivery: 'pickup', paymentMethod: 'card', diff --git a/react-checkout/shared/definition.ts b/react-checkout/shared/definition.ts index ef41910..ab5b542 100644 --- a/react-checkout/shared/definition.ts +++ b/react-checkout/shared/definition.ts @@ -114,7 +114,7 @@ export const checkoutDefinition = builders.en.defineForm({ required: { message: 'checkout.country.required' }, options: [ { value: 'AT', label: 'checkout.country.AT' }, - { value: 'HR', label: 'checkout.country.HR' }, + { value: 'RS', label: 'checkout.country.RS' }, { value: 'DE', label: 'checkout.country.DE' }, ], ui: { autocomplete: 'country' }, diff --git a/react-checkout/shared/i18n.ts b/react-checkout/shared/i18n.ts index 2aab7fb..798c57e 100644 --- a/react-checkout/shared/i18n.ts +++ b/react-checkout/shared/i18n.ts @@ -19,7 +19,7 @@ export function isLocale(value: unknown): value is Locale { const messages = { en: { 'app.title': 'Checkout', - 'app.lead': 'Paper goods, shipped from Zagreb.', + 'app.lead': 'Paper goods, shipped from Belgrade.', 'app.language': 'Language', 'app.loading': 'Loading the checkout...', 'app.loadFailed': "The checkout can't be loaded", @@ -73,7 +73,7 @@ const messages = { 'checkout.country.label': 'Country', 'checkout.country.required': 'Choose a country', 'checkout.country.AT': 'Austria', - 'checkout.country.HR': 'Croatia', + 'checkout.country.RS': 'Serbia', 'checkout.country.DE': 'Germany', 'checkout.payment.label': 'Payment method', 'checkout.payment.required': 'Choose how to pay', @@ -109,7 +109,7 @@ const messages = { }, de: { 'app.title': 'Kasse', - 'app.lead': 'Papierwaren, verschickt aus Zagreb.', + 'app.lead': 'Papierwaren, verschickt aus Belgrad.', 'app.language': 'Sprache', 'app.loading': 'Die Kasse wird geladen...', 'app.loadFailed': 'Die Kasse kann nicht geladen werden', @@ -164,7 +164,7 @@ const messages = { 'checkout.country.label': 'Land', 'checkout.country.required': 'Wählen Sie ein Land', 'checkout.country.AT': 'Österreich', - 'checkout.country.HR': 'Kroatien', + 'checkout.country.RS': 'Serbien', 'checkout.country.DE': 'Deutschland', 'checkout.payment.label': 'Zahlungsart', 'checkout.payment.required': 'Wählen Sie eine Zahlungsart', diff --git a/react-checkout/shared/types.ts b/react-checkout/shared/types.ts index 3ddc8da..8c53a37 100644 --- a/react-checkout/shared/types.ts +++ b/react-checkout/shared/types.ts @@ -13,7 +13,7 @@ export interface Checkout { street?: string zip?: string city?: string - country?: 'AT' | 'HR' | 'DE' + country?: 'AT' | 'RS' | 'DE' } paymentMethod: 'card' | 'invoice' company?: string diff --git a/vue-event-registration/e2e/registration.spec.ts b/vue-event-registration/e2e/registration.spec.ts index 8295c5e..853a46e 100644 --- a/vue-event-registration/e2e/registration.spec.ts +++ b/vue-event-registration/e2e/registration.spec.ts @@ -29,9 +29,9 @@ async function fillAboutYou( page: Page, ticket: 'Standard' | 'Student' | 'Business', ) { - await page.getByRole('textbox', { name: 'First name' }).fill(' Ana ') - await page.getByRole('textbox', { name: 'Last name' }).fill('Horvat') - await page.getByRole('textbox', { name: 'Email' }).fill('ana@example.com') + await page.getByRole('textbox', { name: 'First name' }).fill(' Marko ') + await page.getByRole('textbox', { name: 'Last name' }).fill('Petrović') + await page.getByRole('textbox', { name: 'Email' }).fill('marko@example.com') await page.getByRole('radio', { name: new RegExp(`^${ticket}`) }).check() } @@ -50,7 +50,7 @@ test('registers a business attendee with guests, step by step', async ({ /Confirm/, ]) await fillAboutYou(page, 'Business') - await page.getByRole('textbox', { name: 'Phone' }).fill('+385 91 234 5678') + await page.getByRole('textbox', { name: 'Phone' }).fill('+381 61 234 5678') await expect(stepLabels(page)).toHaveText([ /About you/, /Your visit/, @@ -80,26 +80,30 @@ test('registers a business attendee with guests, step by step', async ({ await expect(page.getByText('Nothing added yet.')).toBeVisible() await page.getByRole('button', { name: 'Add guest' }).click() const firstGuest = page.getByRole('region', { name: 'Guest 1' }) - await firstGuest.getByRole('textbox', { name: 'Name' }).fill('Ivo Horvat') + await firstGuest + .getByRole('textbox', { name: 'Name' }) + .fill('Nikola Petrović') await firstGuest .getByRole('textbox', { name: 'Email' }) - .fill('ivo@example.com') + .fill('nikola@example.com') // A new item starts with the defaults of its fields. await expect(firstGuest.getByLabel('Meal')).toHaveValue('0') await page.getByRole('button', { name: 'Add guest' }).click() const secondGuest = page.getByRole('region', { name: 'Guest 2' }) - await secondGuest.getByRole('textbox', { name: 'Name' }).fill('Mia Novak') + await secondGuest + .getByRole('textbox', { name: 'Name' }) + .fill('Milica Nikolić') await secondGuest.getByLabel('Meal').selectOption('Vegan') await expectNoSidewaysScroll(page) await next(page) await expect(currentStep(page)).toHaveText(/Invoice/) - await page.getByLabel('Company name').fill('Horvat d.o.o.') - await page.getByLabel('VAT ID').fill('HR12345678901') - await page.getByLabel('Street and number').fill('Ilica 1') - await page.getByLabel('City').fill('Zagreb') - await page.getByLabel('ZIP code').fill('10000') - await page.getByLabel('Country').selectOption('Croatia') + await page.getByLabel('Company name').fill('Petrović d.o.o.') + await page.getByLabel('VAT ID').fill('RS123456789') + await page.getByLabel('Street and number').fill('Knez Mihailova 1') + await page.getByLabel('City').fill('Belgrade') + await page.getByLabel('ZIP code').fill('11000') + await page.getByLabel('Country').selectOption('Serbia') await expectNoSidewaysScroll(page) await next(page) @@ -111,8 +115,8 @@ test('registers a business attendee with guests, step by step', async ({ await expect(summary).toContainText( 'Opening keynote, Hands-on forms workshop', ) - await expect(summary).toContainText('Mia Novak, Vegan') - await expect(summary).toContainText('Croatia') + await expect(summary).toContainText('Milica Nikolić, Vegan') + await expect(summary).toContainText('Serbia') await expectNoSidewaysScroll(page) await page @@ -127,10 +131,10 @@ test('registers a business attendee with guests, step by step', async ({ (await page.getByTestId('output').textContent()) ?? '', ) as unknown expect(output).toEqual({ - firstName: 'Ana', - lastName: 'Horvat', - email: 'ana@example.com', - phone: '+385 91 234 5678', + firstName: 'Marko', + lastName: 'Petrović', + email: 'marko@example.com', + phone: '+381 61 234 5678', ticketType: 'business', arrival: '2027-05-10', departure: '2027-05-11', @@ -139,15 +143,19 @@ test('registers a business attendee with guests, step by step', async ({ needsAssistance: true, assistanceDetails: 'Step-free access', guests: [ - { name: 'Ivo Horvat', email: 'ivo@example.com', meal: 'standard' }, - { name: 'Mia Novak', meal: 'vegan' }, + { + name: 'Nikola Petrović', + email: 'nikola@example.com', + meal: 'standard', + }, + { name: 'Milica Nikolić', meal: 'vegan' }, ], - company: { name: 'Horvat d.o.o.', vatId: 'HR12345678901' }, + company: { name: 'Petrović d.o.o.', vatId: 'RS123456789' }, billingAddress: { - street: 'Ilica 1', - city: 'Zagreb', - zip: '10000', - country: 'HR', + street: 'Knez Mihailova 1', + city: 'Belgrade', + zip: '11000', + country: 'RS', }, acceptTerms: true, newsletter: false, @@ -170,19 +178,19 @@ test('keeps the user on a step until its fields are valid', async ({ // The messages of rules, and of a field that only shows for a student ticket. await fillAboutYou(page, 'Student') - await page.getByRole('textbox', { name: 'Email' }).fill('ana@example') + await page.getByRole('textbox', { name: 'Email' }).fill('marko@example') await page.getByRole('textbox', { name: 'Phone' }).fill('call me') await next(page) await expect(currentStep(page)).toHaveText(/About you/) await expect(page.getByText('Enter a valid email address')).toBeVisible() await expect( - page.getByText('Use digits and spaces, like +385 91 234 5678'), + page.getByText('Use digits and spaces, like +381 61 234 5678'), ).toBeVisible() await expect(page.getByText('Enter your student ID')).toBeVisible() await expect(page.getByText('Enter your first name')).toHaveCount(0) // A failed step checks itself again as it is fixed. - await page.getByRole('textbox', { name: 'Email' }).fill('ana@example.com') + await page.getByRole('textbox', { name: 'Email' }).fill('marko@example.com') await expect(page.getByText('Enter a valid email address')).toHaveCount(0) await page.getByRole('textbox', { name: 'Phone' }).fill('') await page.getByLabel('Student ID').fill('ST-2027-01') @@ -218,11 +226,11 @@ test('keeps the user on a step until its fields are valid', async ({ await expect(currentStep(page)).toHaveText(/Guests/) await page.getByRole('button', { name: 'Add guest' }).click() const guest = page.getByRole('region', { name: 'Guest 1' }) - await guest.getByRole('textbox', { name: 'Email' }).fill('ana@example.com') + await guest.getByRole('textbox', { name: 'Email' }).fill('marko@example.com') await next(page) await expect(currentStep(page)).toHaveText(/Guests/) await expect(page.getByText("Enter the guest's name")).toBeVisible() - await guest.getByRole('textbox', { name: 'Name' }).fill('Ivo Horvat') + await guest.getByRole('textbox', { name: 'Name' }).fill('Nikola Petrović') await next(page) await expect(currentStep(page)).toHaveText(/Guests/) await expect( @@ -286,7 +294,7 @@ test('moves with Enter and with the step indicator', async ({ page }) => { await page.getByRole('button', { name: /About you/ }).click() await expect(currentStep(page)).toHaveText(/About you/) await expect(page.getByRole('textbox', { name: 'Last name' })).toHaveValue( - 'Horvat', + 'Petrović', ) // Going forward validates each step on the way, and stops at the first with errors. diff --git a/vue-event-registration/src/registration/definition.json b/vue-event-registration/src/registration/definition.json index cb9e602..cfe39c3 100644 --- a/vue-event-registration/src/registration/definition.json +++ b/vue-event-registration/src/registration/definition.json @@ -36,7 +36,7 @@ { "rule": "regex", "pattern": "^\\+?[0-9 ]{6,20}$", - "message": "Use digits and spaces, like +385 91 234 5678" + "message": "Use digits and spaces, like +381 61 234 5678" } ], "ui": { "autocomplete": "tel" } @@ -282,7 +282,7 @@ "required": { "message": "Choose a country" }, "options": [ { "value": "AT", "label": "Austria" }, - { "value": "HR", "label": "Croatia" }, + { "value": "RS", "label": "Serbia" }, { "value": "DE", "label": "Germany" }, { "value": "SI", "label": "Slovenia" } ], diff --git a/vue-event-registration/src/registration/definition.test.ts b/vue-event-registration/src/registration/definition.test.ts index a274f54..5e78a40 100644 --- a/vue-event-registration/src/registration/definition.test.ts +++ b/vue-event-registration/src/registration/definition.test.ts @@ -10,9 +10,9 @@ const schema = builder.build(definition) /** A registration that passes: a standard ticket with nothing optional. */ const valid = { - firstName: 'Ana', - lastName: 'Horvat', - email: 'ana@example.com', + firstName: 'Marko', + lastName: 'Petrović', + email: 'marko@example.com', ticketType: 'standard', arrival: '2027-05-10', departure: '2027-05-12', @@ -65,16 +65,20 @@ describe('the registration definition', () => { describe('the schema of the registration', () => { it('accepts a standard ticket, trims text and leaves out what is empty', () => { - const output = v.parse(schema, { ...valid, firstName: ' Ana ', phone: '' }) + const output = v.parse(schema, { + ...valid, + firstName: ' Marko ', + phone: '', + }) expect(output).toEqual(valid) }) it('reports the messages of the definition', () => { expect( - errorsOf({ ...valid, email: 'ana@example', phone: 'call me' }), + errorsOf({ ...valid, email: 'marko@example', phone: 'call me' }), ).toEqual({ email: ['Enter a valid email address'], - phone: ['Use digits and spaces, like +385 91 234 5678'], + phone: ['Use digits and spaces, like +381 61 234 5678'], }) }) @@ -115,7 +119,7 @@ describe('the schema of the registration', () => { }) it('checks each guest, and the size of the guest list', () => { - const guest = { name: 'Ivo Horvat', meal: 'vegan' } + const guest = { name: 'Nikola Petrović', meal: 'vegan' } expect( errorsOf({ ...valid, diff --git a/vue-event-registration/src/registration/summary.test.ts b/vue-event-registration/src/registration/summary.test.ts index 378fa02..98a86ce 100644 --- a/vue-event-registration/src/registration/summary.test.ts +++ b/vue-event-registration/src/registration/summary.test.ts @@ -12,9 +12,9 @@ function summaryOf(input: Record) { } const input = { - firstName: 'Ana', - lastName: 'Horvat', - email: 'ana@example.com', + firstName: 'Marko', + lastName: 'Petrović', + email: 'marko@example.com', ticketType: 'business', arrival: '2027-05-10', departure: '2027-05-12', @@ -22,15 +22,15 @@ const input = { workshopLevel: 'advanced', needsAssistance: false, guests: [ - { name: 'Ivo Horvat', email: 'ivo@example.com', meal: 'vegan' }, - { name: 'Mia Novak', meal: 'standard' }, + { name: 'Nikola Petrović', email: 'nikola@example.com', meal: 'vegan' }, + { name: 'Milica Nikolić', meal: 'standard' }, ], - company: { name: 'Horvat d.o.o.' }, + company: { name: 'Petrović d.o.o.' }, billingAddress: { - street: 'Ilica 1', - city: 'Zagreb', - zip: '10000', - country: 'HR', + street: 'Knez Mihailova 1', + city: 'Belgrade', + zip: '11000', + country: 'RS', }, newsletter: false, } @@ -42,9 +42,9 @@ describe('summarize', () => { id: 'you', label: 'About you', rows: [ - { label: 'First name', value: 'Ana' }, - { label: 'Last name', value: 'Horvat' }, - { label: 'Email', value: 'ana@example.com' }, + { label: 'First name', value: 'Marko' }, + { label: 'Last name', value: 'Petrović' }, + { label: 'Email', value: 'marko@example.com' }, { label: 'Ticket', value: 'Business - 490 EUR, with an invoice' }, ], }, @@ -66,19 +66,22 @@ describe('summarize', () => { id: 'guests', label: 'Guests', rows: [ - { label: 'Guest 1', value: 'Ivo Horvat, ivo@example.com, Vegan' }, - { label: 'Guest 2', value: 'Mia Novak, Standard' }, + { + label: 'Guest 1', + value: 'Nikola Petrović, nikola@example.com, Vegan', + }, + { label: 'Guest 2', value: 'Milica Nikolić, Standard' }, ], }, { id: 'invoice', label: 'Invoice', rows: [ - { label: 'Company name', value: 'Horvat d.o.o.' }, - { label: 'Street and number', value: 'Ilica 1' }, - { label: 'City', value: 'Zagreb' }, - { label: 'ZIP code', value: '10000' }, - { label: 'Country', value: 'Croatia' }, + { label: 'Company name', value: 'Petrović d.o.o.' }, + { label: 'Street and number', value: 'Knez Mihailova 1' }, + { label: 'City', value: 'Belgrade' }, + { label: 'ZIP code', value: '11000' }, + { label: 'Country', value: 'Serbia' }, ], }, { diff --git a/vue-event-registration/src/registration/types.ts b/vue-event-registration/src/registration/types.ts index 1921d4b..8b0cb68 100644 --- a/vue-event-registration/src/registration/types.ts +++ b/vue-event-registration/src/registration/types.ts @@ -25,7 +25,7 @@ export interface Registration { street?: string city?: string zip?: string - country?: 'AT' | 'HR' | 'DE' | 'SI' + country?: 'AT' | 'RS' | 'DE' | 'SI' } acceptTerms: boolean newsletter: boolean