Skip to content

Commit

Permalink
Merge branch 'OCD-4504' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
Ashwini More committed Mar 5, 2024
2 parents 9b15e0d + 156c2db commit 45c2639
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class ChangeRequestsPage extends CollectionPage {

async open() {
await openPage('#/administration/change-requests');
await (browser.waitUntil(async () => (await $(this.elements.searchResultsHeader)).isDisplayed()));
await (browser.waitUntil(async () => (await $(this.elements.filterPanelToggle)).isDisplayed()));
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,35 +1,20 @@
import LoginComponent from '../../../components/login/login.po';
import { open } from '../../../utilities/hooks.async';

import ChangeRequestsPage from './change-requests.po';

let login;
let page;

beforeEach(async () => {
beforeAll(async () => {
page = new ChangeRequestsPage();
login = new LoginComponent();
await open('#/resources/overview');
await page.open();
});

describe('the Change Requests page', () => {
describe('when logged in as ONC', () => {
beforeEach(async () => {
beforeAll(async () => {
await login.logIn('onc');
await page.open();
});

afterEach(async () => {
await login.logOut();
});

it('should have table headers in a defined order', async () => {
const expectedHeaders = ['Developer', 'Request Type', 'Creation Date', 'Request Status', 'Time Since Last Status Change', 'Associated ONC-ACBs', 'Actions'];
const actualHeaders = await page.getTableHeaders();
await expect(actualHeaders.length).toBe(expectedHeaders.length, 'Found incorrect number of columns');
for (const [idx, header] of actualHeaders.entries()) {
await expect(await header.getText()).toBe(expectedHeaders[idx]);
}
});

it('should find a specific Rejected Change Request', async () => {
Expand All @@ -38,11 +23,21 @@ describe('the Change Requests page', () => {
const creationColumn = 2;
const developerName = 'Universal EHR, Inc.';
const creationTime = 'Apr 20, 2022 1:28:20 PM';
await page.clearFilter('Change Request Status', 'Pending Developer Action');
await page.clearFilter('Change Request Status', 'Pending ONC-ACB Action');
await page.setListFilter('currentStatusNames', 'Rejected');
await page.removeFilter('Change Request Status', 'Pending Developer Action');
await page.searchForText(searchTerm);
await expect(await page.getCellInRow(0, developerColumn)).toContain(developerName);
await expect(await page.getCellInRow(0, creationColumn)).toContain(creationTime);
expect(await page.getCellInRow(0, developerColumn)).toContain(developerName);
expect(await page.getCellInRow(0, creationColumn)).toContain(creationTime);
});

it('should have table headers in a defined order', async () => {
const expectedHeaders = ['Developer', 'Request Type', 'Creation Date', 'Request Status', 'Time Since Last Status Change', 'Associated ONC-ACBs', 'Actions'];
const actualHeaders = await page.getTableHeaders();
expect(actualHeaders.length).toBe(expectedHeaders.length, 'Found incorrect number of columns');
for (const [idx, header] of actualHeaders.entries()) {
expect(await header.getText()).toBe(expectedHeaders[idx]);
}
});
});
});
21 changes: 21 additions & 0 deletions e2e/pages/collections/collection.po.js
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,27 @@ class CollectionPage {
}
}
/* eslint-enable indent */

/* eslint-disable indent */
async clearFilter(category, value) {
await
(await
(await
(await
(await
(await
(await
(await
$(this.elements.filterChipsSection)
).$(`p=${category}`)
).parentElement()
).$(`span=${value}`)
).parentElement()
).$('svg')
).click()
);
}
/* eslint-enable indent */
}

export default CollectionPage;

0 comments on commit 45c2639

Please sign in to comment.