Skip to content

Commit

Permalink
Update e2e spec files to adopt v1.0.0-alpha.25 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
fongsean committed Feb 28, 2025
1 parent d5eb54d commit 203cdc1
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 15 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.alpha.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ This changelog only includes changes from version 1.0.0-alpha.1 onwards. For sta

WARNING: Alpha releases are not stable and may contain breaking changes. Changes are also most likely to be undocumented.

## [1.0.0-alpha.25] - 2025-02-28
_(WARNING: Breaking changes for id-based e2e testing)_
### Added
- Associated labels in ItemLabelText explicitly (via htmlFor + id) to all item types except time.

### Changed
- All input ids are now prepended with item.type i.e. item.type + "-" + item.linkId

## [1.0.0-alpha.24] - 2025-02-26
### Added
- Add support for required-based validation and the useValidationFeedback hook to all item types except date and dateTime.
Expand Down
20 changes: 10 additions & 10 deletions apps/smart-forms-app/e2e/items.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,23 +67,23 @@ test('enter inputs into BitOfEverything questionnaire', async ({ page }) => {
await expect(page.getByTestId('q-item-display-box')).toContainText('display label');

// String
const stringItemLinkId = 'Item-string';
const stringItemLinkId = 'string-Item-string';
await page
.getByTestId('q-item-string-box')
.getByTestId('q-item-string-field')
.locator(`#${stringItemLinkId}`)
.fill(stringInput);

// Text
const textItemLinkId = 'Item-text';
const textItemLinkId = 'text-Item-text';
await page
.getByTestId('q-item-text-box')
.getByTestId('q-item-text-field')
.locator(`#${textItemLinkId}`)
.fill(textInput);

// Boolean
const booleanItemLinkId = 'Item-bool';
const booleanItemLinkId = 'boolean-Item-bool';
await page
.getByTestId('q-item-boolean-box')
.locator(`#${booleanItemLinkId}`)
Expand All @@ -92,14 +92,14 @@ test('enter inputs into BitOfEverything questionnaire', async ({ page }) => {
.click();

// Date
const dateItemLinkId = 'Item-date';
const dateItemLinkId = 'date-Item-date';
await page
.getByTestId('q-item-date-box')
.locator(`#${dateItemLinkId}-date`)
.pressSequentially(dateInput, { delay: 100 });

// DateTime
const dateTimeItemLinkId = 'Item-datetime';
const dateTimeItemLinkId = 'datetime-Item-datetime';
await page
.getByTestId('q-item-datetime-box')
.locator(`#${dateTimeItemLinkId}-date`)
Expand All @@ -115,16 +115,16 @@ test('enter inputs into BitOfEverything questionnaire', async ({ page }) => {
// Skipping Time for now

// Integer
const integerItemLinkId = 'Item-integer';
const integerItemLinkId = 'integer-Item-integer';
await page.getByTestId('q-item-integer-box').locator(`#${integerItemLinkId}`).fill(integerInput);

// Decimal
const decimalItemLinkId = 'Item-decimal';
const decimalItemLinkId = 'decimal-Item-decimal';
await page.getByTestId('q-item-decimal-box').locator(`#${decimalItemLinkId}`).fill(decimalInput);
await expect(page.getByTestId('q-item-decimal-box').first()).toContainText('meters'); // first() is hacky

// Url
const urlItemLinkId = 'Item-url';
const urlItemLinkId = 'url-Item-url';
await page.getByTestId('q-item-url-box').locator(`#${urlItemLinkId}`).fill(urlInput);

// Skipping Reference for now
Expand All @@ -134,7 +134,7 @@ test('enter inputs into BitOfEverything questionnaire', async ({ page }) => {
// Skipping Quantity for now

// Choice answerOption - option A
const choiceItemAnswerOptionLinkId = 'Item-rb-local';
const choiceItemAnswerOptionLinkId = 'choice-Item-rb-local';
await page.getByTestId('q-item-choice-select-answer-option-box').first().scrollIntoViewIfNeeded();
await page
.getByTestId('q-item-choice-select-answer-option-box')
Expand All @@ -143,7 +143,7 @@ test('enter inputs into BitOfEverything questionnaire', async ({ page }) => {
await page.keyboard.press('Enter');

// Choice answerValueSet - Tasmania
const choiceItemAnswerValueSetLinkId = 'Item10';
const choiceItemAnswerValueSetLinkId = 'choice-Item10';
await page
.getByTestId('q-item-choice-select-answer-value-set-box')
.locator(`#${choiceItemAnswerValueSetLinkId}`)
Expand Down
6 changes: 3 additions & 3 deletions apps/smart-forms-app/e2e/prepop.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ test('pre-pop into CVDRiskCalculator questionnaire', async ({ page }) => {
expect(populateResponse.status()).toBe(200);

// Check calculated value
const cvdRiskValueLinkId = 'cvd-result';
const cvdRiskValueLinkId = 'integer-cvd-result';
await expect(
page.getByTestId('q-item-integer-box').locator(`#${cvdRiskValueLinkId}`)
).toHaveValue('23');
Expand Down Expand Up @@ -141,7 +141,7 @@ test('pre-pop to test terminology resolving logic', async ({ page }) => {
const genderAvsUrlValueLinkId = 'gender-avs-url';
await expect(
page
.getByTestId('q-item-choice-select-answer-value-set-box')
.getByTestId('choice-q-item-choice-select-answer-value-set-box')
.locator(`#${genderAvsUrlValueLinkId}`)
).toHaveValue('Female');

Expand All @@ -152,7 +152,7 @@ test('pre-pop to test terminology resolving logic', async ({ page }) => {
.locator(`#${genderAvsContainedValueLinkId}`)
).toHaveValue('Female');

const medicalHistoryConditionValueLinkId = 'medical-history-condition';
const medicalHistoryConditionValueLinkId = 'open-choice-medical-history-condition';

const elements = await page.locator(`#${medicalHistoryConditionValueLinkId}`).all();
for (const element of elements) {
Expand Down
2 changes: 1 addition & 1 deletion apps/smart-forms-app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"dependencies": {
"@aehrc/sdc-assemble": "^1.3.1",
"@aehrc/sdc-populate": "^3.0.1",
"@aehrc/smart-forms-renderer": "^1.0.0-alpha.22",
"@aehrc/smart-forms-renderer": "^1.0.0-alpha.25",
"@emotion/react": "^11.13.0",
"@emotion/styled": "^11.13.0",
"@fontsource/material-icons": "^5.0.18",
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 203cdc1

Please sign in to comment.