mirror of
https://github.com/ansible/awx.git
synced 2026-03-20 02:17:37 -02:30
fix badge updating and xss e2e test for projects list updates
This commit is contained in:
@@ -4,7 +4,7 @@ function IndexProjectsController ($scope, strings, dataset) {
|
|||||||
vm.count = dataset.data.count;
|
vm.count = dataset.data.count;
|
||||||
|
|
||||||
$scope.$on('updateCount', (e, count) => {
|
$scope.$on('updateCount', (e, count) => {
|
||||||
if (count) {
|
if (typeof count === 'number') {
|
||||||
vm.count = count;
|
vm.count = count;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -27,6 +27,9 @@ function projectsListController (
|
|||||||
};
|
};
|
||||||
vm.dataset = Dataset.data;
|
vm.dataset = Dataset.data;
|
||||||
vm.projects = Dataset.data.results;
|
vm.projects = Dataset.data.results;
|
||||||
|
$scope.$watch('vm.dataset.count', () => {
|
||||||
|
$scope.$emit('updateCount', vm.dataset.count, 'projects');
|
||||||
|
});
|
||||||
// build tooltips
|
// build tooltips
|
||||||
_.forEach(vm.projects, buildTooltips);
|
_.forEach(vm.projects, buildTooltips);
|
||||||
$rootScope.flashMessage = null;
|
$rootScope.flashMessage = null;
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
</div>
|
</div>
|
||||||
<at-list results="vm.projects">
|
<at-list results="vm.projects">
|
||||||
<at-row ng-repeat="project in vm.projects"
|
<at-row ng-repeat="project in vm.projects"
|
||||||
ng-class="{'at-Row--active': (project.id === vm.activeId)}">
|
ng-class="{'at-Row--active': (project.id === vm.activeId)}"
|
||||||
|
id="row-{{ project.id }}">
|
||||||
<div class="at-Row-items">
|
<div class="at-Row-items">
|
||||||
<at-row-item
|
<at-row-item
|
||||||
status="{{ project.statusIcon }}"
|
status="{{ project.statusIcon }}"
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ module.exports = {
|
|||||||
projects.waitForElementNotVisible('div.spinny');
|
projects.waitForElementNotVisible('div.spinny');
|
||||||
|
|
||||||
projects.section.list.expect.element('@badge').text.equal('1');
|
projects.section.list.expect.element('@badge').text.equal('1');
|
||||||
projects.expect.element(`#projects_table tr[id="${data.project.id}"]`).visible;
|
projects.expect.element(`#row-${data.project.id}`).visible;
|
||||||
projects.expect.element('i[class*="copy"]').visible;
|
projects.expect.element('i[class*="copy"]').visible;
|
||||||
projects.expect.element('i[class*="copy"]').enabled;
|
projects.expect.element('i[class*="copy"]').enabled;
|
||||||
|
|
||||||
|
|||||||
@@ -508,36 +508,36 @@ module.exports = {
|
|||||||
client.expect.element('#project_form').visible;
|
client.expect.element('#project_form').visible;
|
||||||
},
|
},
|
||||||
'check project list for unsanitized content': client => {
|
'check project list for unsanitized content': client => {
|
||||||
const itemRow = `#projects_table tr[id="${data.project.id}"]`;
|
const itemRow = `#row-${data.project.id}`;
|
||||||
const itemName = `${itemRow} td[class*="name-"] a`;
|
const itemName = `${itemRow} .at-RowItem-header`;
|
||||||
|
|
||||||
client.expect.element('div[class*="at-Panel"] smart-search').visible;
|
client.expect.element('.at-Panel smart-search').visible;
|
||||||
client.expect.element('div[class*="at-Panel"] smart-search input').enabled;
|
client.expect.element('.at-Panel smart-search input').enabled;
|
||||||
|
|
||||||
client.sendKeys('div[class*="at-Panel"] smart-search input', `id:>${data.project.id - 1} id:<${data.project.id + 1}`);
|
client.sendKeys('.at-Panel smart-search input', `id:>${data.project.id - 1} id:<${data.project.id + 1}`);
|
||||||
client.sendKeys('div[class*="at-Panel"] smart-search input', client.Keys.ENTER);
|
client.sendKeys('.at-Panel smart-search input', client.Keys.ENTER);
|
||||||
|
|
||||||
client.expect.element('div.spinny').visible;
|
|
||||||
client.expect.element('div.spinny').not.visible;
|
client.expect.element('div.spinny').not.visible;
|
||||||
|
|
||||||
client.expect.element('.List-titleBadge').text.equal('1');
|
client.expect.element('.at-Panel-headingTitleBadge').text.equal('1');
|
||||||
client.expect.element(itemName).visible;
|
client.expect.element(itemName).visible;
|
||||||
|
|
||||||
client.moveToElement(itemName, 0, 0, () => {
|
// TODO: uncomment when tooltips are added
|
||||||
client.expect.element(itemName).attribute('aria-describedby');
|
// client.moveToElement(itemName, 0, 0, () => {
|
||||||
|
// client.expect.element(itemName).attribute('aria-describedby');
|
||||||
client.getAttribute(itemName, 'aria-describedby', ({ value }) => {
|
//
|
||||||
const tooltip = `#${value}`;
|
// client.getAttribute(itemName, 'aria-describedby', ({ value }) => {
|
||||||
|
// const tooltip = `#${value}`;
|
||||||
client.expect.element(tooltip).present;
|
//
|
||||||
client.expect.element(tooltip).visible;
|
// client.expect.element(tooltip).present;
|
||||||
|
// client.expect.element(tooltip).visible;
|
||||||
client.expect.element('#xss').not.present;
|
//
|
||||||
client.expect.element('[class=xss]').not.present;
|
// client.expect.element('#xss').not.present;
|
||||||
client.expect.element(tooltip).attribute('innerHTML')
|
// client.expect.element('[class=xss]').not.present;
|
||||||
.contains('<div id="xss" class="xss">test</div>');
|
// client.expect.element(tooltip).attribute('innerHTML')
|
||||||
});
|
// .contains('<div id="xss" class="xss">test</div>');
|
||||||
});
|
// });
|
||||||
|
// });
|
||||||
|
|
||||||
client.click(`${itemRow} i[class*="trash"]`);
|
client.click(`${itemRow} i[class*="trash"]`);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user