Skip to content

Commit

Permalink
Update npm dependencies, deprecated test functions, and add major ver…
Browse files Browse the repository at this point in the history
…sion dependabot ignore (#1535)
  • Loading branch information
liamtoozer authored Oct 31, 2024
1 parent 198db69 commit dbe149d
Show file tree
Hide file tree
Showing 113 changed files with 5,413 additions and 3,888 deletions.
9 changes: 9 additions & 0 deletions .github/dependabot.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,15 @@ updates:
- "typescript*"
- "uuid*"
- "webdriverio*"
ignore:
# temporarily pinned to minor/patch only - eslint v9 not supported in eslint-config-standard v17.1.0: https://github.com/standard/eslint-config-standard/issues/410
# This had a knock-on effect with `eslint-plugin-n` and `eslint-plugin-promise`
- dependency-name: "eslint*"
update-types: [ "version-update:semver-major" ]

# temporarily pinned to minor/patch only - wdio v9 causes getHTML() to return strings with indentation & newlines, causing assertion errors - needs investigation
- dependency-name: "@wdio/local-runner"
update-types: [ "version-update:semver-major" ]

- package-ecosystem: "pip"
directory: "/"
Expand Down
7,661 changes: 4,605 additions & 3,056 deletions package-lock.json

Large diffs are not rendered by default.

38 changes: 19 additions & 19 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,33 +23,33 @@
"wdio": "wdio run ./tests/functional/wdio.conf.js"
},
"devDependencies": {
"@babel/core": "^7.23.2",
"@babel/plugin-transform-runtime": "^7.23.2",
"@babel/preset-env": "^7.23.2",
"@babel/register": "^7.22.5",
"@babel/runtime": "^7.23.2",
"@wdio/cli": "^8.14.4",
"@babel/core": "^7.25.8",
"@babel/plugin-transform-runtime": "^7.25.7",
"@babel/preset-env": "^7.25.8",
"@babel/register": "^7.25.7",
"@babel/runtime": "^7.25.7",
"@wdio/cli": "^9.2.1",
"@wdio/local-runner": "^8.14.3",
"@wdio/mocha-framework": "^8.14.0",
"@wdio/spec-reporter": "^8.14.0",
"eslint": "^8.46.0",
"@wdio/mocha-framework": "^9.1.3",
"@wdio/spec-reporter": "^9.1.3",
"eslint": "^v8.57.1",
"eslint-cli": "^1.1.1",
"eslint-config-standard": "^17.1.0",
"eslint-plugin-import": "^2.28.0",
"eslint-plugin-json": "^3.1.0",
"eslint-plugin-n": "^16.0.1",
"eslint-plugin-import": "^2.31.0",
"eslint-plugin-json": "^4.0.1",
"eslint-plugin-n": "^16.6.2",
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-promise": "^6.1.1",
"eslint-plugin-promise": "^6.6.0",
"json-web-key": "^0.4.0",
"jsrsasign": "^11.0.0",
"lint-staged": "^13.2.3",
"lint-staged": "^15.2.10",
"livereload": "^0.9.3",
"node-forge": "^1.2.1",
"node-forge": "^1.3.1",
"node-jose": "^2.2.0",
"prettier": "^3.0.1",
"typescript": "^5.1.6",
"uuid": "^9.0.0",
"webdriverio": "^8.15.0"
"prettier": "^3.3.3",
"typescript": "^5.6.3",
"uuid": "^10.0.0",
"webdriverio": "^9.2.1"
},
"prettier": {}
}
4 changes: 4 additions & 0 deletions tests/functional/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,3 +51,7 @@ export const click = async (selector) => {
// Allow time in case the click loads a new page.
await browser.pause(100);
};

export const verifyUrlContains = async (expectedUrlString) => {
await expect(browser).toHaveUrl(expect.stringContaining(expectedUrlString));
};
4 changes: 2 additions & 2 deletions tests/functional/spec/checkbox.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import MandatoryCheckboxPage from "../generated_pages/checkbox/mandatory-checkbo
import NonMandatoryCheckboxPage from "../generated_pages/checkbox/non-mandatory-checkbox.page";
import singleCheckboxPage from "../generated_pages/checkbox/single-checkbox.page";
import SubmitPage from "../generated_pages/checkbox/submit.page";
import { click } from "../helpers";
import { click, verifyUrlContains } from "../helpers";

describe('Checkbox with "other" option', () => {
beforeEach("Load the survey", async () => {
Expand Down Expand Up @@ -57,7 +57,7 @@ describe('Checkbox with "other" option', () => {
// When
await $(MandatoryCheckboxPage.otherDetail()).setValue("Other Text");
await click(MandatoryCheckboxPage.submit());
await expect(browser).toHaveUrlContaining(NonMandatoryCheckboxPage.pageName);
await verifyUrlContains(NonMandatoryCheckboxPage.pageName);
});

it('Given a non-mandatory checkbox answer, when the user does not select an option, then "No answer provided" should be displayed on the summary screen', async () => {
Expand Down
8 changes: 4 additions & 4 deletions tests/functional/spec/components/address/address.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import AddressConfirmation from "../../../generated_pages/address/address-confir
import AddressMandatory from "../../../generated_pages/address/address-block-mandatory.page";
import AddressOptional from "../../../generated_pages/address/address-block-optional.page";
import SubmitPage from "../../../generated_pages/address/submit.page";
import { click } from "../../../helpers";
import { click, verifyUrlContains } from "../../../helpers";

describe("Address Answer Type", () => {
beforeEach("Launch survey", async () => {
Expand All @@ -19,7 +19,7 @@ describe("Address Answer Type", () => {
await click(AddressMandatory.submit());
await click(AddressOptional.submit());
await click(AddressConfirmation.submit());
await expect(browser).toHaveUrlContaining(SubmitPage.pageName);
await verifyUrlContains(SubmitPage.pageName);
await expect(await $(SubmitPage.addressMandatory()).getText()).toBe("Evelyn Street\nApt 7\nBarry\nCF63 4JG");
await expect(await $(SubmitPage.addressMandatory()).getHTML()).toContain("Evelyn Street<br>Apt 7<br>Barry<br>CF63 4JG");
});
Expand All @@ -32,7 +32,7 @@ describe("Address Answer Type", () => {
await click(AddressMandatory.submit());
await click(AddressOptional.submit());
await click(AddressConfirmation.submit());
await expect(browser).toHaveUrlContaining(SubmitPage.pageName);
await verifyUrlContains(SubmitPage.pageName);
await expect(await $(SubmitPage.addressMandatory()).getText()).toBe("Evelyn Street");
});
});
Expand Down Expand Up @@ -64,7 +64,7 @@ describe("Address Answer Type", () => {
await $(AddressMandatory.Postcode()).setValue("CF63 4JG");

await click(AddressMandatory.submit());
await expect(browser).toHaveUrlContaining(AddressOptional.pageName);
await verifyUrlContains(AddressOptional.pageName);

await browser.url(AddressMandatory.url());

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MandatoryCheckboxPage from "../../../generated_pages/checkbox_detail_answer_multiple/mandatory-checkbox.page";
import SubmitPage from "../../../generated_pages/checkbox_detail_answer_multiple/submit.page";
import { click } from "../../../helpers";
import { click, verifyUrlContains } from "../../../helpers";
describe('Checkbox with multiple "detail_answer" options', () => {
const checkboxSchema = "test_checkbox_detail_answer_multiple.json";

Expand Down Expand Up @@ -37,7 +37,7 @@ describe('Checkbox with multiple "detail_answer" options', () => {
// When
await $(MandatoryCheckboxPage.yourChoiceDetail()).setValue("Bacon");
await click(MandatoryCheckboxPage.submit());
await expect(browser).toHaveUrlContaining(SubmitPage.pageName);
await verifyUrlContains(SubmitPage.pageName);
});

it("Given a non-mandatory detail answer, When the user does not provide any text, Then just the option value should be displayed on the summary screen", async () => {
Expand Down
14 changes: 7 additions & 7 deletions tests/functional/spec/components/radio/radio.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import RadioNonMandatoryDetailAnswerOverriddenPage from "../../../generated_page

import RadioNonMandatoryDetailAnswerPage from "../../../generated_pages/radio_optional_with_detail_answer_mandatory/radio-non-mandatory.page";
import RadioNonMandatoryDetailAnswerSummary from "../../../generated_pages/radio_optional_with_detail_answer_mandatory/submit.page";
import { click } from "../../../helpers";
import { click, verifyUrlContains } from "../../../helpers";
describe("Component: Radio", () => {
describe("Given I start a Mandatory Radio survey", () => {
before(async () => {
Expand All @@ -25,7 +25,7 @@ describe("Component: Radio", () => {
it("When I have selected a radio option that contains an escaped character, Then the selected option should be displayed in the summary", async () => {
await $(RadioMandatoryPage.teaCoffee()).click();
await click(RadioMandatoryPage.submit());
await expect(browser).toHaveUrlContaining(RadioMandatorySummary.pageName);
await verifyUrlContains(RadioMandatorySummary.pageName);
await expect(await $(RadioMandatorySummary.radioMandatoryAnswer()).getText()).toBe("Tea & Coffee");
});
});
Expand All @@ -38,7 +38,7 @@ describe("Component: Radio", () => {
it("When I have selected a radio option, Then the selected option should be displayed in the summary", async () => {
await $(RadioMandatoryPage.coffee()).click();
await click(RadioMandatoryPage.submit());
await expect(browser).toHaveUrlContaining(RadioMandatorySummary.pageName);
await verifyUrlContains(RadioMandatorySummary.pageName);
await expect(await $(RadioMandatorySummary.radioMandatoryAnswer()).getText()).toBe("Coffee");
});
});
Expand All @@ -65,7 +65,7 @@ describe("Component: Radio", () => {
await $(RadioMandatoryOptionalDetailAnswerPage.other()).click();
await $(RadioMandatoryOptionalDetailAnswerPage.otherDetail()).setValue("Hello World");
await click(RadioMandatoryOptionalDetailAnswerPage.submit());
await expect(browser).toHaveUrlContaining(RadioMandatoryOptionDetailAnswerSummary.pageName);
await verifyUrlContains(RadioMandatoryOptionDetailAnswerSummary.pageName);
await expect(await $(RadioMandatoryOptionDetailAnswerSummary.radioMandatoryAnswer()).getText()).toContain("Hello World");
});
});
Expand All @@ -89,7 +89,7 @@ describe("Component: Radio", () => {

it("When I submit without any data in the other text field is selected, Then the selected option should be displayed in the summary", async () => {
await click(RadioMandatoryOptionalDetailAnswerPage.submit());
await expect(browser).toHaveUrlContaining(RadioMandatoryOptionDetailAnswerSummary.pageName);
await verifyUrlContains(RadioMandatoryOptionDetailAnswerSummary.pageName);
await expect(await $(RadioMandatoryOptionDetailAnswerSummary.radioMandatoryAnswer()).getText()).toContain("No answer provided");
});
});
Expand All @@ -112,7 +112,7 @@ describe("Component: Radio", () => {

it("When I have selected no option, Then the selected option should be displayed in the summary", async () => {
await click(RadioNonMandatoryPage.submit());
await expect(browser).toHaveUrlContaining(RadioNonMandatorySummary.pageName);
await verifyUrlContains(RadioNonMandatorySummary.pageName);
await expect(await $(RadioNonMandatorySummary.radioNonMandatoryAnswer()).getText()).toBe("No answer provided");
});
});
Expand All @@ -138,7 +138,7 @@ describe("Component: Radio", () => {
await $(RadioNonMandatoryDetailAnswerPage.other()).click();
await $(RadioNonMandatoryDetailAnswerPage.otherDetail()).setValue("Hello World");
await click(RadioNonMandatoryDetailAnswerPage.submit());
await expect(browser).toHaveUrlContaining(RadioNonMandatoryDetailAnswerSummary.pageName);
await verifyUrlContains(RadioNonMandatoryDetailAnswerSummary.pageName);
await expect(await $(RadioNonMandatoryDetailAnswerSummary.radioNonMandatoryAnswer()).getText()).toContain("Hello World");
});
});
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import MandatoryRadioPage from "../../../generated_pages/radio_detail_answer_multiple/radio-mandatory.page";
import SubmitPage from "../../../generated_pages/radio_detail_answer_multiple/submit.page";
import { click } from "../../../helpers";
import { click, verifyUrlContains } from "../../../helpers";
describe('Radio with multiple "detail_answer" options', () => {
const radioSchema = "test_radio_detail_answer_multiple.json";

Expand Down Expand Up @@ -33,7 +33,7 @@ describe('Radio with multiple "detail_answer" options', () => {
// When
await $(MandatoryRadioPage.favouriteNotListedDetail()).setValue("Bacon");
await click(MandatoryRadioPage.submit());
await expect(browser).toHaveUrlContaining(SubmitPage.pageName);
await verifyUrlContains(SubmitPage.pageName);
});

it("Given a non-mandatory detail answer, When the user does not provide any text, Then just the option value should be displayed on the summary screen", async () => {
Expand Down
22 changes: 11 additions & 11 deletions tests/functional/spec/confirmation_email.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ThankYouPage from "../base_pages/thank-you.page";
import ConfirmationEmailPage from "../base_pages/confirmation-email.page";
import ConfirmationEmailSentPage from "../base_pages/confirmation-email-sent.page";
import ConfirmEmailPage from "../base_pages/confirm-email.page";
import { click } from "../helpers";
import { click, verifyUrlContains } from "../helpers";

const errorPanel = '[data-ga="error"]';

Expand All @@ -17,58 +17,58 @@ describe("Email confirmation", () => {
it("When I complete the survey and am on the thank you page, Then there is option to enter an email address", async () => {
await click(SubmitPage.submit());
await click(SubmitPage.submit());
await expect(browser).toHaveUrlContaining(ThankYouPage.pageName);
await verifyUrlContains(ThankYouPage.pageName);
await expect(await $(ThankYouPage.email()).isExisting()).toBe(true);
});

it("When I submit the form without providing an email address, Then I get an error message", async () => {
await click(ThankYouPage.submit());
await expect(browser).toHaveUrlContaining(ThankYouPage.pageName);
await verifyUrlContains(ThankYouPage.pageName);
await expect(await $(errorPanel).isExisting()).toBe(true);
await expect(await $(errorPanel).getText()).toBe("Enter an email address");
});

it("When I submit the form without providing a correctly formatted email address, Then I get an error message", async () => {
await $(ThankYouPage.email()).setValue("incorrect-format");
await click(ThankYouPage.submit());
await expect(browser).toHaveUrlContaining(ThankYouPage.pageName);
await verifyUrlContains(ThankYouPage.pageName);
await expect(await $(errorPanel).isExisting()).toBe(true);
await expect(await $(errorPanel).getText()).toBe("Enter an email address in a valid format, for example [email protected]");
});

it("When I submit the form with a valid email address, Then I go to the confirm email page", async () => {
await $(ThankYouPage.email()).setValue("[email protected]");
await click(ThankYouPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/confirm");
await verifyUrlContains("confirmation-email/confirm");
await expect(await $(ConfirmEmailPage.questionTitle()).getText()).toBe("Is this email address correct?");
});

it("When I submit the confirm email page without providing an answer, Then I get an error message", async () => {
await click(ConfirmEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/confirm");
await verifyUrlContains("confirmation-email/confirm");
await expect(await $(ConfirmEmailPage.errorPanel()).isExisting()).toBe(true);
await expect(await $(ConfirmEmailPage.errorPanel()).getText()).toContain("Select an answer");
});

it("When I answer 'Yes' and submit the confirm email page, Then I go to email sent page", async () => {
await $(ConfirmEmailPage.yes()).click();
await click(ConfirmEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/sent");
await verifyUrlContains("confirmation-email/sent");
await expect(await $(ConfirmationEmailSentPage.confirmationText()).getText()).toBe("A confirmation email has been sent to [email protected]");
});

it("When I go to the confirmation email page and submit without providing an email address, Then I get an error message", async () => {
await $(ConfirmationEmailSentPage.sendAnotherEmail()).click();
await click(ConfirmationEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/send");
await verifyUrlContains("confirmation-email/send");
await expect(await $(ConfirmationEmailPage.errorPanel()).isExisting()).toBe(true);
await expect(await $(ConfirmationEmailPage.errorPanel()).getText()).toBe("Enter an email address");
});

it("When I submit the form without providing a correctly formatted email address, Then I get an error message", async () => {
await $(ConfirmationEmailPage.email()).setValue("incorrect-format");
await click(ConfirmationEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/send");
await verifyUrlContains("confirmation-email/send");
await expect(await $(ConfirmationEmailPage.errorPanel()).isExisting()).toBe(true);
await expect(await $(ConfirmationEmailPage.errorPanel()).getText()).toBe("Enter an email address in a valid format, for example [email protected]");
});
Expand All @@ -78,7 +78,7 @@ describe("Email confirmation", () => {
await click(ConfirmationEmailPage.submit());
await $(ConfirmEmailPage.yes()).click();
await click(ConfirmEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/sent");
await verifyUrlContains("confirmation-email/sent");
await expect(await $(ConfirmationEmailSentPage.confirmationText()).getText()).toBe("A confirmation email has been sent to [email protected]");
});
});
Expand All @@ -93,7 +93,7 @@ describe("Email confirmation", () => {
await click(ThankYouPage.submit());
await $(ConfirmEmailPage.no()).click();
await click(ConfirmEmailPage.submit());
await expect(browser).toHaveUrlContaining("confirmation-email/send");
await verifyUrlContains("confirmation-email/send");
await expect(await $(ConfirmationEmailPage.email()).getValue()).toBe("[email protected]");
});
});
Expand Down
6 changes: 3 additions & 3 deletions tests/functional/spec/dates.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import DateSinglePage from "../generated_pages/dates/date-single-block.page";
import DateNonMandatoryPage from "../generated_pages/dates/date-non-mandatory-block.page";
import DateYearDatePage from "../generated_pages/dates/date-year-date-block.page";
import SubmitPage from "../generated_pages/dates/submit.page";
import { click } from "../helpers";
import { click, verifyUrlContains } from "../helpers";

describe("Date checks", () => {
beforeEach("Load the survey", async () => {
Expand Down Expand Up @@ -58,7 +58,7 @@ describe("Date checks", () => {

await click(DateYearDatePage.submit());

await expect(browser).toHaveUrlContaining(SubmitPage.pageName);
await verifyUrlContains(SubmitPage.pageName);

// Then the summary screen shows the dates entered formatted
await expect(await $(SubmitPage.dateRangeFromAnswer()).getText()).toBe("1 January 1901 to 3 May 2017");
Expand Down Expand Up @@ -161,7 +161,7 @@ describe("Date checks", () => {
await $(DateMonthYearPage.Year()).setValue(2018);
await click(DateMonthYearPage.submit());

await expect(browser).toHaveUrlContaining(DateSinglePage.url());
await verifyUrlContains(DateSinglePage.url());
});

it("Given the test_dates survey is selected when an error message is shown then when it is corrected, it goes to the summary page and the information is correct", async () => {
Expand Down
Loading

0 comments on commit dbe149d

Please sign in to comment.