Skip to content

Commit 776ad77

Browse files
committed
wip
1 parent 0d573e8 commit 776ad77

File tree

3 files changed

+88
-3
lines changed

3 files changed

+88
-3
lines changed
+31
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
import { Page, expect } from '@playwright/test';
2+
import { KitTypeEnum } from 'dsm/component/kitType/enums/kitType-enum';
3+
import { KitType } from 'dsm/component/kitType/kitType';
4+
import { KitsTable } from 'dsm/component/tables/kits-table';
5+
import { waitForNoSpinner } from 'utils/test-utils';
6+
7+
export default class KitQueuePage {
8+
private readonly defaultKitTypes = [KitTypeEnum.SALIVA, KitTypeEnum.BLOOD];
9+
10+
private readonly kitType = new KitType(this.page);
11+
private readonly kitsTable = new KitsTable(this.page);
12+
13+
constructor(private readonly page: Page) {}
14+
15+
public async waitForReady(kitTypes?: KitTypeEnum[]): Promise<void> {
16+
const knownKitTypes = kitTypes ?? this.defaultKitTypes;
17+
await Promise.all([
18+
this.page.waitForLoadState(),
19+
expect(this.page.locator('h1')).toHaveText('Kit Queue')
20+
]);
21+
await expect(async () => expect(await this.page.locator('mat-checkbox[id]').count()).toBeGreaterThanOrEqual(1)).toPass({ timeout: 60000 });
22+
await this.assertDisplayedKitTypes(knownKitTypes);
23+
await waitForNoSpinner(this.page);
24+
}
25+
26+
public async assertDisplayedKitTypes(kitTypes: KitTypeEnum[]): Promise<void> {
27+
for (const kitType of kitTypes) {
28+
await expect(this.kitType.displayedKitType(kitType)).toBeVisible()
29+
}
30+
}
31+
}

playwright-e2e/tests/dsm/kitUploadFlow/kit-initial-scan-page-validation.spec.ts

-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,3 @@ test.describe.serial('Initial Scan page', () => {
8282
});
8383
}
8484
})
85-
86-
// kit-d9b76c66-6
87-
// PAHV44
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
import {expect} from '@playwright/test';
2+
import {test} from 'fixtures/dsm-fixture';
3+
import {WelcomePage} from 'dsm/pages/welcome-page';
4+
import {Navigation} from 'dsm/component/navigation/navigation';
5+
import {StudyEnum} from 'dsm/component/navigation/enums/selectStudyNav-enum';
6+
import {SamplesNavEnum} from 'dsm/component/navigation/enums/samplesNav-enum';
7+
import KitsWithoutLabelPage from 'dsm/pages/kitsInfo-pages/kitsWithoutLabel-page';
8+
import {KitsColumnsEnum} from 'dsm/pages/kitsInfo-pages/enums/kitsColumns-enum';
9+
import {getExpectedKitSelection, studyShortName} from 'utils/test-utils';
10+
11+
test.describe('Kits without Labels UI', () => {
12+
let welcomePage: WelcomePage;
13+
let navigation: Navigation;
14+
15+
const studies = [StudyEnum.OSTEO2, StudyEnum.PANCAN, StudyEnum.RGP];
16+
17+
test.beforeEach(({page, request}) => {
18+
welcomePage = new WelcomePage(page);
19+
navigation = new Navigation(page, request);
20+
});
21+
22+
for (const study of studies) {
23+
test(`Page verifications @dsm @${study} @kit`, async ({page}) => {
24+
const expectedKitSelection = getExpectedKitSelection(study);
25+
const { realm: expectedRealm } = studyShortName(study);
26+
await welcomePage.selectStudy(study);
27+
28+
const kitsWithoutLabelPage = await navigation.selectFromSamples<KitQueuePage>(SamplesNavEnum.QUEUE);
29+
await kitsWithoutLabelPage.waitForReady(expectedKitSelection);
30+
const kitsTable = kitsWithoutLabelPage.kitsWithoutLabelTable;
31+
32+
for (const kitType of expectedKitSelection) {
33+
await kitsWithoutLabelPage.selectKitType(kitType);
34+
await expect(page.locator(kitsWithoutLabelPage.reloadKitListBtnXPath)).toBeEnabled();
35+
const rows = await kitsTable.getRowsCount();
36+
if (rows > 0) {
37+
await expect(page.locator(kitsWithoutLabelPage.createLabelsBtnXPath)).toBeDisabled();
38+
await kitsTable.rowCountButton(50).isVisible() && await kitsTable.changeRowCount(50);
39+
} else {
40+
await expect(page.locator('h4')).toHaveText('There are no kit requests');
41+
expect(await kitsTable.exists()).toBeFalsy();
42+
}
43+
for (let i = 0; i < rows; i++) {
44+
const typeValue = (await kitsTable.getRowText(i, KitsColumnsEnum.TYPE)).trim();
45+
// Kits in different types are not mixed. Kits should be uploaded for the right type.
46+
expect.soft(typeValue).toStrictEqual(kitType);
47+
const shortId = (await kitsTable.getRowText(i, KitsColumnsEnum.SHORT_ID)).trim();
48+
expect(shortId?.length).toBeTruthy();
49+
const realm = (await kitsTable.getRowText(i, KitsColumnsEnum.DDP_REALM)).trim();
50+
expect(realm).toStrictEqual(expectedRealm);
51+
}
52+
}
53+
54+
expect(test.info().errors).toHaveLength(0);
55+
})
56+
}
57+
})

0 commit comments

Comments
 (0)