Skip to content

Commit

Permalink
less flaky tests for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
bohandley committed Mar 8, 2024
1 parent ec5bc4e commit ece4d73
Showing 1 changed file with 44 additions and 2 deletions.
46 changes: 44 additions & 2 deletions e2e/query-editor.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,15 @@ test.describe('Prometheus query editor', () => {
await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.queryField)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.queryField).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton).focus();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton)
.click()
Expand Down Expand Up @@ -128,6 +137,15 @@ test.describe('Prometheus query editor', () => {
await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.queryField)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.queryField).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton).focus();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.code.metricsBrowser.openButton)
.click()
Expand All @@ -148,14 +166,17 @@ test.describe('Prometheus query editor', () => {
});

test.describe('Query builder', () => {
test('it navigates to the code editor with default editor type as builder', async ({
test('it navigates to the query builder with default editor type as builder', async ({
readProvisionedDataSource,
explorePage
}) => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

explorePage.datasource.set(dsDefaultEditorBuilder.name);

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

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect)).toBeVisible();
});
Expand All @@ -168,15 +189,27 @@ test.describe('Prometheus query editor', () => {

explorePage.datasource.set(dsDefaultEditorBuilder.name);

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

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.matchOperatorSelect).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.matchOperatorSelect)).toBeVisible();

await explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.valueSelect).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.valueSelect)).toBeVisible();
});
Expand All @@ -190,6 +223,9 @@ test.describe('Prometheus query editor', () => {

explorePage.datasource.set(dsDefaultEditorBuilder.name);

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

await explorePage.getByTestIdOrAriaLabel(selectors.components.DataSource.Prometheus.queryEditor.builder.metricSelect).click()

await page.getByText(metric, { exact: true }).click();
Expand All @@ -207,7 +243,13 @@ test.describe('Prometheus query editor', () => {
const dsDefaultEditorBuilder = await readProvisionedDataSource<DataSourcePluginOptionsEditorProps<PromOptions>>({ fileName: 'datasources.yml' });

explorePage.datasource.set(dsDefaultEditorBuilder.name);


await explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect).focus();

await expect(explorePage
.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect)).toBeVisible();

await explorePage.getByTestIdOrAriaLabel(selectors.components.QueryBuilder.labelSelect).click()

await page.getByText('__name__', { exact: true }).click();
Expand Down

0 comments on commit ece4d73

Please sign in to comment.