Files
nebula.js/test/component/object/sn.test.cjs
Tobias Åström c5be00c77d feat: migrate all commands to esm (#1932)
* feat: migrate all commands to esm

* chore: fix server build

* chore: fix serve

* chore: adjust serve

* chore: adjust serve

* chore: serve esm only

* chore: serve esm only
2026-03-13 08:47:13 +01:00

48 lines
1.5 KiB
JavaScript

const { test, expect } = require('@playwright/test');
const snSelector = '.njs-viz';
const errorSelector = '.njs-cell [data-tid="error-title"]';
test.describe('sn', () => {
let s;
let serve;
test.beforeAll(async () => {
({ default: serve } = await import('@nebula.js/cli-serve'));
s = await serve({
open: false,
config: 'nebula.config.cjs',
build: false,
fixturePath: 'test/component/object',
});
});
test.afterAll(async () => {
await s.close();
});
test('should render with translation', async ({ page }) => {
const url = s.url + '/render?fixture=sn-locale.fix.js&language=sv-SE';
await page.goto(url);
await page.waitForSelector(snSelector, { state: 'visible' });
const text = await page.textContent(snSelector);
expect(text).toContain('Hej motor!');
});
test('should show incomplete visualization', async ({ page }) => {
const url = s.url + '/render?fixture=sn-incomplete.fix.js&theme=dark';
await page.goto(url);
await page.waitForSelector(errorSelector, { state: 'visible' });
const text = await page.textContent(errorSelector);
expect(text).toContain('Incomplete visualization');
});
test('should show error caused during load', async ({ page }) => {
const url = s.url + '/render?fixture=sn-error.fix.js';
await page.goto(url);
await page.waitForSelector(errorSelector, { state: 'visible' });
const text = await page.textContent(errorSelector);
expect(text).toContain('hahaha');
});
});