diff --git a/e2e/configuration.spec.ts b/e2e/configuration.spec.ts index 8bef06ff..fb676c4b 100644 --- a/e2e/configuration.spec.ts +++ b/e2e/configuration.spec.ts @@ -6,7 +6,6 @@ import { PromOptions } from '@grafana/prometheus'; const DATA_SOURCE_NAME = 'prometheus-config'; test.describe('Configuration tests', () => { - test(`should have the following components: connection settings managed alerts @@ -20,34 +19,34 @@ test.describe('Configuration tests', () => { disable recording rules custom query parameters http method - `, async ({ - createDataSourceConfigPage, - readProvisionedDataSource, - page, - }) => { - const ds = await readProvisionedDataSource>({ fileName: 'datasources.yml' }); + `, async ({ createDataSourceConfigPage, readProvisionedDataSource, page }) => { + const ds = await readProvisionedDataSource>({ + fileName: 'datasources.yml', + }); const configPage = await createDataSourceConfigPage({ type: ds.type }); // connection settings - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.connectionSettings)).toBeVisible(); - - // managed alerts await expect( - page.locator(`#${selectors.components.DataSource.Prometheus.configPage.manageAlerts}`) + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.connectionSettings) ).toBeVisible(); + // managed alerts + await expect(page.locator(`#${selectors.components.DataSource.Prometheus.configPage.manageAlerts}`)).toBeVisible(); + // scrape interval - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.scrapeInterval)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.scrapeInterval) + ).toBeVisible(); // query timeout - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.queryTimeout)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.queryTimeout) + ).toBeVisible(); // default editor - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.defaultEditor)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.defaultEditor) + ).toBeVisible(); // disable metric lookup await expect( @@ -55,29 +54,37 @@ test.describe('Configuration tests', () => { ).toBeVisible(); // prometheus type - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.prometheusType)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.prometheusType) + ).toBeVisible(); // cache level - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.cacheLevel)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.cacheLevel) + ).toBeVisible(); // incremental querying - await expect(page.locator(`#${selectors.components.DataSource.Prometheus.configPage.incrementalQuerying}`)).toBeVisible(); + await expect( + page.locator(`#${selectors.components.DataSource.Prometheus.configPage.incrementalQuerying}`) + ).toBeVisible(); // disable recording rules - await expect(page.locator(`#${selectors.components.DataSource.Prometheus.configPage.disableRecordingRules}`)).toBeVisible(); + await expect( + page.locator(`#${selectors.components.DataSource.Prometheus.configPage.disableRecordingRules}`) + ).toBeVisible(); // custom query parameters - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.customQueryParameters)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.customQueryParameters) + ).toBeVisible(); // http method - await expect(configPage - .getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.httpMethod)).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.httpMethod) + ).toBeVisible(); }); -/* test('"Save & test" should be successful when configuration is valid', async ({ + /* test('"Save & test" should be successful when configuration is valid', async ({ createDataSourceConfigPage, readProvisionedDataSource, }) => { @@ -96,27 +103,27 @@ test.describe('Configuration tests', () => { createDataSourceConfigPage, readProvisionedDataSource, }) => { - const ds = await readProvisionedDataSource>({ fileName: 'datasources.yml' }); + const ds = await readProvisionedDataSource>({ + fileName: 'datasources.yml', + }); const configPage = await createDataSourceConfigPage({ type: ds.type }); await expect(configPage.saveAndTest()).not.toBeOK(); await expect(configPage).toHaveAlert('error', { hasText: 'empty url' }); }); - test('it should allow a user to add the version when the Prom type is selected', - async ({ + test('it should allow a user to add the version when the Prom type is selected', async ({ createDataSourceConfigPage, // readProvisionedDataSource, page, }) => { const configPage = await createDataSourceConfigPage({ - type: "grafana-amazonprometheus-datasource", + type: 'grafana-amazonprometheus-datasource', name: DATA_SOURCE_NAME, }); - await expect(configPage - .getByGrafanaSelector( - selectors.components.DataSource.Prometheus.configPage.prometheusType - )).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.prometheusType) + ).toBeVisible(); // open the select dropdown await page.getByLabel('Prometheus type').click(); @@ -125,27 +132,28 @@ test.describe('Configuration tests', () => { await page.getByText('Cortex').click(); // expect the version component to be displayed - await expect(configPage - .getByGrafanaSelector( - selectors.components.DataSource.Prometheus.configPage.prometheusVersion - )).toBeVisible(); + await expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.prometheusVersion) + ).toBeVisible(); }); - test('it should allow a user to select a query overlap window when incremental querying is selected', - async ({ + test('it should allow a user to select a query overlap window when incremental querying is selected', async ({ createDataSourceConfigPage, page, }) => { const configPage = await createDataSourceConfigPage({ - type: "grafana-amazonprometheus-datasource", - name: DATA_SOURCE_NAME + "check", + type: 'grafana-amazonprometheus-datasource', + name: DATA_SOURCE_NAME + 'check', }); - await page.getByLabel('Toggle switch').nth(3).setChecked(true); + await page + .locator(`#${selectors.components.DataSource.Prometheus.configPage.incrementalQuerying}`) + .setChecked(true, { force: true }); - expect(configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.queryOverlapWindow)).toBeVisible(); + expect( + configPage.getByGrafanaSelector(selectors.components.DataSource.Prometheus.configPage.queryOverlapWindow) + ).toBeVisible(); }); -// exemplars tested in exemplar.spec + // exemplars tested in exemplar.spec }); - diff --git a/package.json b/package.json index dcedabde..cac8c802 100644 --- a/package.json +++ b/package.json @@ -24,7 +24,7 @@ "@emotion/eslint-plugin": "11.12.0", "@grafana/e2e-selectors": "11.2.2", "@grafana/eslint-config": "7.0.0", - "@grafana/plugin-e2e": "1.8.3", + "@grafana/plugin-e2e": "^1.12.1", "@grafana/tsconfig": "2.0.0", "@playwright/test": "1.48.0", "@swc/core": "1.7.35", @@ -75,7 +75,6 @@ "webpack-cli": "5.1.4", "webpack-livereload-plugin": "3.0.2" }, - "dependencies": { "@emotion/css": "11.13.4", "@grafana/aws-sdk": "0.5.0", diff --git a/yarn.lock b/yarn.lock index fee71f5b..baea9e3e 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1018,6 +1018,16 @@ tslib "2.6.3" typescript "5.4.5" +"@grafana/e2e-selectors@^11.4.0-207766": + version "11.4.0-208401" + resolved "https://registry.yarnpkg.com/@grafana/e2e-selectors/-/e2e-selectors-11.4.0-208401.tgz#4ed77cbfa12d3f48095273cf44616c411fafa11c" + integrity sha512-pKVKFis9M6I+Y2NxubvU2zbWZWdKMKL/fUwXL+uUiAVo7uZw7BnchUvW6Z2Ip/x9UjeSVq6vdmiOuNrWUVi1cA== + dependencies: + "@grafana/tsconfig" "^2.0.0" + semver "7.6.3" + tslib "2.7.0" + typescript "5.5.4" + "@grafana/eslint-config@7.0.0": version "7.0.0" resolved "https://registry.yarnpkg.com/@grafana/eslint-config/-/eslint-config-7.0.0.tgz#9f8474a7d1c63e0510d7076ecbb644850693cb0b" @@ -1100,13 +1110,14 @@ ua-parser-js "^1.0.32" web-vitals "^4.0.1" -"@grafana/plugin-e2e@1.8.3": - version "1.8.3" - resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.8.3.tgz#fb6fdd8d3e8ca21438a0502cc75476313bd5ba20" - integrity sha512-mPZXmMEP1gVAzD0ZYxMKQu40NRU7gHI9Eol/iKkHOBNT2NGsfmBRxDsBDuYKerizeYAtpA/pcEMJxYXez5/5Cg== +"@grafana/plugin-e2e@^1.12.1": + version "1.12.1" + resolved "https://registry.yarnpkg.com/@grafana/plugin-e2e/-/plugin-e2e-1.12.1.tgz#4440b9c2358c7ffcb83b0d32d503cbc13c8ce35f" + integrity sha512-pxmtBn/zFGoyNwfHgwSYEqfH1vTp4r6GnMl0cl3tsQJXO8S58QCD0PFG5Op/OcHhsoglIQTWFVkGvUqu8c5q0A== dependencies: + "@grafana/e2e-selectors" "^11.4.0-207766" semver "^7.5.4" - uuid "^10.0.0" + uuid "^11.0.2" yaml "^2.3.4" "@grafana/prometheus@11.2.2": @@ -1174,7 +1185,7 @@ dependencies: tslib "2.6.3" -"@grafana/tsconfig@2.0.0": +"@grafana/tsconfig@2.0.0", "@grafana/tsconfig@^2.0.0": version "2.0.0" resolved "https://registry.yarnpkg.com/@grafana/tsconfig/-/tsconfig-2.0.0.tgz#277aba907ddbe0301dc37248923e6bd2b68f5151" integrity sha512-cxC3Htv/GidI5FeVGAzj/lYZTMMz/Cfsc8VOQFO3Ichjx3hUjyjeoBUIpVSVMnIjKUdA5ycdxtMYPHIuIrk8+A== @@ -9098,16 +9109,16 @@ tslib@2.6.3: resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.6.3.tgz#0438f810ad7a9edcde7a241c3d80db693c8cbfe0" integrity sha512-xNvxJEOUiWPGhUuUdQgAJPKOOJfGnIyKySOc09XkKsgdUV/3E2zvwZYdejjmRgPCgcym1juLH3226yA7sEFJKQ== +tslib@2.7.0, tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.6.2, tslib@^2.7.0: + version "2.7.0" + resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" + integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== + tslib@^1.8.1: version "1.14.1" resolved "https://registry.yarnpkg.com/tslib/-/tslib-1.14.1.tgz#cf2d38bdc34a134bcaf1091c41f6619e2f672d00" integrity sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg== -tslib@^2.1.0, tslib@^2.3.1, tslib@^2.4.0, tslib@^2.4.1, tslib@^2.6.2, tslib@^2.7.0: - version "2.7.0" - resolved "https://registry.yarnpkg.com/tslib/-/tslib-2.7.0.tgz#d9b40c5c40ab59e8738f297df3087bf1a2690c01" - integrity sha512-gLXCKdN1/j47AiHiOkJN69hJmcbGTHI0ImLmbYLHykhgeN0jVGola9yVjFgzCUklsZQMW55o+dW7IXv3RCXDzA== - tsutils@^3.21.0: version "3.21.0" resolved "https://registry.yarnpkg.com/tsutils/-/tsutils-3.21.0.tgz#b48717d394cea6c1e096983eed58e9d61715b623" @@ -9196,6 +9207,11 @@ typescript@5.4.5: resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.4.5.tgz#42ccef2c571fdbd0f6718b1d1f5e6e5ef006f611" integrity sha512-vcI4UpRgg81oIRUFwR0WSIHKt11nJ7SAVlYNIu+QpqeyXP+gpQJy/Z4+F0aGxSE4MqwjyXvW/TzgkLAx2AGHwQ== +typescript@5.5.4: + version "5.5.4" + resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.5.4.tgz#d9852d6c82bad2d2eda4fd74a5762a8f5909e9ba" + integrity sha512-Mtq29sKDAEYP7aljRgtPOpTvOfbwRWlS6dPRzwjdE+C0R4brX/GUyhHSecbHMFLNBLcJIPt9nl9yG5TZ1weH+Q== + typescript@5.6.3: version "5.6.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-5.6.3.tgz#5f3449e31c9d94febb17de03cc081dd56d81db5b" @@ -9289,10 +9305,10 @@ uuid@9.0.1: resolved "https://registry.yarnpkg.com/uuid/-/uuid-9.0.1.tgz#e188d4c8853cc722220392c424cd637f32293f30" integrity sha512-b+1eJOlsR9K8HJpow9Ok3fiWOWSIcIzXodvv0rQjVoOVNpWMpxf1wZNpt4y9h10odCNrqnYp1OBzRktckBe3sA== -uuid@^10.0.0: - version "10.0.0" - resolved "https://registry.yarnpkg.com/uuid/-/uuid-10.0.0.tgz#5a95aa454e6e002725c79055fd42aaba30ca6294" - integrity sha512-8XkAphELsDnEGrDxUOHB3RGvXz6TeuYSGEZBOjtTtPm2lwhGBjLgOzLHB63IUWfBpNucQjND6d3AOudO+H3RWQ== +uuid@^11.0.2: + version "11.0.3" + resolved "https://registry.yarnpkg.com/uuid/-/uuid-11.0.3.tgz#248451cac9d1a4a4128033e765d137e2b2c49a3d" + integrity sha512-d0z310fCWv5dJwnX1Y/MncBAqGMKEzlBb1AOf7z9K8ALnd0utBX/msg/fA0+sbyN1ihbMsLhrBlnl1ak7Wa0rg== uuid@^8.3.2: version "8.3.2"