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

Commit

Permalink
Mar 4601: Fixing up UI Automation tests (#379)
Browse files Browse the repository at this point in the history
* updating login to reflect the new login

* fixed the filled criteria issue

* wip: commeting out the matchtext that causes issues with the automation tests

* wip: the downgraded version of the these packages work.

* pupetter version downgraded to 2.0.0

* wip

* linting

* updating packages

* update mocha

* leaving mocha as is

* wip

* updating package

* removing old RFX response fields+ reducing sleep time for logging in as seller

* updating readme

* Update README.md

* Update README.md

* wip

* atm update

* Update ui-automated-tests/README.md

Co-authored-by: tobiasbrown <[email protected]>

* Update ui-automated-tests/README.md

Co-authored-by: tobiasbrown <[email protected]>

* Update ui-automated-tests/README.md

Co-authored-by: tobiasbrown <[email protected]>

Co-authored-by: tobiasbrown <[email protected]>
  • Loading branch information
resh-ie and tobiasbrown authored Apr 7, 2021
1 parent ac7ec69 commit c896297
Show file tree
Hide file tree
Showing 12 changed files with 1,042 additions and 872 deletions.
17 changes: 17 additions & 0 deletions ui-automated-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,20 @@ export SELLER_NAME=[xyz]

next run `npm install`
and start the tests with `source [PATH_TO_ENVIRONMENT_FILE] && npm test`


# Troubleshooting on Ubuntu
There are a few issues you might encounter when running the ui-automation tests on Ubuntu.

If there is an issue with an outdated version of node, install the latest version and then switch to use that version of node.
`nvm install v14.16.0`
`nvm use v14.16.0`

Running `npm i puppeter` will not install Chromium and you will need to add the following dependencies manually.

`sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget`


Please look at the following links for reference:
https://github.com/puppeteer/puppeteer/issues/3443
https://github.com/puppeteer/puppeteer/issues/6560
1,865 changes: 1,007 additions & 858 deletions ui-automated-tests/package-lock.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion ui-automated-tests/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"@types/puppeteer": "^3.0.2",
"chai": "^4.2.0",
"mocha": "^8.1.3",
"puppeteer": "^5.2.1",
"puppeteer": "^5.5.0",
"random-words": "^1.1.1",
"ts-node": "^9.0.0",
"tslint": "^6.1.3",
Expand Down
2 changes: 1 addition & 1 deletion ui-automated-tests/src/flows/brief/atm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ const fillTimeframes = async () => {
const fillResponseCriteria = async (numberOfCriteria: number): Promise<ICriteriaItem[]> => {
await clickSaveContinue();
await utils.matchText("li", "You must not have any empty criteria.");
await utils.selectCheck("include_weightings");
await utils.selectCheck("yes");
const criteria: ICriteriaItem[] = [];
for (let i = 0; i < numberOfCriteria; i += 1) {
if (i > 0) {
Expand Down
1 change: 0 additions & 1 deletion ui-automated-tests/src/flows/brief/rfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ 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.selectCheck("Response template");
await utils.selectCheck("Breakdown of costs");
await utils.selectCheck("Case study");
Expand Down
5 changes: 2 additions & 3 deletions ui-automated-tests/src/flows/brief/specialist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ 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", `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 Down Expand Up @@ -139,9 +138,9 @@ const fillTimeframes = async () => {
await utils.matchText("li", "Enter a contract length for the opportunity");
const now = new Date();
const future = new Date(now.setDate(now.getDate() + 14));
await utils.type("day", { value: `${format(future, "dd")}` });
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("year", { value: `${format(future, "YYYY")}` });
await utils.type("contractLength", { numberOfCharacters: 100 });
await utils.type("contractExtensions", { numberOfCharacters: 100 });
await clickSaveContinue();
Expand Down
4 changes: 2 additions & 2 deletions ui-automated-tests/src/flows/briefResponse/atm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ const respond = async (params: IAtmResult) => {
console.log("Starting to respond to atm brief");
await clickSubmitApplication();
await utils.matchText("a", "Enter a date for when you can start the project");
await utils.matchText("a", "You must upload your written proposal");
await utils.type("availability", { numberOfCharacters: 100 });
if (params.criteria) {
for (const c of params.criteria) {
await utils.matchText("a", c.criterion);
}
}
await utils.matchText("a", "You must upload your written proposal");
await utils.type("availability", { numberOfCharacters: 100 });
if (params.criteria) {
for (let i = 0; i < params.criteria.length; i += 1) {
// eslint-disable-next-line no-await-in-loop
Expand Down
4 changes: 0 additions & 4 deletions ui-automated-tests/src/flows/briefResponse/rfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,8 @@ 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
5 changes: 3 additions & 2 deletions ui-automated-tests/src/flows/login/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,9 @@ export const login = async (email: string, password: string) => {
// eslint-disable-next-line no-param-reassign
password = process.env.SELLER_PASSWORD;
}
await utils.type("input_email_address", { value: email });
await utils.type("input_password", { value: password });
// since we are using the new login these fields need to be updated
await utils.type("emailAddress", { value: email });
await utils.type("password", { value: password });
await utils.clickInputButton("Sign in");
};

Expand Down
5 changes: 5 additions & 0 deletions ui-automated-tests/src/tests/brief/specialist.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ describe("should be able to create specialist opportunity", () => {
8: "Cyber security",
11: "Data science",
13: "Emerging technologies",
17: "ICT risk management and audit activities",
18: "ICT systems integration",
19: "Digital sourcing and ICT procurement",
20: "Platforms integration",
21: "Service Integration and Management",
};

Object.keys(categories).forEach((id) => {
Expand Down
3 changes: 3 additions & 0 deletions ui-automated-tests/src/tests/briefResponse/atm.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import respond from "../../flows/briefResponse/atm";
import startBrief from "../../flows/dashboard/buyer";
import { buyerLogin, sellerLogin } from "../../flows/login/actions";
import { applyForAtm, checkAppliedForAtm, navigate, selectBrief } from "../../flows/opportunities/actions";
import { sleep } from "../../utils";

describe("should be able to create and respond to ask the market opportunity", () => {
const now = Date.now();
Expand All @@ -20,8 +21,10 @@ describe("should be able to create and respond to ask the market opportunity", (

it("should be able to respond to ask the market opportunity", async () => {
await sellerLogin();
await sleep(1000);
await navigate();
await selectBrief(title);
await sleep(1000);
await applyForAtm();
await respond(brief);
await checkAppliedForAtm(title);
Expand Down
1 change: 1 addition & 0 deletions ui-automated-tests/src/tests/briefResponse/rfx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ describe("create and respond to RFXs opportunity", () => {

it("should be able to respond RFXs opportunity", async () => {
await sellerLogin();
await sleep(500);
await navigate();
await selectBrief(title);
await sleep(1000);
Expand Down

0 comments on commit c896297

Please sign in to comment.