Merge pull request #9332 from hashicorp/b-ui/flaky-das-filter-tests

UI: Add missing feature fixture that was introduced while DAS filtering was being implemented
This commit is contained in:
Michael Lange 2020-11-11 17:04:47 -08:00 committed by GitHub
commit 9c01bf7530
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -358,6 +358,8 @@ module('Acceptance | optimize search and facets', function(hooks) {
setupMirage(hooks);
hooks.beforeEach(async function() {
server.create('feature', { name: 'Dynamic Application Sizing' });
server.create('node');
server.createList('namespace', 2);
@ -398,7 +400,10 @@ module('Acceptance | optimize search and facets', function(hooks) {
assert.equal(Optimize.card.slug.jobName, 'zzzzzz');
assert.equal(Optimize.search.placeholder, `Search ${Optimize.recommendationSummaries.length} recommendations...`);
assert.equal(
Optimize.search.placeholder,
`Search ${Optimize.recommendationSummaries.length} recommendations...`
);
await Optimize.search.fillIn('ooo');
@ -523,7 +528,11 @@ module('Acceptance | optimize search and facets', function(hooks) {
groupTaskCount: 2,
childrenCount: 0,
});
server.createList('job', 2, { status: 'dead', createRecommendations: true, childrenCount: 0 });
server.createList('job', 2, {
status: 'dead',
createRecommendations: true,
childrenCount: 0,
});
await Optimize.visit();
},
filter: (taskGroup, selection) => selection.includes(taskGroup.job.status),
@ -600,7 +609,8 @@ module('Acceptance | optimize search and facets', function(hooks) {
});
await Optimize.visit();
},
filter: (taskGroup, selection) => selection.find(prefix => taskGroup.job.name.startsWith(prefix)),
filter: (taskGroup, selection) =>
selection.find(prefix => taskGroup.job.name.startsWith(prefix)),
});
function testFacet(label, { facet, paramName, beforeEach, filter, expectedOptions }) {
@ -633,10 +643,13 @@ module('Acceptance | optimize search and facets', function(hooks) {
const selection = [option.key];
const sortedRecommendations = server.db.recommendations
.sortBy('submitTime').reverse();
const sortedRecommendations = server.db.recommendations.sortBy('submitTime').reverse();
const recommendationTaskGroups = server.schema.tasks.find(sortedRecommendations.mapBy('taskId').uniq()).models.mapBy('taskGroup').uniqBy('id').filter(group => filter(group, selection));
const recommendationTaskGroups = server.schema.tasks
.find(sortedRecommendations.mapBy('taskId').uniq())
.models.mapBy('taskGroup')
.uniqBy('id')
.filter(group => filter(group, selection));
Optimize.recommendationSummaries.forEach((summary, index) => {
const group = recommendationTaskGroups[index];
@ -657,10 +670,13 @@ module('Acceptance | optimize search and facets', function(hooks) {
await option2.toggle();
selection.push(option2.key);
const sortedRecommendations = server.db.recommendations
.sortBy('submitTime').reverse();
const sortedRecommendations = server.db.recommendations.sortBy('submitTime').reverse();
const recommendationTaskGroups = server.schema.tasks.find(sortedRecommendations.mapBy('taskId').uniq()).models.mapBy('taskGroup').uniqBy('id').filter(group => filter(group, selection));
const recommendationTaskGroups = server.schema.tasks
.find(sortedRecommendations.mapBy('taskId').uniq())
.models.mapBy('taskGroup')
.uniqBy('id')
.filter(group => filter(group, selection));
Optimize.recommendationSummaries.forEach((summary, index) => {
const group = recommendationTaskGroups[index];