Skip to content

Commit

Permalink
SAAS-263 cleanup AWS RDS skipped tests (#872)
Browse files Browse the repository at this point in the history
* SAAS-263 unskipped and fixed AWS RDS Mysql dedicated tests

* SAAS-263 minor change

* SAAS-263 adding tags

* SAAS-263 fixind tests

* SAAS-263 skipping QAN RDS test, fixing database checks test

* SAAS-263 formatting, and fixing tests

* SAAS-263 review change
  • Loading branch information
yurkovychv authored Jul 27, 2020
1 parent 60a43f3 commit 1a793c3
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 102 deletions.
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ indent_style = space
indent_size = 2
trim_trailing_whitespace = true

[pmm-app/tests/**.{js}]
[pmm-app/tests/**.js]
indent_style = space
indent_size = 2
trim_trailing_whitespace = true
Expand Down
86 changes: 41 additions & 45 deletions pmm-app/tests/QAN/qanPage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const { I, pmmSettingsPage } = inject();
const {I, pmmSettingsPage} = inject();
const moment = require('moment');
const assert = require('assert');
module.exports = {
Expand All @@ -8,6 +8,7 @@ module.exports = {
'Cluster',
'Replication Set',
'Database',
'Schema',
'Node Name',
'Service Name',
'User Name',
Expand Down Expand Up @@ -70,7 +71,7 @@ module.exports = {
addColumnNewQAN: "//span[contains(text(), 'Add column')]",
noDataIcon: 'div.ant-empty-image',
querySelector:
"(//table[@class='ant-table-fixed']//tbody[@class='ant-table-tbody'])[2]//tr[4]//td[2]//div//div",
"(//table[@class='ant-table-fixed']//tbody[@class='ant-table-tbody'])[2]//tr[4]//td[2]//div//div",
resizer: 'span.Resizer.horizontal',
queryTime: '//tr[@data-row-key][4]//td[5]//span[1]',
lockTimeDetail: "//tr[@data-row-key='lock_time']//td[4]//span[1]",
Expand All @@ -90,10 +91,10 @@ module.exports = {
environmentLabel: "//span[contains(text(), 'Environment')]",
innodbColumn: "//tr[2]//td[6]//span[contains(@class,'summarize')]",
innodbColumnTooltip:
"//tr[2]//td[6]//span[contains(@class,'ant-tooltip-open')]//span[contains(@class,'summarize')]",
"//tr[2]//td[6]//span[contains(@class,'ant-tooltip-open')]//span[contains(@class,'summarize')]",
loadValue: "//td[3]//span[contains(text(),'<0.01 load')]",
loadValueTooltip:
"//td[3]//span[contains(@class,'ant-tooltip-open')]//span[contains(text(),'<0.01 load')]",
"//td[3]//span[contains(@class,'ant-tooltip-open')]//span[contains(text(),'<0.01 load')]",
},

metricValueLocatorOverviewTable(column, row) {
Expand Down Expand Up @@ -126,20 +127,20 @@ module.exports = {

tableHeaderLocator(tableHeader) {
return (
"//ng-select//span[contains(@class, 'ng-value-label') and contains(text(), '" + tableHeader + "')]"
"//ng-select//span[contains(@class, 'ng-value-label') and contains(text(), '" + tableHeader + "')]"
);
},

tableHeaderColumnLocator(columnHeader) {
return `(//span[@class='ant-table-header-column'])//span[contains(text(), '${columnHeader}')]`;
},

filterGroupCountSelector(groupName) {
return (
"//section[@class='aside__filter-group']//span[contains(text(), '" +
groupName +
"')]/../button[contains(text(), 'See all')]"
);
showAllLocator(groupName) {
return `//span[contains(text(), '${groupName}')]/../span[contains(text(), 'Show all')]`
},

showTop5Locator(groupName) {
return `//span[contains(text(), '${groupName}')]/../span[contains(text(), 'Show top 5')]`
},

waitForFiltersLoad() {
Expand Down Expand Up @@ -176,41 +177,36 @@ module.exports = {
},

async expandAllFilter() {
for (let i = 0; i < 4; i++) {
// eslint-disable-next-line max-len
let numOfElementsFilterCount = await I.grabNumberOfVisibleElements(
this.filterGroupCountSelector(this.filterGroups[i])
for (const i in this.filterGroups) {
const numOfElementsFilterCount = await I.grabNumberOfVisibleElements(
this.showAllLocator(this.filterGroups[i])
);
if (numOfElementsFilterCount === 1) {
// eslint-disable-next-line max-len
I.click(this.filterGroupCountSelector(this.filterGroups[i]));
// eslint-disable-next-line max-len
if (numOfElementsFilterCount) {
I.click(this.showAllLocator(this.filterGroups[i]));
I.waitForVisible(
"//section[@class='aside__filter-group']//span[contains(text(), '" +
this.filterGroups[i] +
"')]/../button[contains(text(), 'Show top 5')]"
this.showTop5Locator(this.filterGroups[i]), 30
);
}
}
},

async _getData(row, column) {
const percentage = await I.grabTextFrom(
"//table//tr[@ng-reflect-router-link='details/," +
"//table//tr[@ng-reflect-router-link='details/," +
(row - 1) +
"']//app-qan-table-cell[" +
column +
']//div[1]//div[3]'
);
const value = await I.grabTextFrom(
"//table//tr[@ng-reflect-router-link='details/," +
"//table//tr[@ng-reflect-router-link='details/," +
(row - 1) +
"']//app-qan-table-cell[" +
column +
']//div[1]//div[2]'
);

return { percentage: percentage, val: value };
return {percentage: percentage, val: value};
},

async getDetailsData(row) {
Expand All @@ -233,7 +229,7 @@ module.exports = {
async waitForResponsePath(path) {
await I.waitForResponse(request => {
const url = require('url');
const { pathname } = url.parse(request.url(), true);
const {pathname} = url.parse(request.url(), true);
return path === pathname;
}, 60);
},
Expand Down Expand Up @@ -360,9 +356,9 @@ module.exports = {
async checkFiltersMatchSearch(searchString) {
const remainingFilters = await I.grabTextFrom('.checkbox-container__label-text');
assert.equal(
detailsQueryTimeData.percentage.indexOf(queryTimeData.percentage) > -1,
true,
"Details Query Time Percentage Doesn't Match expected " +
detailsQueryTimeData.percentage.indexOf(queryTimeData.percentage) > -1,
true,
"Details Query Time Percentage Doesn't Match expected " +
detailsQueryTimeData.percentage +
' to contain ' +
queryTimeData.percentage
Expand All @@ -377,9 +373,9 @@ module.exports = {
async checkMetricsListMatchesSearch(searchString) {
const remainingMetrics = await I.grabTextFrom('.ant-select-dropdown-menu-item');
assert.equal(
detailsQueryTimeData.val.indexOf(queryTimeData.val) > -1,
true,
"Details Query Time value Doesn't Match expected " +
detailsQueryTimeData.val.indexOf(queryTimeData.val) > -1,
true,
"Details Query Time value Doesn't Match expected " +
detailsQueryTimeData.val +
' to contain ' +
queryTimeData.val
Expand Down Expand Up @@ -593,7 +589,7 @@ module.exports = {

async getPagesCount() {
const pagesCount =
"//ul[@data-qa='qan-pagination']//li[contains(@class,'ant-pagination-item')][last()]//a";
"//ul[@data-qa='qan-pagination']//li[contains(@class,'ant-pagination-item')][last()]//a";
const pages = await I.grabTextFrom(pagesCount);
return pages;
},
Expand Down Expand Up @@ -634,15 +630,15 @@ module.exports = {
async verifyAvgQueryTime() {
// eslint-disable-next-line max-len
assert.equal(
await I.grabTextFrom(this.fields.overviewRowQueryCount),
await I.grabTextFrom(this.fields.qps),
'Query Count value in Overview and Detail should match'
await I.grabTextFrom(this.fields.overviewRowQueryCount),
await I.grabTextFrom(this.fields.qps),
'Query Count value in Overview and Detail should match'
);
// eslint-disable-next-line max-len
assert.equal(
await I.grabTextFrom(this.fields.overviewRowQueryTime),
await I.grabTextFrom(this.fields.queryTimeDetail),
'Query Time value in Overview and Detail should match'
await I.grabTextFrom(this.fields.overviewRowQueryTime),
await I.grabTextFrom(this.fields.queryTimeDetail),
'Query Time value in Overview and Detail should match'
);
let [perQueryStats, perQueryUnit] = (await I.grabTextFrom(this.fields.queryTimeDetail)).split(' ');
if (perQueryUnit == 'ms') {
Expand Down Expand Up @@ -684,15 +680,15 @@ module.exports = {
// eslint-disable-next-line max-len
if (sortOrder === 'down') {
assert.equal(
metricValue >= metricValueSecond,
true,
`Descending Sort of ${metricName} is Wrong Please check`
metricValue >= metricValueSecond,
true,
`Descending Sort of ${metricName} is Wrong Please check`
);
} else {
assert.equal(
metricValue <= metricValueSecond,
true,
`Ascending Sort of ${metricName} is Wrong Please check`
metricValue <= metricValueSecond,
true,
`Ascending Sort of ${metricName} is Wrong Please check`
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions pmm-app/tests/databaseChecks_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ Scenario(
{href: `${config.url}${pmmSettingsPage.url}`});
}
);
//Skipping test because of random failings, needs investigation
xScenario(

Scenario(
'PMM-T233 PMM-T234 Verify user is able to access PMM Database Checks through UI and with URL [critical] @not-pr-pipeline',
async (I, adminPage, databaseChecksPage, pmmSettingsPage, settingsAPI) => {
await settingsAPI.apiEnableSTT();
I.amOnPage(pmmSettingsPage.url);
pmmSettingsPage.waitForPmmSettingsPageLoaded();
adminPage.selectItemFromPMMDropdown('PMM Database Checks');
await adminPage.selectItemFromPMMDropdown('PMM Database Checks');
I.waitForVisible(databaseChecksPage.fields.dbCheckPanelSelector, 30);
I.amOnPage(databaseChecksPage.url);
I.waitForVisible(databaseChecksPage.fields.dbCheckPanelSelector, 30);
Expand Down
20 changes: 9 additions & 11 deletions pmm-app/tests/pages/adminPage.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// eslint-disable-next-line no-undef
const { I } = inject();
const {I} = inject();
const assert = require('assert');

module.exports = {
Expand All @@ -15,20 +15,18 @@ module.exports = {
discardChanges: '//button[@ng-click=\'ctrl.discard()\']',
metricTitle: '//div[@class=\'panel-title\']',
reportTitleWithNA:
'//span[contains(text(), \'N/A\')]//ancestor::div[contains(@class,\'panel-container\')]//span[contains(@class,\'panel-title-text\')]',
'//span[contains(text(), \'N/A\')]//ancestor::div[contains(@class,\'panel-container\')]//span[contains(@class,\'panel-title-text\')]',
// eslint-disable-next-line no-undef
pmmDropdownMenuSelector: locate('a[data-toggle="dropdown"] > span').withText('PMM')
},

// introducing methods
dropdownMenuItemLocator(title) {
// eslint-disable-next-line no-undef
return locate('ul > li > a').withText(title);
},

selectItemFromPMMDropdown(title) {
async selectItemFromPMMDropdown(title) {
title = `//li/a[text()='${title}']`;
I.click(this.fields.pmmDropdownMenuSelector);
I.click(this.dropdownMenuItemLocator(title));
I.waitForVisible(title, 30);
I.click(title);
},

async navigateToDashboard(folderName, dashboardName) {
Expand Down Expand Up @@ -112,9 +110,9 @@ module.exports = {
const reportTitle = await I.grabTextFrom(this.fields.reportTitleWithNA);

assert.equal(
numOfElements > number,
false,
`${numOfElements} Reports with N/A found on dashboard ${reportTitle}`
numOfElements > number,
false,
`${numOfElements} Reports with N/A found on dashboard ${reportTitle}`
);
}
},
Expand Down
19 changes: 10 additions & 9 deletions pmm-app/tests/pages/dashboardPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,10 @@ module.exports = {
],
serviceName:
"//label[contains(text(), 'Service Name')]/following-sibling::value-select-dropdown/descendant::a[@class='variable-value-link']",
urlWithRDSFilter: 'graph/d/mysql-instance-overview/mysql-instances-overview?orgId=1&'
+ 'from=now-5m&to=now&refresh=1m&var-interval=$__auto_interval_interval&var-region=All&'
+ 'var-environment=All&var-cluster=rds56-cluster&var-replication_set=All&var-az=&'
+ 'var-node_type=All&var-node_model=&var-database=All&var-service_type=All&var-schema=All',
},

fields: {
Expand Down Expand Up @@ -489,16 +493,13 @@ module.exports = {
I.waitForElement(this.fields.metricTitle, 30);
},

async verifyExisitngServiceName(serviceName) {
I.waitForElement(this.mySQLInstanceOverview.serviceName, 30);
I.click(this.mySQLInstanceOverview.serviceName);
const existingFilter =
"//span[@class='variable-option-icon']/following-sibling::span[contains(text(), '" +
serviceName +
"')]";
I.seeElement(existingFilter);
expandFilters(filterType) {
const filterLocator = `//label[contains(text(), '${filterType}')]/following-sibling::value-select-dropdown`;
I.waitForElement(filterLocator, 30);
I.click(filterLocator);
return filterLocator
},

async applyFilter(filterName, filterValue) {
// eslint-disable-next-line max-len
const filterSelector = `(//a[@class='variable-value-link']//ancestor::div//label[contains(text(),'${filterName}')])[1]//parent::div//a[@ng-click]`;
Expand Down
12 changes: 6 additions & 6 deletions pmm-app/tests/pages/remoteInstancesPage.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ module.exports = {
// setting locators
url: 'graph/d/pmm-add-instance/pmm-add-instance?orgId=1',
addMySQLRemoteURL: 'graph/d/pmm-add-instance/pmm-add-instance?instance_type=mysql',
dashboardMySQLOverviewWithFilters:
'graph/d/mysql-instance-overview/mysql-instances-overview?orgId=1&'
+ 'from=now-5m&to=now&refresh=1m&var-interval=$__auto_interval_interval&var-region=us-east-1&var-environment='
+ 'RDS%20MySQL%205.6&var-cluster=rds56-cluster&var-replication_set=rds56-replication&var-node_name=rds-mysql56'
+ '&var-service_name=rds-mysql56&&var-az=us-east-1c&var-node_type=remote_rds&var-node_model=&var-database=All'
+ '&var-service_type=&var-schema=',
rds: {
'Service Name': 'rds-mysql56',
'Environment': 'RDS MySQL 5.6',
'Replication Set': 'rds56-replication',
'Cluster': 'rds56-cluster'
},
fields: {
pageHeaderText: 'PMM Add Instance',
iframe: '//div[@class=\'panel-content\']//iframe',
Expand Down
Loading

0 comments on commit 1a793c3

Please sign in to comment.