Skip to content

Commit

Permalink
PMM-7 try fix for remote instances
Browse files Browse the repository at this point in the history
  • Loading branch information
yurkovychv committed Nov 15, 2024
1 parent 9041232 commit 3433d50
Show file tree
Hide file tree
Showing 11 changed files with 60 additions and 36 deletions.
6 changes: 3 additions & 3 deletions tests/configuration/verifyPMMInventory_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ Scenario(
remoteInstancesPage.openAddRemotePage('external');
const inputs = await remoteInstancesPage.fillRemoteFields(externalExporterServiceName);

remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(externalExporterServiceName);
const newLabels = {
environment: `${inputs.environment} edited` || `${externalExporterServiceName} environment edited`,
Expand Down Expand Up @@ -410,7 +410,7 @@ Scenario(
remoteInstancesHelper.remote_instance.haproxy.haproxy_2.port,
);
I.scrollPageToBottom();
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(haproxyServiceName);
const newLabels = {
environment: `${remoteInstancesHelper.remote_instance.haproxy.environment} edited` || `${haproxyServiceName} environment edited`,
Expand Down Expand Up @@ -474,7 +474,7 @@ Data(azureServices).Scenario(
remoteInstancesPage.verifyAddInstancePageOpened();
const inputs = await remoteInstancesPage.fillRemoteRDSFields(serviceName);

remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(serviceName);
const newLabels = {
environment: `${inputs.environment} edited` || `${serviceName} environment edited`,
Expand Down
2 changes: 1 addition & 1 deletion tests/dashboards/verifyGCRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Data(instances).Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage(instanceType);
await remoteInstancesPage.addRemoteDetails(instanceDetails);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(instanceDetails.serviceName);
await pmmInventoryPage.verifyAgentHasStatusRunning(instanceDetails.serviceName);
// Waiting for metrics to start hitting PMM-Server
Expand Down
60 changes: 42 additions & 18 deletions tests/pages/remoteInstancesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -527,26 +527,50 @@ module.exports = {
return pmmInventoryPage;
},

clickAddInstanceAndWaitForSuccess() {
async clickAddInstanceAndWaitForSuccess() {
I.waitForVisible(this.fields.addService, 30);
I.wait(1);
I.forceClick(this.fields.addService);

I.waitForResponse(
(response) => {
if (response.url().includes('v1/management/services')) {
if (response.status() === 200) {
return true;
}

throw new Error(`Expected status 200 but received ${response.status()}`);
}

// Continue waiting if this isn't the target request
return false;
},
30,
);

await I.usePlaywrightTo('click Add service and wait for response', async ({ page }) => {
const [response] = await Promise.all([
page.waitForResponse(
async (response) => {
if (response.url().includes('v1/management/services')) {
if (response.status() === 200) {
return true;
}

throw new Error(`Expected status 200 but received ${response.status()}. Response: ${await response.text()}`);
}

return false;
},
{ timeout: 5000 },
),
page.click(this.fields.addService),
]);
});

// eslint-disable-next-line no-undef
// await retryTo((tryNum) => {
// I.click(this.fields.addService);
//
// I.waitForResponse(
// (response) => {
// if (response.url().includes('v1/management/services')) {
// if (response.status() === 200) {
// return true;
// }
//
// throw new Error(`Expected status 200 but received ${response.status()}`);
// }
//
// // Continue waiting if this isn't the target request
// return false;
// },
// 5,
// );
// }, 5);
},

openAddAzure() {
Expand Down
2 changes: 1 addition & 1 deletion tests/qa-integration/pmm_ps_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Scenario(
I.fillField(remoteInstancesPage.fields.password, details.password);
I.fillField(remoteInstancesPage.fields.environment, details.environment);
I.fillField(remoteInstancesPage.fields.cluster, details.cluster);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
// I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
I.wait(10);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
Expand Down
2 changes: 1 addition & 1 deletion tests/qa-integration/pmm_psmdb_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Scenario(
I.fillField(remoteInstancesPage.fields.environment, details.environment);
I.fillField(remoteInstancesPage.fields.cluster, details.cluster);
I.click(remoteInstancesPage.fields.useQANMongoDBProfiler);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/qa-integration/pmm_pxc_integration_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ Scenario(
I.fillField(remoteInstancesPage.fields.password, details.password);
I.fillField(remoteInstancesPage.fields.environment, details.environment);
I.fillField(remoteInstancesPage.fields.cluster, details.cluster);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
// I.waitForVisible(pmmInventoryPage.fields.agentsLink, 30);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
Expand Down
2 changes: 1 addition & 1 deletion tests/verifyAzureMySQLPostgreSQLRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Data(azureServices).Scenario(
remoteInstancesPage.startMonitoringOfInstance(current.instanceToMonitor);
remoteInstancesPage.verifyAddInstancePageOpened();
await remoteInstancesPage.fillRemoteRDSFields(serviceName);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(serviceName);

if (serviceName === 'azure-MySQL') {
Expand Down
8 changes: 4 additions & 4 deletions tests/verifyRemoteInstances_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage('external');
await remoteInstancesPage.fillRemoteFields(externalExporterServiceName);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(externalExporterServiceName);
await I.click(pmmInventoryPage.fields.showServiceDetails(externalExporterServiceName));
await I.click(pmmInventoryPage.fields.agentsLinkNew);
Expand Down Expand Up @@ -205,7 +205,7 @@ Scenario(
remoteInstancesHelper.remote_instance.haproxy.haproxy_2.port,
);
I.scrollPageToBottom();
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(haproxyServiceName);

await I.click(pmmInventoryPage.fields.showServiceDetails(haproxyServiceName));
Expand Down Expand Up @@ -258,7 +258,7 @@ Data(remotePostgreSQL).Scenario(
I.waitForVisible(remoteInstancesPage.fields.skipTLSL, 30);
I.click(remoteInstancesPage.fields.skipTLSL);
I.click(current.trackingOption);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(current.instanceName);
await pmmInventoryPage.verifyAgentHasStatusRunning(current.instanceName);
await pmmInventoryPage.checkExistingAgent(current.checkAgent);
Expand Down Expand Up @@ -334,7 +334,7 @@ Scenario(
I.click(remoteInstancesPage.fields.addService);
I.verifyPopUpMessage(errorMessage);
I.fillField(remoteInstancesPage.fields.database, 'not_default_db');
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
pmmInventoryPage.verifyRemoteServiceIsDisplayed(remoteServiceName);
await pmmInventoryPage.verifyAgentHasStatusRunning(remoteServiceName);
// verify metric for client container node instance
Expand Down
4 changes: 2 additions & 2 deletions tests/verifyTLSMongoDBRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Data(instances).Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
serviceType: SERVICE_TYPE.MONGODB,
Expand Down Expand Up @@ -221,7 +221,7 @@ Data(instances).Scenario(
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
I.fillField(remoteInstancesPage.fields.maxQueryLength, maxQueryLength);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();

// Check Remote Instance also added and have running status
pmmInventoryPage.verifyRemoteServiceIsDisplayed(remoteServiceName);
Expand Down
4 changes: 2 additions & 2 deletions tests/verifyTLSMySQLRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ Data(instances).Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
// Add wait for service status to be updated
I.wait(10);
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
Expand Down Expand Up @@ -244,7 +244,7 @@ Data(maxQueryLengthInstances).Scenario(
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
I.fillField(remoteInstancesPage.fields.maxQueryLength, maxQueryLength);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();

// Check Remote Instance also added and have running status
pmmInventoryPage.verifyRemoteServiceIsDisplayed(remoteServiceName);
Expand Down
4 changes: 2 additions & 2 deletions tests/verifyTLSPostgresRemoteInstance_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ Data(instances).Scenario(
remoteInstancesPage.waitUntilRemoteInstancesPageLoaded();
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await inventoryAPI.verifyServiceExistsAndHasRunningStatus(
{
serviceType: SERVICE_TYPE.POSTGRESQL,
Expand Down Expand Up @@ -225,7 +225,7 @@ Data(instances).Scenario(
remoteInstancesPage.openAddRemotePage(serviceType);
await remoteInstancesPage.addRemoteSSLDetails(details);
I.fillField(remoteInstancesPage.fields.maxQueryLength, maxQueryLength);
remoteInstancesPage.clickAddInstanceAndWaitForSuccess();
await remoteInstancesPage.clickAddInstanceAndWaitForSuccess();

// Check Remote Instance also added and have running status
pmmInventoryPage.verifyRemoteServiceIsDisplayed(remoteServiceName);
Expand Down

0 comments on commit 3433d50

Please sign in to comment.