40 lines
1.0 KiB
JavaScript
40 lines
1.0 KiB
JavaScript
class HighlightsComponent {
|
|
constructor(page) {
|
|
this.page = page;
|
|
}
|
|
|
|
highlightsContainer() {
|
|
return this.page.locator('.highlightsContainer');
|
|
}
|
|
|
|
requestedColumn() {
|
|
return this.highlightsContainer().locator('div').filter({ hasText: 'Requested' }).locator('+ div');
|
|
}
|
|
|
|
finishedColumn() {
|
|
return this.highlightsContainer().locator('div').filter({ hasText: 'Finished' }).locator('+ div');
|
|
}
|
|
|
|
async getRequestedItems() {
|
|
const items = await this.highlightsContainer().locator('div').filter({ hasText: /^\d+\s*\|/ }).all();
|
|
const result = [];
|
|
for (const item of items) {
|
|
const text = (await item.textContent()) || '';
|
|
result.push(text.trim());
|
|
}
|
|
return result;
|
|
}
|
|
|
|
async getFinishedItems() {
|
|
const items = await this.highlightsContainer().locator('div').filter({ hasText: /^\d+\s*\|/ }).all();
|
|
const result = [];
|
|
for (const item of items) {
|
|
const text = (await item.textContent()) || '';
|
|
result.push(text.trim());
|
|
}
|
|
return result;
|
|
}
|
|
}
|
|
|
|
module.exports = HighlightsComponent;
|