Skip to content
This repository has been archived by the owner on Jul 7, 2022. It is now read-only.

Commit

Permalink
Cleaning up UI Automation test (#340)
Browse files Browse the repository at this point in the history
* updating error message for specialist

* adding more error messages in selection criteria and seller responses

* adding id back in check

* adding a confirmation text for specialist

* wip

* date is already pre-filled in no need to include it

* wip atm

* wip training

* updating the rfx brief response

* updating response for specialist
  • Loading branch information
resh-ie committed Jan 26, 2021
1 parent 85a3bff commit 1880ada
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 34 deletions.
11 changes: 3 additions & 8 deletions ui-automated-tests/src/flows/brief/atm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,15 +88,15 @@ const fillTimeframes = async () => {
await clickSaveContinue();
await utils.matchText("li", "Enter an estimated start date for the brief");

await utils.type("start_date", { numberOfWords: 10 });
await utils.type("start_date", { numberOfCharacters: 100 });
await utils.type("timeframeConstraints", { numberOfWords: 150 });
await clickSaveContinue();
};

const fillResponseCriteria = async (numberOfCriteria: number): Promise<ICriteriaItem[]> => {
await clickSaveContinue();
await utils.matchText("li", "You must not have any empty criteria.");
await utils.selectCheck("yes");
await utils.selectCheck("include_weightings");
const criteria: ICriteriaItem[] = [];
for (let i = 0; i < numberOfCriteria; i += 1) {
if (i > 0) {
Expand All @@ -119,17 +119,12 @@ const fillResponseCriteria = async (numberOfCriteria: number): Promise<ICriteria
const fillClosingDate = async () => {
await clickSaveContinue();
await utils.matchText("li", "Contact number is required");
const now = new Date();
const future = new Date(now.setDate(now.getDate() + 14));
await utils.type("day", { value: `${format(future, "dd")}` });
await utils.type("month", { value: `${format(future, "MM")}` });
await utils.type("year", { value: `${format(future, "yyyy")}` });
await utils.type("contactNumber", { value: "0123456789" });
await clickSaveContinue();
};

const publishBrief = async () => {
await utils.selectCheck("cb-declaration");
await utils.selectCheck("cb-declaration", "id");
await utils.clickButton("Publish");
await utils.matchText("h1", "Your opportunity is now live.");
};
Expand Down
12 changes: 4 additions & 8 deletions ui-automated-tests/src/flows/brief/rfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const fillResponseFormats = async () => {
await utils.selectCheck("Response template");
await clickSaveContinue();
await utils.matchText("li", "You must select at least one proposal type.");
await utils.matchText("li", `You can only select either "Written proposal" or "Completed response template".`, "'");
await utils.matchText("li", `You can only select either "Written proposal" or "Completed response template".`);
await utils.selectCheck("Response template");
await utils.selectCheck("Breakdown of costs");
await utils.selectCheck("Case study");
Expand All @@ -83,7 +83,7 @@ const fillTimeframesAndBudget = async () => {
await clickSaveContinue();
await utils.matchText("li", "You must add an estimated start date");
await utils.matchText("li", "You must add a contract length");
await utils.type("start_date", { numberOfCharacters: 150 });
await utils.type("start_date", { numberOfCharacters: 100 });
await utils.type("contract_length-label", { numberOfCharacters: 50 });
await utils.type("contract_extensions", { numberOfCharacters: 50 });
await utils.type("budget_range", { numberOfWords: 150 });
Expand All @@ -92,6 +92,7 @@ const fillTimeframesAndBudget = async () => {

const fillEvaluationCriteria = async () => {
await clickSaveContinue();
await utils.matchText("li", "You cannot have blank essential weightings.");
await utils.matchText("li", "You cannot have blank essential criteria.");
await utils.clickLink("Add another criteria");
await utils.type("essential_criteria_0", { numberOfWords: 50 });
Expand All @@ -104,19 +105,14 @@ const fillEvaluationCriteria = async () => {
const fillClosingDate = async () => {
await clickSaveContinue();
await utils.matchText("li", "Contact number is required");
const now = new Date();
const future = new Date(now.setDate(now.getDate() + 14));
await utils.type("day", { value: `${format(future, "dd")}` });
await utils.type("month", { value: `${format(future, "MM")}` });
await utils.type("year", { value: `${format(future, "yyyy")}` });
await utils.type("contactNumber", { value: "01234455667733" });
await utils.selectCheck("comprehensiveTerms", "id");
await utils.type("internalReference", { numberOfCharacters: 100 });
await clickSaveContinue();
};

const fillPublishBrief = async () => {
await utils.selectCheck("cb-declaration");
await utils.selectCheck("cb-declaration", "id");
await utils.clickButton("Publish");
await utils.matchText("h1", "Your opportunity is now live, and the invited sellers have been notified.");
};
Expand Down
14 changes: 10 additions & 4 deletions ui-automated-tests/src/flows/brief/specialist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ const createBrief = async () => {
const fillAbout = async (role: string, locations: string[]) => {
await clickSaveContinue();
await utils.matchText("li", "Enter the title for your opportunity.");
await utils.matchText("li", "what will the specialist do");
await utils.matchText("li", `You must answer "what will the specialist do."`);
await utils.matchText("li", "You must select at least one location.");
await utils.type("title", { value: role });
await utils.type("summary", { numberOfWords: 1000 });
Expand All @@ -61,17 +61,22 @@ const fillWhoCanRespond = async (categoryId: string) => {
};

const fillSelectionCriteria = async (): Promise<ISelectionCriteria> => {
await clickSaveContinue();
await utils.matchText("li", "You cannot have blank essential criteria.");

await utils.selectCheck("includeWeightingsEssential", "id");
await utils.selectCheck("includeWeightingsNiceToHave", "id");
await clickSaveContinue();
await utils.matchText("li", "You cannot have blank essential criteria.");

await utils.matchText("li", "You cannot have blank essential weightings.");
await utils.matchText("li", "You cannot have blank essential criteria.");
await utils.matchText("li", "Desirable weightings must add up to 100%.");

const essCriteria = await utils.type("essential_criteria_0", { numberOfWords: 50 });
const essWeighting = await utils.type("essential_weighting_0", { value: "10" });
await clickSaveContinue();
await utils.matchText("li", "Essential weightings must add up to 100%.");
await utils.matchText("li", "Desirable weightings must add up to 100%.");
await utils.type("essential_weighting_0", { value: "0" });
const essentialCriteria = {
criteria: essCriteria,
Expand All @@ -94,7 +99,7 @@ const fillSelectionCriteria = async (): Promise<ISelectionCriteria> => {

const fillSellerResponses = async (): Promise<{ numberOfSuppliers: string }> => {
await clickSaveContinue();

await utils.matchText("li", "You must define the security clearance requirements");
const input = await utils.getElementHandle(`//input[@id="numberOfSuppliers"]`);
await input.press("Backspace");
await clickSaveContinue();
Expand Down Expand Up @@ -153,8 +158,9 @@ const fillAdditionalInformation = async () => {
};

const publishBrief = async () => {
await utils.selectCheck("cb-declaration");
await utils.selectCheck("cb-declaration", "id");
await utils.clickButton("Publish");
await utils.matchText("h1", "Your opportunity is now live.");
};

const create = async (params: ISpecialistParams): Promise<ISpecialistResult> => {
Expand Down
10 changes: 3 additions & 7 deletions ui-automated-tests/src/flows/brief/training.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ const fillTimeframesAndBudget = async () => {
await clickSaveContinue();
await utils.matchText("li", "You must add an estimated start date");
await utils.matchText("li", "You must add a contract length");
await utils.type("start_date", { numberOfCharacters: 150 });
await utils.type("start_date", { numberOfCharacters: 100 });
await utils.type("contract_length-label", { numberOfCharacters: 50 });
await utils.type("contract_extensions", { numberOfCharacters: 50 });
await utils.type("budget_range", { numberOfWords: 150 });
Expand All @@ -88,6 +88,7 @@ const fillEvaluationCriteria = async () => {
await clickSaveContinue();
await utils.matchText("li", "You cannot have blank essential criteria.");
await utils.matchText("li", "You cannot have blank essential criteria.");
await utils.matchText("li", "Desirable weightings must add up to 100%.");
await utils.selectCheck("includeWeightingsNiceToHave", "id");
await utils.clickLink("Add another criteria");
await utils.type("essential_criteria_0", { numberOfWords: 50 });
Expand All @@ -100,19 +101,14 @@ const fillEvaluationCriteria = async () => {
const fillClosingDate = async () => {
await clickSaveContinue();
await utils.matchText("li", "Contact number is required");
const now = new Date();
const future = new Date(now.setDate(now.getDate() + 14));
await utils.type("day", { value: `${format(future, "dd")}` });
await utils.type("month", { value: `${format(future, "MM")}` });
await utils.type("year", { value: `${format(future, "yyyy")}` });
await utils.type("contactNumber", { value: "01234455667733" });
await utils.selectCheck("comprehensiveTerms", "id");
await utils.type("internalReference", { numberOfCharacters: 100 });
await clickSaveContinue();
};

const fillPublishBrief = async () => {
await utils.selectCheck("cb-declaration");
await utils.selectCheck("cb-declaration", "id");
await utils.clickButton("Publish");
await utils.matchText("h1", "Your opportunity is now live, and the invited sellers have been notified.");
};
Expand Down
6 changes: 4 additions & 2 deletions ui-automated-tests/src/flows/briefResponse/rfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ const clickSubmitApplication = async () => {

const respond = async () => {
console.log("respond to RFxs");

await util.type("criteria.0", { numberOfWords: 500 });
await util.type("criteria.1", { numberOfWords: 500 });
await clickSubmitApplication();

await util.matchText("a", "Enter a date for when you can start the project");
await util.matchText("a", "You must upload your written proposal");
await util.type("availability", { value: "0123456789" });
await util.upload("file_writtenProposal_0", "document.pdf");
await clickSubmitApplication();

Expand Down
9 changes: 4 additions & 5 deletions ui-automated-tests/src/flows/briefResponse/specialist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,21 @@ const respond = async (params: {specialistNumber: number}) => {
await clickSubmitApplication();
await util.matchText("a", "Given name(s) is required");
await util.matchText("a", "Surname is required");
await util.type("specialistGivenNames", { numberOfCharacters: 100 });
await util.type("specialistSurname", { numberOfCharacters: 100 });

await util.matchText("a", "Enter a date for when you can start the project");
await util.matchText("a", "Hourly rate is required");
await util.matchText("a", "Upload a file for your résumé");
await util.matchText("a", `the candidate's security clearance is required`);
await util.type("specialistGivenNames", { numberOfCharacters: 100 });
await util.type("specialistSurname", { numberOfCharacters: 100 });

await util.type("availability", { numberOfCharacters: 100 });
await util.type("hourRateExcludingGST", { value: "500" });
await util.upload("file_resume_0", "document.pdf");
await util.selectRadio("visaStatus-AustralianCitizen", "id");
await util.selectRadio("securityClearance-Yes", "id");
await util.selectRadio("previouslyWorked-Yes", "id");
await util.type("essentialRequirement.0", { numberOfWords: 150 });
await util.type("niceToHaveRequirement.0", { numberOfWords: 150 });
await util.type("essentialRequirement.0", { numberOfWords: 500 });
await util.type("niceToHaveRequirement.0", { numberOfWords: 500 });

await clickSubmitApplication();
};
Expand Down

0 comments on commit 1880ada

Please sign in to comment.