OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
[31617] Re-enable group sums rendering
Oliver Günther558bfc5e74bf
diff --git a/frontend/src/app/components/schemas/schema-cache.service.ts b/frontend/src/app/components/schemas/schema-cache.service.tsindex ffd2b6f5005..cc9d2438fb4 100644--- a/frontend/src/app/components/schemas/schema-cache.service.ts+++ b/frontend/src/app/components/schemas/schema-cache.service.ts@@ -25,64 +25,68 @@//// See docs/COPYRIGHT.rdoc for more details.// ++-import {InputState, State} from 'reactivestates';+import {InputState, MultiInputState, State} from 'reactivestates';import {States} from '../states.service';import {HalResource} from "core-app/modules/hal/resources/hal-resource";import {Injectable} from '@angular/core';import {SchemaResource} from 'core-app/modules/hal/resources/schema-resource';import {HalResourceService} from 'core-app/modules/hal/services/hal-resource.service';+import {StateCacheService} from "core-components/states/state-cache.service";@Injectable()-export class SchemaCacheService {+export class SchemaCacheService extends StateCacheService<SchemaResource>{constructor(readonly states:States,readonly halResourceService:HalResourceService) {+ super();}- /**- * Ensure the given schema identified by its href is currently loaded.- * @param href The schema's href.- * @return A promise with the loaded schema.- */- ensureLoaded(resource:HalResource):Promise<unknown> {- const state = this.state(resource);+ public state(id:string|HalResource):State<SchemaResource> {+ let href:string;- if (state.hasValue()) {- return Promise.resolve(state.value);+ if (id instanceof HalResource) {+ href = this.getSchemaHref(id);} else {- return this.load(resource).valuesPromise() as Promise<unknown>;+ href = id;}++ return super.state(href);}- /**- * Get the associated schema state of the work package- * without initializing a new resource.- */- state(resource:HalResource):InputState<SchemaResource> {- const schema = resource.$links.schema;+ public getSchemaHref(resource:HalResource):string {+ let href = resource.$links.schema?.href;- if (!schema) {- throw `Resource ${resource} has no schema!`;+ if (!href) {+ throw new Error(`Resource ${resource} has no schema to load.`);}- return this.states.schemas.get(schema.href!);+ return href;}/**- * Load the associated schema for the given work package, if needed.+ * Ensure the given schema identified by its href is currently loaded.+ * @param resource The resource with a schema property or a string to the schema href.+ * @return A promise with the loaded schema.*/- load(resource:HalResource, forceUpdate = false):State<SchemaResource> {- const state = this.state(resource);+ ensureLoaded(resource:HalResource):Promise<SchemaResource> {+ return this.require(this.getSchemaHref(resource));+ }- if (forceUpdate) {- state.clear();- }+ /**+ * Load the associated schema for the given work package, if needed.+ */+ load(href:string, forceUpdate = false):Promise<SchemaResource> {+ return this+ .halResourceService+ .get<SchemaResource>(href)+ .toPromise();+ }- state.putFromPromiseIfPristine(() => {- const schemaResource = this.halResourceService.createLinkedResource(resource, 'schema', resource.$links.schema.$link);- return schemaResource.$load() as any;- });+ protected loadAll(hrefs:string[]):Promise<unknown|undefined> {+ return Promise.all(hrefs.map(href => this.load(href)));+ }- return state;+ protected get multiState():MultiInputState<SchemaResource> {+ return this.states.schemas;}}diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.tsnew file mode 100644index 00000000000..3b22355e3d1--- /dev/null+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/group-sums-builder.ts@@ -0,0 +1,80 @@+import {GroupObject} from 'core-app/modules/hal/resources/wp-collection-resource';+import {InjectField} from "core-app/helpers/angular/inject-field.decorator";+import {SingleRowBuilder} from "core-components/wp-fast-table/builders/rows/single-row-builder";+import {IFieldSchema} from "core-app/modules/fields/field.base";+import {SchemaResource} from "core-app/modules/hal/resources/schema-resource";+import {IsolatedQuerySpace} from "core-app/modules/work_packages/query-space/isolated-query-space";+import {SchemaCacheService} from "core-components/schemas/schema-cache.service";+import {DisplayFieldService} from "core-app/modules/fields/display/display-field.service";++export class GroupSumsBuilder extends SingleRowBuilder {++ @InjectField() readonly querySpace:IsolatedQuerySpace;+ @InjectField() readonly schemaCache:SchemaCacheService;+ @InjectField() readonly displayFieldService:DisplayFieldService;++ private text = {+ sum: this.I18n.t('js.label_sum')+ };++ public buildSumsRow(group:GroupObject) {+ const tr:HTMLTableRowElement = document.createElement('tr');+ tr.classList.add('wp-table--sums-row', 'wp-table--row');++ this.renderColumns(group.sums, tr);++ return tr;+ }++ public renderColumns(sums:{[key:string]:any}, tr:HTMLTableRowElement) {+ this.augmentedColumns.forEach((column, i:number) => {+ const td = document.createElement('td');+ const div = this.renderContent(sums, column.id, this.sumsSchema[column.id]);++ if (i === 0) {+ this.appendFirstLabel(div);+ }++ td.appendChild(div);+ tr.append(td);+ });+ }++ private appendFirstLabel(div:HTMLElement) {+ const span = document.createElement('span');+ span.textContent = `${this.text.sum}`;+ div.prepend(span);+ }++ private get sumsSchema():SchemaResource {+ // The schema is ensured to be loaded by wpViewAdditionalElementsService+ const results = this.querySpace.results.value!;+ const href = results.sumsSchema!.$href!;++ return this.schemaCache.state(href).value!;+ }++ private renderContent(sums:any, name:string, fieldSchema:IFieldSchema) {+ const div = document.createElement('div');+ div.classList.add('wp-table--sum-container', name);++ // The field schema for this element may be undefined+ // because it is not summable.+ if (!fieldSchema) {+ return div;+ }++ const field = this.displayFieldService.getField(+ sums,+ name,+ fieldSchema,+ { injector: this.injector, container: 'table', options: {} }+ );++ if (!field.isEmpty()) {+ field.render(div, field.valueString);+ }++ return div;+ }+}diff --git a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.tsindex 483d531ea6d..48887ecbf0d 100644--- a/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts+++ b/frontend/src/app/components/wp-fast-table/builders/modes/grouped/grouped-render-pass.ts@@ -9,9 +9,13 @@ import {groupClassNameFor, GroupHeaderBuilder} from './group-header-builder';import {groupByProperty, groupedRowClassName} from './grouped-rows-helpers';import {GroupObject} from 'core-app/modules/hal/resources/wp-collection-resource';import {collapsedRowClass} from "core-components/wp-fast-table/builders/modes/grouped/grouped-classes.constants";+import {GroupSumsBuilder} from "core-components/wp-fast-table/builders/modes/grouped/group-sums-builder";+import {DisplayFieldRenderer} from "core-components/wp-edit-form/display-field-renderer";export class GroupedRenderPass extends PlainRenderPass {+ private sumsBuilder = new GroupSumsBuilder(this.injector, this.workPackageTable);+constructor(public readonly injector:Injector,public workPackageTable:WorkPackageTable,public groups:GroupObject[],@@ -26,11 +30,19 @@ export class GroupedRenderPass extends PlainRenderPass {*/protected doRender() {let currentGroup:GroupObject | null = null;- this.workPackageTable.originalRows.forEach((wpId:string) => {+ const length = this.workPackageTable.originalRows.length;+ this.workPackageTable.originalRows.forEach((wpId:string, index:number) => {let row = this.workPackageTable.originalRowIndex[wpId];let nextGroup = this.matchingGroup(row.object);+ let groupsChanged = currentGroup !== nextGroup;++ // Render the sums row+ if (currentGroup && groupsChanged) {+ this.renderSumsRow(currentGroup);+ }- if (nextGroup && currentGroup !== nextGroup) {+ // Render the next group row+ if (nextGroup && groupsChanged) {const groupClass = groupClassNameFor(nextGroup);let rowElement = this.headerBuilder.buildGroupRow(nextGroup, this.colspan);this.appendNonWorkPackageRow(rowElement, groupClass);@@ -40,6 +52,11 @@ export class GroupedRenderPass extends PlainRenderPass {row.group = currentGroup;this.buildSingleRow(row);});++ // Render the last sums row+ if (currentGroup) {+ this.renderSumsRow(currentGroup);+ }}/**@@ -118,4 +135,17 @@ export class GroupedRenderPass extends PlainRenderPass {tr.classList.add(...additionalClasses);this.appendRow(row.object, tr, additionalClasses, hidden);}++ /**+ * Render the sums row for the current group+ */+ private renderSumsRow(group:GroupObject) {+ if (!group.sums) {+ return;+ }++ const groupClass = groupClassNameFor(group);+ let rowElement = this.sumsBuilder.buildSumsRow(group);+ this.appendNonWorkPackageRow(rowElement, groupClass);+ }}diff --git a/frontend/src/app/components/wp-list/wp-states-initialization.service.ts b/frontend/src/app/components/wp-list/wp-states-initialization.service.tsindex c029c1e9279..b72f4465d5a 100644--- a/frontend/src/app/components/wp-list/wp-states-initialization.service.ts+++ b/frontend/src/app/components/wp-list/wp-states-initialization.service.ts@@ -114,7 +114,7 @@ export class WorkPackageStatesInitializationService {this.wpTableRelationColumns.initialize(query, results);- this.wpTableAdditionalElements.initialize(results.elements);+ this.wpTableAdditionalElements.initialize(query, results);this.wpTableOrder.initialize(query, results);diff --git a/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts b/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.tsindex 31a42c98c58..0ce14bb4c2b 100644--- a/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts+++ b/frontend/src/app/components/wp-table/wp-table-sums-row/wp-table-sums-row.directive.ts@@ -26,7 +26,7 @@// See docs/COPYRIGHT.rdoc for more details.// ++-import {AfterViewInit, Directive, ElementRef, Injector} from '@angular/core';+import {AfterViewInit, Directive, ElementRef, Injector, Input} from '@angular/core';import {takeUntil} from 'rxjs/operators';import {I18nService} from 'core-app/modules/common/i18n/i18n.service';import {SchemaResource} from 'core-app/modules/hal/resources/schema-resource';@@ -39,21 +39,28 @@ import {QueryColumn} from "core-components/wp-query/query-column";import {WorkPackageViewColumnsService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-columns.service";import {WorkPackageViewSumService} from "core-app/modules/work_packages/routing/wp-view-base/view-services/wp-view-sum.service";import {combineLatest} from "rxjs";+import {GroupSumsBuilder} from "core-components/wp-fast-table/builders/modes/grouped/group-sums-builder";+import {WorkPackageTable} from "core-components/wp-fast-table/wp-fast-table";+import {SchemaCacheService} from "core-components/schemas/schema-cache.service";@Directive({selector: '[wpTableSumsRow]'})export class WorkPackageTableSumsRowController implements AfterViewInit {+ @Input('wpTableSumsRow-table') workPackageTable:WorkPackageTable;+private text:{ sum:string };private $element:JQuery;+ private groupSumsBuilder:GroupSumsBuilder;+constructor(readonly injector:Injector,readonly elementRef:ElementRef,readonly querySpace:IsolatedQuerySpace,readonly states:States,- readonly displayFieldService:DisplayFieldService,+ readonly schemaCache:SchemaCacheService,readonly wpTableColumns:WorkPackageViewColumnsService,readonly wpTableSums:WorkPackageViewSumService,readonly I18n:I18nService) {@@ -76,7 +83,7 @@ export class WorkPackageTableSumsRowController implements AfterViewInit {).subscribe(([columns, sum, resource]) => {if (sum && resource.sumsSchema) {- resource.sumsSchema.$load().then((schema:SchemaResource) => {+ this.schemaCache.require(resource.sumsSchema.$href!).then((schema:SchemaResource) => {this.refresh(columns, resource, schema);});} else {@@ -95,52 +102,7 @@ export class WorkPackageTableSumsRowController implements AfterViewInit {}private render(columns:QueryColumn[], resource:WorkPackageCollectionResource, schema:SchemaResource) {- // build- columns.forEach((column, i:number) => {- const td = document.createElement('td');- td.classList.add('wp-table--sum-container');- const div = this.renderContent(resource.totalSums!, column.id, schema[column.id]);-- if (i === 0) {- this.appendFirstLabel(div);- // colspan 2 for the d&d column- td.setAttribute('colspan', '2');- }-- td.appendChild(div);- this.$element.append(td);- });-- // Append last empty td- this.$element.append(`<td><div class="generic-table--footer-outer"></div></td>`);- }-- private renderContent(sums:any, name:string, fieldSchema:IFieldSchema) {- const div = document.createElement('div');-- // The field schema for this element may be undefined- // because it is not summable.- if (!fieldSchema) {- return div;- }-- const field = this.displayFieldService.getField(- sums,- name,- fieldSchema,- { injector: this.injector, container: 'table', options: {} }- );-- if (!field.isEmpty()) {- field.render(div, field.valueString);- }-- return div;- }-- private appendFirstLabel(div:HTMLElement) {- const span = document.createElement('span');- span.textContent = `${this.text.sum}`;- jQuery(div).prepend(span);+ this.groupSumsBuilder = new GroupSumsBuilder(this.injector, this.workPackageTable);+ this.groupSumsBuilder.renderColumns(resource.totalSums!, this.elementRef.nativeElement);}}diff --git a/frontend/src/app/components/wp-table/wp-table.directive.html b/frontend/src/app/components/wp-table/wp-table.directive.htmlindex 550ad295c0a..7ff375bd132 100644--- a/frontend/src/app/components/wp-table/wp-table.directive.html+++ b/frontend/src/app/components/wp-table/wp-table.directive.html@@ -61,7 +61,9 @@></tbody><tfoot>- <tr wpTableSumsRow></tr>+ <tr class="wp-table--sums-row wp-table--row"+ wpTableSumsRow+ [wpTableSumsRow-table]="workPackageTable"></tr></tfoot></table></div>diff --git a/frontend/src/app/modules/hal/resources/wp-collection-resource.ts b/frontend/src/app/modules/hal/resources/wp-collection-resource.tsindex cff1232cb18..5cdb1c9ac76 100644--- a/frontend/src/app/modules/hal/resources/wp-collection-resource.ts+++ b/frontend/src/app/modules/hal/resources/wp-collection-resource.ts@@ -59,6 +59,7 @@ export interface GroupObject {collapsed?:boolean;index:number;identifier:string;+ sums:{[attribute:string]:number|null};href:{ href:string }[];_links:{valueLink:{ href:string }[];diff --git a/frontend/src/app/modules/router/openproject.routes.ts b/frontend/src/app/modules/router/openproject.routes.tsindex ce951b3d851..e049928ad81 100644--- a/frontend/src/app/modules/router/openproject.routes.ts+++ b/frontend/src/app/modules/router/openproject.routes.ts@@ -162,8 +162,8 @@ export function initializeUiRouterListeners(injector:Injector) {let wpBase = document.querySelector(appBaseSelector);// Uncomment to trace route changes- const uiRouter = injector.get(UIRouter);- uiRouter.trace.enable();+ // const uiRouter = injector.get(UIRouter);+ // uiRouter.trace.enable();// Apply classes from bodyClasses in each state definition// This was defined as onEnter, onExit functions in each state beforediff --git a/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts b/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.tsindex 1ad79d9809b..90b514dc460 100644--- a/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts+++ b/frontend/src/app/modules/work_packages/routing/wp-view-base/view-services/wp-view-additional-elements.service.ts@@ -36,6 +36,9 @@ import {HalResourceService} from 'core-app/modules/hal/services/hal-resource.serimport {WorkPackageCacheService} from "core-components/work-packages/work-package-cache.service";import {RelationsStateValue, WorkPackageRelationsService} from "core-components/wp-relations/wp-relations.service";import {WorkPackageNotificationService} from "core-app/modules/work_packages/notifications/work-package-notification.service";+import {WorkPackageCollectionResource} from "core-app/modules/hal/resources/wp-collection-resource";+import {QueryResource} from "core-app/modules/hal/resources/query-resource";+import {SchemaCacheService} from "core-components/schemas/schema-cache.service";@Injectable()export class WorkPackageViewAdditionalElementsService {@@ -46,14 +49,18 @@ export class WorkPackageViewAdditionalElementsService {readonly notificationService:WorkPackageNotificationService,readonly halResourceService:HalResourceService,readonly wpCacheService:WorkPackageCacheService,+ readonly schemaCache:SchemaCacheService,readonly wpRelations:WorkPackageRelationsService) {}- public initialize(rows:WorkPackageResource[]) {+ public initialize(query:QueryResource, results:WorkPackageCollectionResource) {+ const rows = results.elements;+// Add relations to the stackPromise.all([this.requireInvolvedRelations(rows.map(el => el.id!)),- this.requireHierarchyElements(rows)+ this.requireHierarchyElements(rows),+ this.requireSumsSchema(results)]).then((results:string[][]) => {this.loadAdditional(_.flatten(results));});@@ -118,4 +125,15 @@ export class WorkPackageViewAdditionalElementsService {return ids;}++ private requireSumsSchema(results:WorkPackageCollectionResource):Promise<string[]> {+ if (results.sumsSchema) {+ return this+ .schemaCache+ .require(results.sumsSchema.$href!)+ .then(() => []);+ }++ return Promise.resolve([]);+ }}diff --git a/frontend/src/global_styles/content/_table.sass b/frontend/src/global_styles/content/_table.sassindex 10ec8220d3a..ab114006c6a 100644--- a/frontend/src/global_styles/content/_table.sass+++ b/frontend/src/global_styles/content/_table.sass@@ -126,15 +126,7 @@ table.generic-tabletfoottrbackground: #f6f7f8- border:- top: 0- bottom: 0- height: 0td- height: 0- padding:- top: 0- bottom: 0font-weight: boldtbodydiff --git a/frontend/src/global_styles/content/work_packages/_table_content.sass b/frontend/src/global_styles/content/work_packages/_table_content.sassindex 5f03402e12f..40ea25158d4 100644--- a/frontend/src/global_styles/content/work_packages/_table_content.sass+++ b/frontend/src/global_styles/content/work_packages/_table_content.sass@@ -55,6 +55,14 @@.wp-table--cell-tddisplay: none !important+// Sums row background+.wp-table--sums-row+ background: #f6f7f8++.wp-table--sum-container+ font-weight: bold+ padding: 3px 6px+.work-package-table--container table.generic-table tbody tdpadding-left: 0padding-top: 0@@ -74,7 +82,6 @@&:hover .inline-edit--active-field.-error:hoverborder-color: var(--content-form-danger-zone-bg-color)-//.wp-table--faulty-query-iconcolor: var(--content-form-danger-zone-bg-color)diff --git a/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass b/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sassindex b51059052ff..93d5ee9acae 100644--- a/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass+++ b/frontend/src/global_styles/content/work_packages/inplace_editing/_display_fields.sass@@ -101,11 +101,10 @@@include wp-table--placeholder-time-values// Sums in wp table-.wp-table--sum-container- .split-time-field- .-actual-value- @include wp-table--time-values- @include wp-table--actual-time-values+.wp-table--sum-container.split-time-field+ .-actual-value+ @include wp-table--time-values+ @include wp-table--actual-time-values// Editable fields cursordiff --git a/spec/features/work_packages/index_sums_spec.rb b/spec/features/work_packages/index_sums_spec.rbindex cfb248a1d9d..b074ff7ab64 100644--- a/spec/features/work_packages/index_sums_spec.rb+++ b/spec/features/work_packages/index_sums_spec.rb@@ -63,6 +63,7 @@ RSpec.feature 'Work package index sums', js: true dolet(:wp_table) { Pages::WorkPackagesTable.new(project) }let(:columns) { ::Components::WorkPackages::Columns.new }let(:modal) { ::Components::WorkPackages::TableConfigurationModal.new }+ let(:group_by) { ::Components::WorkPackages::GroupBy.new }before dologin_as(admin)@@ -90,6 +91,9 @@ RSpec.feature 'Work package index sums', js: true dowp_table.expect_work_package_listed work_package_1, work_package_2+ # Expect the total sums row+ expect(page).to have_selector('.wp-table--sums-row', count: 1)+expect(page).to have_selector('.wp-table--sum-container', text: 'Sum')expect(page).to have_selector('.wp-table--sum-container', text: '25')expect(page).to have_selector('.wp-table--sum-container', text: '12')@@ -103,5 +107,26 @@ RSpec.feature 'Work package index sums', js: true doexpect(page).to have_selector('.wp-table--sum-container', text: '35')expect(page).to have_selector('.wp-table--sum-container', text: '12')expect(page).to have_selector('.wp-table--sum-container', text: '13.2')++ # Enable groups+ group_by.enable_via_menu 'Status'++ # Expect to have three sums rows no+ expect(page).to have_selector('.wp-table--sums-row', count: 3)++ # First status row+ expect(page).to have_selector('.wp-table--sum-container', text: '20 h')+ expect(page).to have_selector(".wp-table--sum-container.customField#{int_cf.id}", text: '5')+ expect(page).to have_selector(".wp-table--sum-container.customField#{float_cf.id}", text: '5.5')++ # Second status row+ expect(page).to have_selector('.wp-table--sum-container', text: '15 h')+ expect(page).to have_selector(".wp-table--sum-container.customField#{int_cf.id}", text: '7')+ expect(page).to have_selector(".wp-table--sum-container.customField#{float_cf.id}", text: '7.7')++ # Total sums row is unchanged+ expect(page).to have_selector('tfoot .wp-table--sum-container', text: '35')+ expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{int_cf.id}", text: '12')+ expect(page).to have_selector("tfoot .wp-table--sum-container.customField#{float_cf.id}", text: '13.2')endenddiff --git a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rbindex a8460d77076..eb74aa5ae6b 100644--- a/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb+++ b/spec/features/work_packages/table/hierarchy/hierarchy_parent_below_spec.rb@@ -132,7 +132,7 @@ describe 'Work Package table hierarchy parent below', js: true doexpect(page).to have_selector('.pagination--item.-current', text: '3')# Expect count to be correct (one additional parent shown)- expect(page).to have_selector('.wp-table--row', count: 4)+ expect(page).to have_selector('.wp--row', count: 4)# Double order result from regressionwp_table.expect_work_package_order(grandparent.id, parent.id, child.id, child2.id)diff --git a/spec/support/pages/work_packages/work_packages_table.rb b/spec/support/pages/work_packages/work_packages_table.rbindex b735c42527c..1ebb5466c18 100644--- a/spec/support/pages/work_packages/work_packages_table.rb+++ b/spec/support/pages/work_packages/work_packages_table.rb@@ -97,7 +97,7 @@ module Pagesdef expect_work_package_order(*ids)retry_block do- rows = page.all '.wp-table--row'+ rows = page.all '.work-package-table .wp--row'expected = ids.map { |el| el.is_a?(WorkPackage) ? el.id.to_s : el.to_s }found = rows.map { |el| el['data-work-package-id'] }