Add Connectivity Issue Page and Improve Table Semantics
- Introduced `ConnectivityIssue.vue` for handling and displaying connectivity problems. - Added new route for the connectivity issue error page. - Enhanced accessibility by wrapping table headers in `OrderBookingsTable.vue` with `<thead>` and `<tbody>` tags. - Included connectivity-related internationalization keys across various locale files. - Updated components to integrate `ConnectivityIssue` as a fallback display for connection errors.
This commit is contained in:
@@ -0,0 +1,201 @@
|
||||
/**
|
||||
* Test to verify i18n translations for MyBookingsBook component
|
||||
* are properly defined in both English and Danish locale files.
|
||||
*/
|
||||
|
||||
describe('i18n Bookings Translations', () => {
|
||||
const bookingKeys = [
|
||||
'guest_mode_warning',
|
||||
'guest_mode_login_prompt',
|
||||
'login',
|
||||
'select_wash_hall',
|
||||
'select_vehicle',
|
||||
'is_this_your_vehicle',
|
||||
'next_step_addons',
|
||||
'product_selection_unavailable',
|
||||
'login_for_products',
|
||||
'interior_wash',
|
||||
'exterior_wash',
|
||||
'no_items_in_basket',
|
||||
'total',
|
||||
'required',
|
||||
'expected_date_time',
|
||||
'reference',
|
||||
'po_number',
|
||||
'note',
|
||||
'customer_number',
|
||||
'enter_customer_number',
|
||||
'customer_not_found',
|
||||
'pickup',
|
||||
'incl_pickup',
|
||||
'basket',
|
||||
'step_x_of_y',
|
||||
'select_a_wash_hall',
|
||||
'enter_vehicle',
|
||||
'select_products',
|
||||
'select_date_time_customer',
|
||||
'back',
|
||||
'next',
|
||||
'go_to_confirmation',
|
||||
'missing_wash_hall',
|
||||
'missing_customer_number',
|
||||
'missing_valid_customer_number',
|
||||
'missing_vehicle',
|
||||
'missing_date',
|
||||
'missing_products',
|
||||
'error_copied',
|
||||
'guest_info_html',
|
||||
'confirm_booking'
|
||||
];
|
||||
|
||||
const commonKeys = [
|
||||
'select',
|
||||
'during_the_day',
|
||||
'approx',
|
||||
'thank_you',
|
||||
'booking_created',
|
||||
'unknown_error',
|
||||
'error_creating_booking',
|
||||
'try_again',
|
||||
'copy_error',
|
||||
'cancel',
|
||||
'close',
|
||||
'confirm'
|
||||
];
|
||||
|
||||
it('should have all booking translations defined in English', async () => {
|
||||
await browser.url('/');
|
||||
|
||||
const result = await browser.executeAsync(async (keys, done) => {
|
||||
try {
|
||||
const response = await fetch('/src/i18n/locales/en.json');
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.user_dashboard || !data.user_dashboard.bookings || !data.user_dashboard.bookings.book) {
|
||||
done({ success: false, error: 'user_dashboard.bookings.book namespace not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const missingKeys = [];
|
||||
for (const key of keys) {
|
||||
if (!data.user_dashboard.bookings.book[key]) {
|
||||
missingKeys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingKeys.length > 0) {
|
||||
done({ success: false, error: 'Missing keys: ' + missingKeys.join(', ') });
|
||||
} else {
|
||||
done({ success: true, keyCount: Object.keys(data.user_dashboard.bookings.book).length });
|
||||
}
|
||||
} catch (e) {
|
||||
done({ success: false, error: e.message });
|
||||
}
|
||||
}, bookingKeys);
|
||||
|
||||
console.log('English booking result:', JSON.stringify(result));
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should have all booking translations defined in Danish', async () => {
|
||||
await browser.url('/');
|
||||
|
||||
const result = await browser.executeAsync(async (keys, done) => {
|
||||
try {
|
||||
const response = await fetch('/src/i18n/locales/da.json');
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.user_dashboard || !data.user_dashboard.bookings || !data.user_dashboard.bookings.book) {
|
||||
done({ success: false, error: 'user_dashboard.bookings.book namespace not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const missingKeys = [];
|
||||
for (const key of keys) {
|
||||
if (!data.user_dashboard.bookings.book[key]) {
|
||||
missingKeys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingKeys.length > 0) {
|
||||
done({ success: false, error: 'Missing keys: ' + missingKeys.join(', ') });
|
||||
} else {
|
||||
done({ success: true, keyCount: Object.keys(data.user_dashboard.bookings.book).length });
|
||||
}
|
||||
} catch (e) {
|
||||
done({ success: false, error: e.message });
|
||||
}
|
||||
}, bookingKeys);
|
||||
|
||||
console.log('Danish booking result:', JSON.stringify(result));
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should have all common translations defined in English', async () => {
|
||||
await browser.url('/');
|
||||
|
||||
const result = await browser.executeAsync(async (keys, done) => {
|
||||
try {
|
||||
const response = await fetch('/src/i18n/locales/en.json');
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.common) {
|
||||
done({ success: false, error: 'common namespace not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const missingKeys = [];
|
||||
for (const key of keys) {
|
||||
if (!data.common[key]) {
|
||||
missingKeys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingKeys.length > 0) {
|
||||
done({ success: false, error: 'Missing keys: ' + missingKeys.join(', ') });
|
||||
} else {
|
||||
done({ success: true, keyCount: Object.keys(data.common).length });
|
||||
}
|
||||
} catch (e) {
|
||||
done({ success: false, error: e.message });
|
||||
}
|
||||
}, commonKeys);
|
||||
|
||||
console.log('English common result:', JSON.stringify(result));
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
|
||||
it('should have all common translations defined in Danish', async () => {
|
||||
await browser.url('/');
|
||||
|
||||
const result = await browser.executeAsync(async (keys, done) => {
|
||||
try {
|
||||
const response = await fetch('/src/i18n/locales/da.json');
|
||||
const data = await response.json();
|
||||
|
||||
if (!data.common) {
|
||||
done({ success: false, error: 'common namespace not found' });
|
||||
return;
|
||||
}
|
||||
|
||||
const missingKeys = [];
|
||||
for (const key of keys) {
|
||||
if (!data.common[key]) {
|
||||
missingKeys.push(key);
|
||||
}
|
||||
}
|
||||
|
||||
if (missingKeys.length > 0) {
|
||||
done({ success: false, error: 'Missing keys: ' + missingKeys.join(', ') });
|
||||
} else {
|
||||
done({ success: true, keyCount: Object.keys(data.common).length });
|
||||
}
|
||||
} catch (e) {
|
||||
done({ success: false, error: e.message });
|
||||
}
|
||||
}, commonKeys);
|
||||
|
||||
console.log('Danish common result:', JSON.stringify(result));
|
||||
expect(result.success).toBe(true);
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user