Skip to content

Commit

Permalink
explicitly change the data source picker
Browse files Browse the repository at this point in the history
  • Loading branch information
bohandley committed Mar 11, 2024
1 parent 2acd402 commit 356176b
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 13 deletions.
54 changes: 43 additions & 11 deletions e2e/query-editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,20 @@ test.describe('Prometheus query editor', () => {
test.describe('Query builder', () => {
test('it navigates to the query builder with default editor type as builder', async ({
readProvisionedDataSource,
explorePage
explorePage,
page,
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

await explorePage.goto();

await explorePage.datasource.set(dsDefaultEditorBuilder.name);
// await explorePage.datasource.set(dsDefaultEditorBuilder.name);

await page.getByTestId('data-testid Select a data source').click();

await page.getByTestId('data-testid Select a data source').fill('Prometheus-amazon');

await page.getByRole('button', { name: 'Prometheus-amazon Prometheus' }).click();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect).isVisible(TIMEOUT);
Expand All @@ -211,13 +218,20 @@ test.describe('Prometheus query editor', () => {

test('the query builder contains metric select, label filters and operations', async ({
readProvisionedDataSource,
explorePage
explorePage,
page,
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

await explorePage.goto();

await explorePage.datasource.set(dsDefaultEditorBuilder.name);
// await explorePage.datasource.set(dsDefaultEditorBuilder.name);

await page.getByTestId('data-testid Select a data source').click();

await page.getByTestId('data-testid Select a data source').fill('Prometheus-amazon');

await page.getByRole('button', { name: 'Prometheus-amazon Prometheus' }).click();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect).isEnabled(TIMEOUT);
Expand Down Expand Up @@ -250,14 +264,20 @@ test.describe('Prometheus query editor', () => {
test('it can select a metric and provide a hint', async ({
readProvisionedDataSource,
explorePage,
page
page,
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

await explorePage.goto();

await explorePage.datasource.set(dsDefaultEditorBuilder.name);

// await explorePage.datasource.set(dsDefaultEditorBuilder.name);

await page.getByTestId('data-testid Select a data source').click();

await page.getByTestId('data-testid Select a data source').fill('Prometheus-amazon');

await page.getByRole('button', { name: 'Prometheus-amazon Prometheus' }).click();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect).isVisible(TIMEOUT);

Expand All @@ -279,13 +299,19 @@ test.describe('Prometheus query editor', () => {
test('it can select a label filter and run a query', async ({
readProvisionedDataSource,
explorePage,
page
page,
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

await explorePage.goto();

await explorePage.datasource.set(dsDefaultEditorBuilder.name);
// await explorePage.datasource.set(dsDefaultEditorBuilder.name);

await page.getByTestId('data-testid Select a data source').click();

await page.getByTestId('data-testid Select a data source').fill('Prometheus-amazon');

await page.getByRole('button', { name: 'Prometheus-amazon Prometheus' }).click();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect).isVisible(TIMEOUT);
Expand All @@ -310,13 +336,19 @@ test.describe('Prometheus query editor', () => {
test('it should have the metrics explorer opened via the metric select', async ({
readProvisionedDataSource,
explorePage,
page
page,
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

await explorePage.goto();

await explorePage.datasource.set(dsDefaultEditorBuilder.name);
// await explorePage.datasource.set(dsDefaultEditorBuilder.name);

await page.getByTestId('data-testid Select a data source').click();

await page.getByTestId('data-testid Select a data source').fill('Prometheus-amazon');

await page.getByRole('button', { name: 'Prometheus-amazon Prometheus' }).click();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect).isVisible(TIMEOUT);
Expand Down
4 changes: 2 additions & 2 deletions provisioning/datasources/code-editor.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
apiVersion: 1

datasources:
- name: Prometheus-amazon-code
uid: prometheus-amazon-code-editor
- name: a-prometheus-code-editor
uid: a-prometheus-code-editor
type: prometheus-amazon-datasource
url: http://prometheus:9090
access: proxy
Expand Down

0 comments on commit 356176b

Please sign in to comment.