Skip to content

Commit

Permalink
updated reporters
Browse files Browse the repository at this point in the history
  • Loading branch information
yesoreyeram committed Jan 19, 2024
1 parent f45c8dd commit 690ee20
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 11 deletions.
10 changes: 0 additions & 10 deletions e2e/query.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,21 @@ test('test type:json source:url', async ({ page, panelEditPage }) => {
const options = { page, panelEditPage };

let frames = await runQuery({}, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe(''); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].schema.meta.custom.data[0].country).toBe('USA'); // Ensure schema meta have actual data to be passed to the frontend
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ parser: 'backend' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('backend'); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].data.values[1][0]).toBe('USA'); // Ensure actual data frames being returned
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ parser: 'uql' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('uql'); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].schema.meta.custom.data[0].country).toBe('USA'); // Ensure schema meta have actual data to be passed to the frontend
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ parser: 'groq' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('groq'); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].schema.meta.custom.data[0].country).toBe('USA'); // Ensure schema meta have actual data to be passed to the frontend
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered
Expand All @@ -37,19 +33,16 @@ test('test type:csv source:url', async ({ page, panelEditPage }) => {
const options = { page, panelEditPage };

let frames = await runQuery({ type: 'csv', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.csv' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe(''); // Ensure the parser type passed correctly
expect((frames.results['A'].frames[0].schema.meta.custom.data || '').startsWith('name,age,country,occupation,salary')).toBeTruthy(); // Ensure schema meta have actual data to be passed to the frontend
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ type: 'csv', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.csv', parser: 'backend' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('backend'); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].data.values[1][0]).toBe('USA'); // Ensure actual data frames being returned
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ type: 'csv', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.csv', parser: 'uql' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('uql'); // Ensure the parser type passed correctly
expect((frames.results['A'].frames[0].schema.meta.custom.data || '').startsWith('name,age,country,occupation,salary')).toBeTruthy(); // Ensure schema meta have actual data to be passed to the frontend
await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered
Expand All @@ -61,19 +54,16 @@ test('test type:xml source:url', async ({ page, panelEditPage }) => {
const options = { page, panelEditPage };

let frames = await runQuery({ type: 'xml', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.xml' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe(''); // Ensure the parser type passed correctly
expect((frames.results['A'].frames[0].schema.meta.custom.data || '').includes('<name>Leanne Graham</name')).toBeTruthy(); // Ensure schema meta have actual data to be passed to the frontend
// await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ type: 'xml', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.xml', parser: 'backend' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('backend'); // Ensure the parser type passed correctly
expect(frames.results['A'].frames[0].data.values[0][0].includes('Leanne Graham')).toBeTruthy(); // Ensure actual data frames being returned
// await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered

frames = await runQuery({ type: 'xml', url: 'https://github.com/grafana/grafana-infinity-datasource/blob/main/testdata/users.xml', parser: 'uql' }, options);
expect(frames.results['A'].frames[0].schema.name).toBe('A');
expect(frames.results['A'].frames[0].schema.meta.custom.query.parser).toBe('uql'); // Ensure the parser type passed correctly
expect((frames.results['A'].frames[0].schema.meta.custom.data || '').includes('<name>Leanne Graham</name')).toBeTruthy(); // Ensure schema meta have actual data to be passed to the frontend
// await expect(page.getByText('Patricia Lebsack')).toBeVisible(); // Ensure actual data rendered
Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ export default defineConfig({
forbidOnly: !!process.env.CI, // eslint-disable-line no-undef
retries: process.env.CI ? 2 : 0, // eslint-disable-line no-undef
workers: process.env.CI ? 1 : undefined, // eslint-disable-line no-undef
reporter: 'html',
reporter: process.env.CI ? [['github'], ['list'], ['html', { open: 'never' }]] : [['list'], ['html', { open: 'never' }]], // eslint-disable-line no-undef
use: {
baseURL: 'http://localhost:3000',
trace: 'on-first-retry',
Expand Down

0 comments on commit 690ee20

Please sign in to comment.