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 15 commits
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
62 changes: 59 additions & 3 deletions tests/configuration/pages/pmmInventoryPage.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@
const { I, inventoryAPI } = inject();
const { I, inventoryAPI, remoteInstancesHelper, adminPage } = inject();

const assert = require('assert');
const paginationPart = require('./paginationFragment');
const servicesTab = require('./servicesTab');
const service = (serviceName) => `//span[contains(text(),'${serviceName}')]`;

module.exports = {
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 +20,18 @@ module.exports = {
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'),
editButton: locate('span').withText('Edit'),
editText: locate('h3').withText('Editing'),
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)}//ancestor::tr//button[@data-testid="dropdown-menu-toggle"]`,
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,7 +57,11 @@ module.exports = {
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"]',
saveButton: locate('button').withChild('div').withText('Save Changes'),
saveConfirmButton: locate('span').withText('Confirm and save changes'),
savePopupMessage: locate('p').withText('Changing existing labels can affect other parts of PMM dependent on it'),
},
servicesTab,
pagination: paginationPart,
Expand Down Expand Up @@ -373,4 +384,49 @@ module.exports = {
await I.waitForVisible(agent, 30);
I.click(this.fields.backToServices);
},

async clearFields() {
adminPage.customClearField(this.fields.environment);
//I.clearField(this.fields.environment);
adminPage.customClearField(this.fields.cluster);
//I.clearField(this.fields.cluster);
adminPage.customClearField(this.fields.replicationSet);
//I.clearField(this.fields.replicationSet);
},

async fillFields(serviceParameters) {
I.fillField(this.fields.environment, serviceParameters.environment);
I.fillField(this.fields.cluster, serviceParameters.cluster);
I.fillField(this.fields.replicationSet, serviceParameters.replicationSet);
},

async saveConfirm() {
I.click(this.fields.saveButton);
I.seeElement(this.fields.savePopupMessage);
I.click(this.fields.saveConfirmButton);
},

async verifyLabels(serviceParameters) {
let labels;
labels = `//span[contains(text(),"${serviceParameters.environment}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${serviceParameters.cluster}")]`;
I.waitForElement(labels, 30);
labels = `//span[contains(text(),"${serviceParameters.replicationSet}")]`;
I.waitForElement(labels, 30);
},

async verifyEditRemoteService(serviceName, serviceParameters) {
I.waitForElement(this.fields.kebabMenu(serviceName), 30);
I.click(this.fields.kebabMenu(serviceName));
I.waitForElement(this.fields.editButton, 30);
I.click(this.fields.editButton);
I.waitForElement(this.fields.editText, 30);
I.seeElement(this.fields.editText);
this.clearFields();
this.fillFields(serviceParameters);
this.saveConfirm();
await I.click(this.fields.showServiceDetails(serviceName));
this.verifyLabels(serviceParameters);
},
};
84 changes: 84 additions & 0 deletions tests/configuration/testData.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
const {remoteInstancesHelper} = inject();

const filterOperators = {
equal: '= (EQUAL)',
regex: '=~ (REGEX)',
};

module.exports = {
postgresGCSettings: {
environment: 'Remote PostgreSQL_GC env new',
cluster: 'Remote PostgreSQL_GC cluster new',
replicationSet: 'Remote PostgreSQL_GC replica-new',
},
mysqlSettings: {
environment: 'remote-mysql-new',
cluster: 'remote-mysql-cluster-new',
replicationSet: 'remote-mysql-replica-new',
},
potgresqlSettings: {
environment: 'remote-postgres-new',
cluster: 'remote-postgres-cluster-new',
replicationSet: 'remote-postgres-replica-new',
},
mongodbSettings: {
environment: 'remote-mongodb-new',
cluster: 'remote-mongodb-cluster-new',
replicationSet: 'remote-mongodb-replica-new',
},
proxysqlSettings: {
environment: 'remote-proxysql-new',
cluster: 'remote-proxysql-cluster-new',
replicationSet: 'remote-proxysql-replica-new',
},
externalSettings: {
environment: 'remote-external-service-new',
cluster: 'remote-external-cluster-new',
replicationSet: 'remote-external-replica-new',
},
postgresqlAzureInputs: {
environment: 'Azure PostgreSQL environment new',
cluster: 'Azure PostgreSQL cluster new',
replicationSet: 'Azure PostgreSQL replica new',
},
mysqlAzureInputs: {
environment: 'Azure MySQL environment new',
cluster: 'Azure MySQL cluster new',
replicationSet: 'Azure MySQL replica new',
},
mysqlInputs: {
environment: 'RDS MySQL 5.6 new',
cluster: 'rds56-cluster new',
replicationSet: 'rds56-replication new',
},
mysql57rdsInput: {
environment: 'RDS MySQL 5.7 new',
cluster: 'rds57-cluster new',
replicationSet: 'rds57-replication new',
},
mysql80rdsInput: {
environment: 'RDS MySQL 8.0 new',
cluster: 'rds80-cluster new',
replicationSet: 'rds80-replication new',
},
postgresqlInputs: {
environment: 'RDS Postgres new',
cluster: 'rdsPostgres-cluster new',
replicationSet: 'rdsPostgres-replication new',
},
aurora2Inputs: {
environment: 'Aurora2 Postgres new',
cluster: 'Aurora2-cluster new',
replicationSet: 'Aurora2-replication new',
},
aurora3Inputs: {
environment: 'Aurora2 Postgres new',
cluster: 'Aurora2-cluster new',
replicationSet: 'Aurora2-replication new',
},
haproxy: {
environment: 'Haproxy Postgres new',
cluster: 'Haproxy-cluster new',
replicationSet: 'Haproxy-replication new',
},
};
Loading
Loading