Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions codeceptjs-e2e/tests/configuration/pages/pmmSettingsPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ const assert = require('assert');
const { communicationData, emailDefaults } = require('../../pages/testData');

const {
I, adminPage, links, codeceptjsConfig, settingsAPI,
I, adminPage, links, codeceptjsConfig, settingsAPI, serverApi,
} = inject();

const locateLabel = (selector) => locate(I.useDataQA(selector)).find('span');
Expand Down Expand Up @@ -660,7 +660,7 @@ module.exports = {
// setting tooltip for telemetry in accordance with API call
this.tooltips.advancedSettings.telemetry.dialogText = `${'We gather and send the following information to Percona:'}${(await settingsAPI.getSettings('telemetry_summaries')).join('').replace(/\s{2,}/g, ' ')}`;

return [
const subPages = [
{
subPage: this.metricsResolutionUrl,
tooltips: this.tooltips.metricsResolution,
Expand All @@ -673,10 +673,16 @@ module.exports = {
stt: this.tooltips.advancedSettings.stt,
},
},
{
];

// The SSH Key tab is rendered only on AMI; elsewhere /settings/ssh-key redirects to /settings.
if (await serverApi.getDistributionMethod() === 'DISTRIBUTION_METHOD_AMI') {
subPages.push({
subPage: this.sshKeyUrl,
tooltips: this.tooltips.ssh,
},
];
});
}

return subPages;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,11 @@ Scenario('PMM-T84 - Verify Section Tabs and Metrics Section Elements [critical]
I.seeElement(pmmSettingsPage.fields.highInput);
});

Scenario('PMM-T85 - Verify SSH Key Section Elements @settings @grafana-pr', async ({ I, pmmSettingsPage }) => {
Scenario('PMM-T85 - Verify SSH Key Section Elements @settings @grafana-pr', async ({ I, pmmSettingsPage, serverApi }) => {
if (await serverApi.getDistributionMethod() !== 'DISTRIBUTION_METHOD_AMI') {
return;
}

I.amOnPage(pmmSettingsPage.sshKeyUrl);
await pmmSettingsPage.waitForPmmSettingsPageLoaded();
I.see('SSH key', pmmSettingsPage.fields.sshKeyLabel);
Expand Down
17 changes: 17 additions & 0 deletions codeceptjs-e2e/tests/pages/api/serverApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,21 @@ module.exports = {
patch: parseInt(versionPatch, 10),
};
},

/**
* Obtains the distribution method PMM Server was deployed with (docker, ami, ovf, ...)
*
* @return {Promise<string>}
*/
async getDistributionMethod() {
const resp = await I.sendGetRequest('v1/server/version', { Authorization: `Basic ${await I.getAuth()}` });

I.assertEqual(
resp.status,
200,
`Request should be OK: "${resp.status} ${resp.statusText}" ${resp.data.error ? resp.data : ''}`,
);

return resp.data.distribution_method;
},
};
4 changes: 2 additions & 2 deletions e2e_tests/tests/dashboards/mysql/mysqlDashboards.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ pmmTest(
'PMM-T324 - Verify MySQL - MySQL User Details dashboard @pmm-ps-integration',
async ({ api, dashboard, page, urlHelper }) => {
const { service_name } = await api.inventoryApi.getServiceDetailsByRegexAndParameters(
'ps_pmm_replication_.*_1',
'^ps_pmm_replication_.*_1(_\\d+)?$',
{ replication_set: 'ps-async-replication' },
);

Expand Down Expand Up @@ -144,7 +144,7 @@ pmmTest(
pmmTest(
'PMM-T2029 - Verify dashboard for MySQL Replication Summary @pmm-ps-integration',
async ({ api, dashboard, page, urlHelper }) => {
const service = await api.inventoryApi.getServiceDetailsByRegexAndParameters('ps_pmm_replication_.*_2', {
const service = await api.inventoryApi.getServiceDetailsByRegexAndParameters('^ps_pmm_replication_.*_2(_\\d+)?$', {
replication_set: 'ps-async-replication',
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ pmmTest.beforeEach(async ({ grafanaHelper }) => {
await grafanaHelper.authorize();
});

// Anchored so it cannot also match the source node — see mysqlDashboards.test.ts.
const replicaServiceRegex = '^ps_pmm_replication_.*_2(_\\d+)?$';

pmmTest(
'PMM-T2030 - Verify QAN for PS Replica Instance @nightly @pmm-ps-integration',
async ({ api, page, qanStoredMetrics, urlHelper }) => {
const { service_name } = await api.inventoryApi.getServiceDetailsByRegex('ps_pmm_replication_.*_2');
const { service_name } = await api.inventoryApi.getServiceDetailsByRegex('^ps_pmm_replication_.*_2(_\\d+)?$');

await page.goto(
urlHelper.buildUrlWithParameters(qanStoredMetrics.url, {
Expand Down
Loading