0a47a95588
* ui: Add data-source component and related services (#6486) * ui: Add data-source component and related services: 1. DataSource component 2. Repository manager for retrieving repositories based on URIs 3. Blocking data service for injection to the data-source component to support blocking query types of data sources 4. 'Once' promise based data service for injection for potential fallback to old style promise based data (would need to be injected via an initial runtime variable) 5. Several utility functions taken from elsewhere - maybeCall - a replication of code from elsewhere for condition calling a function based on the result of a promise - restartWhenAvailable - used for restarting blocking queries when a tab is brought to the front - ifNotBlocking - to check if blocking is NOT enabled * Move to a different organization based on protocols * Don't call open twice when eager * Workaround new ember error for reading and writing at the same time * Add first draft of a README.mdx file
58 lines
1.8 KiB
JavaScript
58 lines
1.8 KiB
JavaScript
export default function(scenario, assert, find, currentPage, pauseUntil, pluralize) {
|
|
scenario
|
|
.then('pause until I see $number $model model[s]?', function(num, model) {
|
|
return pauseUntil(function(resolve, reject, retry) {
|
|
const len = currentPage()[pluralize(model)].filter(function(item) {
|
|
return item.isVisible;
|
|
}).length;
|
|
if (len === num) {
|
|
return resolve();
|
|
}
|
|
return retry();
|
|
}, `Expected ${num} ${model}s`);
|
|
})
|
|
.then(['I see $num $model model[s]?'], function(num, model) {
|
|
const len = currentPage()[pluralize(model)].filter(function(item) {
|
|
return item.isVisible;
|
|
}).length;
|
|
assert.equal(len, num, `Expected ${num} ${pluralize(model)}, saw ${len}`);
|
|
})
|
|
.then(['I see $num $model model[s]? on the $component component'], function(
|
|
num,
|
|
model,
|
|
component
|
|
) {
|
|
const obj = find(component);
|
|
const len = obj[pluralize(model)].filter(function(item) {
|
|
return item.isVisible;
|
|
}).length;
|
|
|
|
assert.equal(len, num, `Expected ${num} ${pluralize(model)}, saw ${len}`);
|
|
})
|
|
// TODO: I${ dont } see
|
|
.then([`I see $num $model model[s]? with the $property "$value"`], function(
|
|
// negate,
|
|
num,
|
|
model,
|
|
property,
|
|
value
|
|
) {
|
|
const len = currentPage()[pluralize(model)].filter(function(item) {
|
|
if (item.isVisible) {
|
|
let prop = item[property];
|
|
// cope with pageObjects that can have a multiple: true
|
|
if (!Array.isArray(prop)) {
|
|
prop = [prop];
|
|
}
|
|
return prop.includes(value);
|
|
}
|
|
return false;
|
|
}).length;
|
|
assert.equal(
|
|
len,
|
|
num,
|
|
`Expected ${num} ${pluralize(model)} with ${property} set to "${value}", saw ${len}`
|
|
);
|
|
});
|
|
}
|