Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests for editing services for mysql, pgsql, proxysql and mongo, rds, azzure #680

Merged
merged 26 commits into from
Oct 13, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
151af4e
Initial tests for mysql, pgsql, proxysql and mongo
saikumar-vs Sep 4, 2023
a1ed048
Added Mising Class Name
saikumar-vs Sep 4, 2023
a9df7c4
Fixed a typo
saikumar-vs Sep 4, 2023
c31a678
Merge branch 'main' into PMM-T2340
saikumar-vs Sep 11, 2023
5c61865
Add tests for RDS, AWS and QAN checks
saikumar-vs Sep 11, 2023
adeebcd
Updates
saikumar-vs Sep 11, 2023
8e24127
Improvements
saikumar-vs Sep 11, 2023
d7840bb
Merge branch 'main' into PMM-T2340
Sep 19, 2023
9eeddde
Addressed review comments
saikumar-vs Sep 23, 2023
1cb62fd
Updates, renames
saikumar-vs Sep 23, 2023
fbb5bda
Add HAproxy test
saikumar-vs Sep 24, 2023
5483592
Updates, moved testdata out completely
saikumar-vs Sep 25, 2023
d7ef680
Fixed ServiceName, in last commit.
saikumar-vs Sep 25, 2023
4500cc6
service names updated
saikumar-vs Sep 25, 2023
b006047
Merge branch 'main' into PMM-T2340
Oct 3, 2023
09c8760
PMM-T2340 code review session
yurkovychv Oct 3, 2023
22ee2f5
Addressed review comments
saikumar-vs Oct 6, 2023
5f8d50a
Fixed Lint issues and some commented code.
saikumar-vs Oct 6, 2023
b3b7632
Updates
saikumar-vs Oct 6, 2023
00d4314
fix proxysql inputs on test failure
saikumar-vs Oct 6, 2023
304aa88
fix proxysql inputs on test failure
saikumar-vs Oct 6, 2023
d0b60d0
fix proxysql inputs on test failure
saikumar-vs Oct 6, 2023
6ad3a4c
fix service name
saikumar-vs Oct 9, 2023
d923cac
Remove not required changes
saikumar-vs Oct 9, 2023
d49c365
Remove not required changes
saikumar-vs Oct 9, 2023
b732dd3
Fix environment variable declaration
saikumar-vs Oct 9, 2023
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
205 changes: 203 additions & 2 deletions tests/configuration/pages/pmmInventoryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,69 @@
const assert = require('assert');
const paginationPart = require('./paginationFragment');
const servicesTab = require('./servicesTab');
const service = (serviceName) => `//span[contains(text(),'${serviceName}')]`;

module.exports = {
postgresGCSettings: {
environment: 'Remote PostgreSQL_GC env',
cluster: 'Remote PostgreSQL_GC cluster',
},
mysqlSettings: {
environment: 'remote-mysql-new',
cluster: 'remote-mysql-cluster-new',
},
potgresqlSettings: {
environment: 'remote-postgres-new',
cluster: 'remote-postgres-cluster-new',
},
postgresqlAzureInputs: {
userName: remoteInstancesHelper.remote_instance.azure.azure_postgresql.userName,
password: remoteInstancesHelper.remote_instance.azure.azure_postgresql.password,

Check failure on line 22 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
environment: 'Azure PostgreSQL environment',

Check failure on line 23 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
cluster: 'Azure PostgreSQL cluster',
replicationSet: 'Azure PostgreSQL replica',
},
mysqlAzureInputs: {
userName: remoteInstancesHelper.remote_instance.azure.azure_mysql.userName,
password: remoteInstancesHelper.remote_instance.azure.azure_mysql.password,

Check failure on line 29 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
environment: 'Azure MySQL environment',

Check failure on line 30 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
cluster: 'Azure MySQL cluster',
replicationSet: 'Azure MySQL replica',
},
mysqlInputs: {
userName: remoteInstancesHelper.remote_instance.aws.aws_rds_5_6.username,
password: remoteInstancesHelper.remote_instance.aws.aws_rds_5_6.password,

Check failure on line 36 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
environment: 'RDS MySQL 5.6',

Check failure on line 37 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
cluster: 'rds56-cluster',
replicationSet: 'rds56-replication',
},
mysql57rdsInput: {
userName: remoteInstancesHelper.remote_instance.aws.aws_rds_5_7.username,
password: remoteInstancesHelper.remote_instance.aws.aws_rds_5_7.password,

Check failure on line 43 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
environment: 'RDS MySQL 5.7',

Check failure on line 44 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
cluster: 'rds57-cluster',
replicationSet: 'rds57-replication',
},
mysql80rdsInput: {
userName: remoteInstancesHelper.remote_instance.aws.aws_rds_8_0.username,
password: remoteInstancesHelper.remote_instance.aws.aws_rds_8_0.password,

Check failure on line 50 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
environment: 'RDS MySQL 8.0',

Check failure on line 51 in tests/configuration/pages/pmmInventoryPage.js

View workflow job for this annotation

GitHub Actions / lint

'remoteInstancesHelper' is not defined
cluster: 'rds80-cluster',
replicationSet: 'rds80-replication',
},
postgresqlInputs: {
userName: remoteInstancesHelper.remote_instance.aws.aws_postgresql_12.userName,
password: remoteInstancesHelper.remote_instance.aws.aws_postgresql_12.password,
environment: 'RDS Postgres',
cluster: 'rdsPostgres-cluster',
replicationSet: 'rdsPostgres-replication',
},
url: 'graph/inventory?orgId=1',
fields: {
servicesLink: locate('[role="tablist"] a').withText('Services').withAttr({ 'aria-label': 'Tab Services' }),
serviceRow: (serviceName) => locate('tr').withChild(locate('td').withAttr({ title: serviceName })),
showServiceDetails: (serviceName) => `//span[contains(text(), '${serviceName}')]//ancestor::tr//button[@data-testid="show-row-details"]`,
hideServiceDetails: (serviceName) => `//span[contains(text(), '${serviceName}')]//ancestor::tr//button[@data-testid="hide-row-details"]`,
showServiceDetails: (serviceName) => `${service(serviceName)}//ancestor::tr//button[@data-testid="show-row-details"]`,
hideServiceDetails: (serviceName) => `${service(serviceName)}//ancestor::tr//button[@data-testid="hide-row-details"]`,
showAgentDetails: (agentName) => `//td[contains(text(), '${agentName}')]//ancestor::tr//button[@data-testid="show-row-details"]`,
showRowDetails: '//button[@data-testid="show-row-details"]',
agentStatus: locate('$details-row-content').find('a'),
Expand All @@ -18,13 +73,16 @@
agentDetailsLabelByText: (label) => locate('[aria-label="Tags"]').find('li').withText(label),
agentsLink: locate('[role="tablist"] a').withText('Agents').withAttr({ 'aria-label': 'Tab Agents' }),
agentsLinkOld: locate('a').withText('Agents'),
cluster: '$cluster-text-input',
deleteButton: locate('span').withText('Delete'),
environment: '$environment-text-input',
externalExporter: locate('td').withText('External exporter'),
forceModeCheckbox: locate('$force-field-label'),
inventoryTable: locate('table'),
inventoryTableColumn: locate('table').find('td'),
inventoryTableRows: locate('tr').after('table'),
inventoryTableRowCount: (count) => locate('span').withText(`${count}`),
kebabMenu: (serviceName) => `(${service(serviceName)}/following::span//*[name()='svg' and @class='css-hj6vlq'])[2]`,
saikumar-vs marked this conversation as resolved.
Show resolved Hide resolved
mongoServiceName: locate('td').withText('mongodb'),
mysqlServiceName: locate('td').withText('ms-single'),
// cannot be changed to locate because it's failing in I.waitForVisible()
Expand All @@ -50,6 +108,7 @@
selectAllCheckbox: locate('$select-all'),
selectRowCheckbox: locate('$select-row'),
removalDialogMessage: '//form/h4',
replicationSet: '$replication_set-text-input',
selectedCheckbox: '//div[descendant::input[@value="true"] and @data-testid="select-row"]',
},
servicesTab,
Expand Down Expand Up @@ -373,4 +432,146 @@
await I.waitForVisible(agent, 30);
I.click(this.fields.backToServices);
},

async saveConfirm() {
I.click('//div[contains(text(),\'Save Changes\')]');
I.seeElement('//div[contains(text(),"Changing the cluster label will remove all scheduled backups")]');
I.click('//span[normalize-space()="Confirm and save changes"]');
},

async editRemoteServiceDisplayed(serviceName) {
saikumar-vs marked this conversation as resolved.
Show resolved Hide resolved
I.waitForElement(this.fields.kebabMenu(serviceName),30);
I.wait(10);
saikumar-vs marked this conversation as resolved.
Show resolved Hide resolved
I.click(this.fields.kebabMenu(serviceName));
I.waitForElement('//span[contains(text(),"Edit")]',30);
I.wait(10);
I.click('//span[contains(text(),"Edit")]');
I.waitForElement('//h3[contains(text(),"Editing")]');
I.seeElement('//h3[contains(text(),"Editing")]');
var lables;
switch (serviceName) {
saikumar-vs marked this conversation as resolved.
Show resolved Hide resolved
case remoteInstancesHelper.services.mysql:
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, this.mysqlSettings.environment);
I.clearField(this.fields.cluster);
I.fillField(this.fields.cluster, this.mysqlSettings.cluster);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${this.mysqlSettings.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${this.mysqlSettings.cluster}")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.mysql_ssl:
I.clearField(this.fields.environment);
I.fillField(
this.fields.environment,
remoteInstancesHelper.remote_instance.mysql.ms_8_0_ssl.environment,
);
I.clearField(this.fields.cluster);
I.fillField(
this.fields.cluster,
remoteInstancesHelper.remote_instance.mysql.ms_8_0_ssl.clusterName,
);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${remoteInstancesHelper.remote_instance.mysql.ms_8_0_ssl.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${remote_instance.mysql.ms_8_0_ssl.clusterName}")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.mongodb:
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, 'remote-mongodb-new');
I.clearField(this.fields.cluster);
I.fillField(this.fields.cluster, 'remote-mongodb-cluster-new');
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"remote-mongodb-new")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"remote-mongodb-cluster-new")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.mongodb_ssl:
I.clearField(this.fields.environment);
I.fillField(
this.fields.environment,
remoteInstancesHelper.remote_instance.mongodb.mongodb_4_4_ssl.environment,
);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${remote_instance.mongodb.mongodb_4_4_ssl.environment}")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.postgresql:
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, this.potgresqlSettings.environment);
I.clearField(this.fields.cluster);
I.fillField(this.fields.cluster, this.potgresqlSettings.cluster);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${this.potgresqlSettings.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${this.potgresqlSettings.cluster}")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.postgres_ssl:
I.clearField(this.fields.environment);
I.fillField(
this.fields.environment,
remoteInstancesHelper.remote_instance.postgresql.postgres_13_3_ssl.environment,
);
I.clearField(this.fields.cluster);
I.fillField(
this.fields.cluster,
remoteInstancesHelper.remote_instance.postgresql.postgres_13_3_ssl.clusterName,
);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${remote_instance.postgresql.postgres_13_3_ssl.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${remote_instance.postgresql.postgres_13_3_ssl.clusterName}")]`;
I.waitForElement(labels, 30);
break;
case remoteInstancesHelper.services.proxysql:
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, 'remote-proxysql-new');
I.fillField(this.fields.cluster, 'remote-proxysql-cluster-new');
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"remote-proxysql-new")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"remote-proxysql-cluster-new")]`;
I.waitForElement(labels, 30);
break;
case 'external_service_new':
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, 'remote-external-service-new');
I.clearField(this.fields.cluster);
I.fillField(this.fields.cluster, 'remote-external-cluster-new');
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"remote-external-service-new")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"remote-external-cluster-new")]`;
I.waitForElement(labels, 30);
break;
case 'postgreDoNotTrack':
case 'postgresPGStatStatements':
case 'postgresPgStatMonitor':
break;
case remoteInstancesHelper.services.postgresGC:
I.clearField(this.fields.environment);
I.fillField(this.fields.environment, this.postgresGCSettings.environment);
I.clearField(this.fields.cluster);
I.fillField(this.fields.cluster, this.postgresGCSettings.cluster);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
labels = `//span[contains(text(),"${this.postgresGCSettings.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${this.postgresGCSettings.cluster}")]`;
I.waitForElement(labels, 30);
break;
}
},
};
69 changes: 69 additions & 0 deletions tests/configuration/verifyPMMInventory_test.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,57 @@
const assert = require('assert');

const { I, remoteInstancesPage, pmmInventoryPage, remoteInstancesHelper } = inject();

const externalExporterServiceName = 'external_service_new';
const haproxyServiceName = 'haproxy_remote';

const instances = new DataTable(['name']);
const remotePostgreSQL = new DataTable(['instanceName', 'trackingOption', 'checkAgent']);
const qanFilters = new DataTable(['filterName']);
const dashboardCheck = new DataTable(['serviceName']);
const metrics = new DataTable(['serviceName', 'metricName']);

metrics.add(['pmm-server-postgresql', 'pg_stat_database_xact_rollback']);
metrics.add([externalExporterServiceName, 'redis_uptime_in_seconds']);
metrics.add([haproxyServiceName, 'haproxy_process_start_time_seconds']);

for (const [key, value] of Object.entries(remoteInstancesHelper.services)) {
if (value) {
switch (key) {
case 'postgresql':
// TODO: https://jira.percona.com/browse/PMM-9011
// eslint-disable-next-line max-len
// remotePostgreSQL.add(['postgresPGStatStatements', remoteInstancesPage.fields.usePgStatStatements, pmmInventoryPage.fields.postgresPgStatements]);
// qanFilters.add([remoteInstancesPage.potgresqlSettings.environment]);
// dashboardCheck.add([remoteInstancesHelper.services.postgresql]);
// metrics.add([remoteInstancesHelper.services.postgresql, 'pg_stat_database_xact_rollback']);
break;
case 'mysql':
qanFilters.add([remoteInstancesPage.mysqlSettings.environment]);
metrics.add([remoteInstancesHelper.services.mysql, 'mysql_global_status_max_used_connections']);
break;
case 'postgresGC':
dashboardCheck.add([remoteInstancesHelper.services.postgresGC]);
qanFilters.add([remoteInstancesPage.postgresGCSettings.environment]);
break;
case 'mysql_ssl':
qanFilters.add([remoteInstancesHelper.remote_instance.mysql.ms_8_0_ssl.environment]);
break;
case 'postgres_ssl':
qanFilters.add([remoteInstancesHelper.remote_instance.postgresql.postgres_13_3_ssl.environment]);
break;
case 'mongodb':
metrics.add([remoteInstancesHelper.services.mongodb, 'mongodb_up']);
break;
case 'proxysql':
metrics.add([remoteInstancesHelper.services.proxysql, 'proxysql_up']);
break;
default:
}
instances.add([key]);
}
}

Feature('Inventory page');

Before(async ({ I }) => {
Expand Down Expand Up @@ -208,3 +260,20 @@ Scenario(
});
},
);

Data(instances).Scenario(
'Verify Remote Instances can be created and edited [critical] @inventory',
async ({
I, pmmInventoryPage, current,
}) => {
const serviceName = remoteInstancesHelper.services[current.name];

I.amOnPage(remoteInstancesPage.url);
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage(current.name);
await remoteInstancesPage.fillRemoteFields(serviceName);
remoteInstancesPage.createRemoteInstance(serviceName);
pmmInventoryPage.verifyRemoteServiceIsDisplayed(serviceName);
pmmInventoryPage.editRemoteServiceDisplayed(serviceName);
},
);
Loading