test: centralize demo IDs and site_domain mock in env.ts
- Added testing_site_id, testing_site_domain_id, testing_fqdn, testing_person_id - Created mock_site_domain object matching +layout.ts expectations - Updated minimal_v3_mocks.ts to use mock_site_domain - Fixes 'Domain Not Registered' overlay in Playwright tests - All test IDs now documented with comments from tests/README.md
This commit is contained in:
@@ -4,14 +4,46 @@
|
||||
*/
|
||||
export const test_base_url = 'http://demo.localhost:5173';
|
||||
export const dev_api_base = 'https://dev-api.oneskyit.com';
|
||||
export const testing_account_id = '_XY7DXtc9MY';
|
||||
export const testing_event_id = 'pjrcghqwert';
|
||||
|
||||
// Core test/demo IDs (from tests/README.md)
|
||||
export const testing_account_id = '_XY7DXtc9MY'; // (1) "One Sky IT Demo"
|
||||
export const testing_site_id = '92vkYC4fVEl'; // (12) "One Sky IT Demo"
|
||||
export const testing_site_domain_id = '_6jcTbnJk-o'; // (12) "demo.localhost:5173"
|
||||
export const testing_fqdn = 'demo.localhost:5173';
|
||||
|
||||
// Events test/demo IDs
|
||||
export const testing_event_id = 'pjrcghqwert'; // (1) "Demo One Sky IT Conference"
|
||||
export const testing_person_id = 'QWODAPCNLQU'; // (49) "Osiris Idem"
|
||||
|
||||
/**
|
||||
* Mock site_domain object for Playwright tests.
|
||||
* Matches the structure expected by +layout.ts lookup_site_domain_v3()
|
||||
*/
|
||||
export const mock_site_domain = {
|
||||
id: testing_site_domain_id,
|
||||
site_id: testing_site_id,
|
||||
site_domain_id: testing_site_domain_id,
|
||||
account_id: testing_account_id,
|
||||
account_id_random: testing_account_id,
|
||||
account_code: 'OSIT_DEMO',
|
||||
account_name: 'One Sky IT Demo',
|
||||
fqdn: testing_fqdn,
|
||||
enable: '1',
|
||||
cfg_json: {},
|
||||
style_href: '',
|
||||
header_image_path: ''
|
||||
};
|
||||
|
||||
export const TEST_ENV = {
|
||||
test_base_url,
|
||||
dev_api_base,
|
||||
testing_account_id,
|
||||
testing_event_id
|
||||
testing_site_id,
|
||||
testing_site_domain_id,
|
||||
testing_fqdn,
|
||||
testing_event_id,
|
||||
testing_person_id,
|
||||
mock_site_domain
|
||||
};
|
||||
|
||||
export default TEST_ENV;
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Page } from '@playwright/test';
|
||||
import { mock_site_domain } from './env';
|
||||
|
||||
export const minimal_event = (event_id: string) => ({
|
||||
data: {
|
||||
@@ -36,7 +37,11 @@ export async function attach_minimal_v3_routes(page: Page, event_id: string) {
|
||||
const method = req.method();
|
||||
|
||||
if (url.includes('site_domain/search')) {
|
||||
return route.fulfill({ status: 200, contentType: 'application/json', body: JSON.stringify({ data: [{ id: 'td', site_id: 'ts' }] }) });
|
||||
return route.fulfill({
|
||||
status: 200,
|
||||
contentType: 'application/json',
|
||||
body: JSON.stringify({ data: [mock_site_domain] })
|
||||
});
|
||||
}
|
||||
|
||||
if (url.includes(`/v3/crud/event/${event_id}`) && method === 'GET') {
|
||||
|
||||
Reference in New Issue
Block a user