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

Inventory Test Fixes #697

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
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
2 changes: 1 addition & 1 deletion tests/configuration/pages/paginationFragment.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ module.exports = {
totalsLabel: '$pagination-items-inverval',
firstPageButton: '$first-page-button',
previousPageButton: '$previous-page-button',
pageNumberButton: (number) => locate('$page-button').withText(`${number}`),
pageNumberButton: (number) => locate('button').withAttr({'data-testid': "page-button-active"}).find('span').withText(`${number}`),
pageNumberButtonLast: '(//button[@data-testid="page-button-active" or @data-testid="page-button"])[last()]',
nextPageButton: '$next-page-button',
lastPageButton: '$last-page-button',
Expand Down
42 changes: 28 additions & 14 deletions tests/configuration/pages/pmmInventoryPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ module.exports = {
serviceRow: (serviceName) => locate('tr').withChild(locate('td').withAttr({ title: serviceName })),
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"]`,
showAgentDetails: (agentName) => `//span[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'),
backToServices: '//span[text()="Go back to services"]',
Expand All @@ -28,6 +28,8 @@ module.exports = {
deleteButton: locate('span').withText('Delete'),
environment: '$environment-text-input',
externalExporter: locate('td').withText('External exporter'),
serviceForceModeCheckbox: locate('input').withAttr({'data-testid': 'delete-services-force-mode'}),
nodeForceModeCheckbox: `//label[@for='input-force-id']//span`,
editButton: locate('span').withText('Edit'),
editText: locate('h3').withText('Editing'),
forceModeCheckbox: locate('$force-field-label'),
Expand All @@ -48,7 +50,8 @@ module.exports = {
postgresExporter: locate('td').withText('Postgres exporter'),
postgresPgStatements: locate('td').withText('QAN PostgreSQL PgStatements'),
postgresPgstatmonitor: locate('td').withText('QAN PostgreSQL Pgstatmonitor'),
proceedButton: locate('span').withText('Proceed'),
serviceProceedButton: locate('button').find('span').withText('Yes, delete service'),
nodeProceedButton: locate('button').find('span').withText('Proceed'),
runningStatus: locate('span').withText('RUNNING'),
rowsPerPage: locate('$pagination').find('div'),
serviceIdLocatorPrefix: '//table//tr/td[4][contains(text(),"',
Expand All @@ -60,7 +63,8 @@ module.exports = {
agentId: '//td[contains(text(), "agent_id") and not(following-sibling::td[text()="PMM Agent"])]',
selectAllCheckbox: locate('$select-all'),
selectRowCheckbox: locate('$select-row'),
removalDialogMessage: '//form/h4',
removalServiceDialogMessage: locate('p').withAttr({'data-testid':'delete-services-description'}),
removalDialogMessage: locate('form').find('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'),
Expand Down Expand Up @@ -231,15 +235,19 @@ module.exports = {
},

selectService(serviceName) {
const serviceLocator = `${this.fields.serviceIdLocatorPrefix}${serviceName}")]/preceding-sibling::td/div[@data-testid="select-row"]`;
const serviceLocator = `//span[contains(text(),"${serviceName}")]/preceding::td[2]/div[@data-testid="select-row"]`;
I.waitForVisible(serviceLocator, 30);
I.click(serviceLocator);
},

selectNode(serviceName) {
const serviceLocator = `//td[contains(text(),"${serviceName}")]/preceding::td[2]/div[@data-testid="select-row"]`;
I.waitForVisible(serviceLocator, 30);
I.click(serviceLocator);
},

serviceExists(serviceName, deleted) {
const serviceLocator = `${this.fields.serviceIdLocatorPrefix}${serviceName}")]`;

const serviceLocator = `//span[contains(text(),"${serviceName}")]`;
if (deleted) {
I.waitForInvisible(serviceLocator, 30);
} else {
Expand All @@ -248,7 +256,7 @@ module.exports = {
},

checkNodeExists(serviceName) {
const nodeName = `${this.fields.serviceIdLocatorPrefix}${serviceName}")]`;
const nodeName = `//td[contains(text(),"${serviceName}")]`;

I.waitForVisible(nodeName, 20);
},
Expand All @@ -273,14 +281,12 @@ module.exports = {

selectAgent(agentType) {
const agentLocator = `//table//tr/td[3][contains(text(),"${agentType}")]/preceding-sibling::td/div[@data-testid="select-row"]`;

I.waitForVisible(agentLocator, 30);
I.click(agentLocator);
},

async getAgentServiceID(agentType) {
const serviceIdLocator = `//table//tr/td[3][contains(text(),"${agentType}")]/following-sibling::td//span[contains(text(), 'service_id:')]`;

I.waitForVisible(serviceIdLocator, 30);
const serviceIDs = await I.grabTextFrom(serviceIdLocator);

Expand Down Expand Up @@ -317,16 +323,24 @@ module.exports = {
},

selectAgentByID(id) {
const agentIdLocator = `//table//tr/td[2][contains(text(),"${id}")]/preceding-sibling::td/div[@data-testid="select-row"]`;

//const agentIdLocator = `//table//tr/td[2][contains(text(),"${id}")]/preceding-sibling::td/div[@data-testid="select-row"]`;
const agentIdLocator = `//span[contains(text(),"${id}")]/preceding::td[2]/div[@data-testid="select-row"]`;
I.waitForVisible(agentIdLocator, 30);
I.click(agentIdLocator);
},

deleteWithForceOpt() {
async deleteServiceWithForceOpt(serviceName) {
I.click(this.fields.deleteButton);
I.waitForElement(this.fields.serviceForceModeCheckbox,40);
await I.click(this.fields.serviceForceModeCheckbox);
I.click(this.fields.serviceProceedButton);
},

async deleteNodeWithForceOpt() {
I.click(this.fields.deleteButton);
I.click(this.fields.forceModeCheckbox);
I.click(this.fields.proceedButton);
I.waitForElement(this.fields.nodeForceModeCheckbox,40);
await I.click(this.fields.nodeForceModeCheckbox);
I.click(this.fields.nodeProceedButton);
},

async getCountOfItems() {
Expand Down
29 changes: 18 additions & 11 deletions tests/configuration/verifyPMMInventoryPagination_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ AfterSuite(async ({ inventoryAPI }) => {

const subPages = new DataTable(['name']);

//Todo Fix/Adjust Agent tests
subPages.add(['services']);
subPages.add(['agents']);
subPages.add(['nodes']);

Data(subPages).Scenario(
Expand All @@ -50,24 +50,30 @@ Data(subPages).Scenario(
}) => {
const subPageLocator = pmmInventoryPage.fields[`${current.name}Link`];

I.waitForClickable(subPageLocator, 30);
I.waitForClickable(subPageLocator, 60);
I.click(subPageLocator);
I.waitForClickable(pmmInventoryPage.fields.slectAllCheckbox);
I.waitForClickable(pmmInventoryPage.fields.selectAllCheckbox,30);
I.click(pmmInventoryPage.fields.selectAllCheckbox);
I.waitForVisible(pmmInventoryPage.fields.selectedCheckbox);
I.waitForVisible(pmmInventoryPage.fields.selectedCheckbox,30);
let selectedCheckboxNumber = await I.grabNumberOfVisibleElements(pmmInventoryPage.fields.selectedCheckbox);

I.waitForClickable(pmmInventoryPage.pagination.elements.nextPageButton);
I.waitForClickable(pmmInventoryPage.pagination.elements.nextPageButton, 30);
I.click(pmmInventoryPage.pagination.elements.nextPageButton);
I.waitForClickable(pmmInventoryPage.fields.selectRowCheckbox);
I.waitForClickable(pmmInventoryPage.fields.selectRowCheckbox, 30);
I.click(pmmInventoryPage.fields.selectRowCheckbox);
I.waitForVisible(pmmInventoryPage.fields.selectedCheckbox);
I.waitForVisible(pmmInventoryPage.fields.selectedCheckbox, 30);
selectedCheckboxNumber += await I.grabNumberOfVisibleElements(pmmInventoryPage.fields.selectedCheckbox);

I.waitForClickable(pmmInventoryPage.fields.deleteButton);
I.click(pmmInventoryPage.fields.deleteButton);
I.seeTextEquals(`Are you sure that you want to permanently delete ${selectedCheckboxNumber} ${current.name}?`, pmmInventoryPage.fields.removalDialogMessage);
},
if (`${current.name}` === "services"){
I.waitForElement(pmmInventoryPage.fields.removalServiceDialogMessage, 30);
I.seeTextEquals(`Are you sure that you want to permanently delete ${selectedCheckboxNumber} ${current.name}`, pmmInventoryPage.fields.removalServiceDialogMessage);
}else{
I.waitForElement(pmmInventoryPage.fields.removalDialogMessage, 30);
I.seeTextEquals(`Are you sure that you want to permanently delete ${selectedCheckboxNumber} ${current.name}`, pmmInventoryPage.fields.removalDialogMessage);
}
}
);

Data(subPages).Scenario(
Expand All @@ -77,10 +83,11 @@ Data(subPages).Scenario(
}) => {
const subPageLocator = pmmInventoryPage.fields[`${current.name}Link`];

I.waitForClickable(subPageLocator, 30);
I.waitForClickable(subPageLocator, 60);
I.click(subPageLocator);
I.waitForClickable(pmmInventoryPage.fields.selectAllCheckbox);
I.waitForClickable(pmmInventoryPage.fields.selectAllCheckbox,30);
I.click(pmmInventoryPage.fields.selectAllCheckbox);
I.waitForElement(pmmInventoryPage.fields.selectAllCheckbox,30);
I.waitNumberOfVisibleElements(
pmmInventoryPage.fields.selectedCheckbox,
await pmmInventoryPage.pagination.getSelectedCountPerPage(),
Expand Down
33 changes: 18 additions & 15 deletions tests/configuration/verifyPMMInventory_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,13 +99,14 @@ Scenario(

pmmInventoryPage.selectService(serviceName);
I.click(pmmInventoryPage.fields.deleteButton);
I.click(pmmInventoryPage.fields.proceedButton);
I.click(pmmInventoryPage.fields.serviceProceedButton);
pmmInventoryPage.serviceExists(serviceName, false);
pmmInventoryPage.selectService(serviceName);
pmmInventoryPage.deleteWithForceOpt();
await pmmInventoryPage.deleteServiceWithForceOpt();
pmmInventoryPage.serviceExists(serviceName, true);
I.click(pmmInventoryPage.fields.agentsLink);
await pmmInventoryPage.getCountOfAgents(serviceId);
//Todo Adjust tests for Agents
//I.click(pmmInventoryPage.fields.agentsLink);
//await pmmInventoryPage.getCountOfAgents(serviceId);
I.click(pmmInventoryPage.fields.nodesLink);
pmmInventoryPage.checkNodeExists(serviceName);
},
Expand All @@ -123,12 +124,13 @@ Scenario(

I.waitForVisible(pmmInventoryPage.fields.nodesLink, 30);
I.click(pmmInventoryPage.fields.nodesLink);
pmmInventoryPage.selectService(serviceName);
pmmInventoryPage.deleteWithForceOpt();
pmmInventoryPage.selectNode(serviceName);
await pmmInventoryPage.deleteNodeWithForceOpt(serviceName);
I.click(pmmInventoryPage.fields.pmmServicesSelector);
pmmInventoryPage.serviceExists(serviceName, true);
I.click(pmmInventoryPage.fields.agentsLink);
await pmmInventoryPage.getCountOfAgents(serviceId);
// Todo Adjust Agents
//I.click(pmmInventoryPage.fields.agentsLink);
//await pmmInventoryPage.getCountOfAgents(serviceId);
},
);

Expand All @@ -140,13 +142,14 @@ Scenario(
I.amOnPage(pmmInventoryPage.url);
I.waitForVisible(pmmInventoryPage.fields.nodesLink, 30);
I.click(pmmInventoryPage.fields.nodesLink);
pmmInventoryPage.selectService(node);
pmmInventoryPage.deleteWithForceOpt();
pmmInventoryPage.selectNode(node);
await pmmInventoryPage.deleteNodeWithForceOpt();
pmmInventoryPage.checkNodeExists(node);
},
);

Scenario(
//Todo Fix/Adjust Agents tests
Scenario.skip(
'PMM-T343 - Verify agent can be removed on PMM Inventory page @inventory',
async ({ I, pmmInventoryPage, addInstanceAPI }) => {
const agentType = 'MySQL exporter';
Expand Down Expand Up @@ -189,12 +192,12 @@ Scenario.skip(
const countBefore = await pmmInventoryPage.getCountOfItems();

pmmInventoryPage.selectAgentByID(agentID);
pmmInventoryPage.deleteWithForceOpt();
pmmInventoryPage.deleteWithForceOpt(agentType);
pmmInventoryPage.existsByid(agentID, false);
pmmInventoryPage.selectAgent(agentType);
const agentIDToDelete = await pmmInventoryPage.getAgentID(agentType);

pmmInventoryPage.deleteWithForceOpt();
pmmInventoryPage.deleteWithForceOpt(agentType);
pmmInventoryPage.existsByid(agentIDToDelete, true);
await pmmInventoryPage.checkAllNotDeletedAgents(countBefore);
},
Expand All @@ -219,8 +222,8 @@ Scenario(
}
},
);

Scenario(
//Todo Fix/Adjust Agents Tests
Scenario.skip(
'PMM-T1226 - Verify Agents has process_exec_path option on Inventory page @inventory @nightly @exporters',
async ({ I, pmmInventoryPage, inventoryAPI }) => {
I.amOnPage(pmmInventoryPage.url);
Expand Down