Skip to content

Commit

Permalink
add some tests for assistant
Browse files Browse the repository at this point in the history
works on #9
  • Loading branch information
s-laugh committed Feb 28, 2019
1 parent 5462d92 commit 992610a
Showing 1 changed file with 75 additions and 8 deletions.
83 changes: 75 additions & 8 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const AxeReports = require("axe-reports");
const puppeteer = require("puppeteer");

async function a11ytest(page, name) {
console.log("Assessing: " +page.url());
console.log("Assessing: " + page.url());
const results = await new AxePuppeteer(page)
.withTags(["wcag2a", "wcag2aa"])
.exclude([
Expand Down Expand Up @@ -56,27 +56,33 @@ async function runtest(page, name) {
await screenshot(page, "thirdpage.png");

await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/MainMenu.aspx?org_id=-" + orgId
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/MainMenu.aspx?org_id=" +
orgId
);
await runtest(page, "MainMenu.aspx");

await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/ROE/SelectBusiness?org_id=-" + orgId
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/ROE/SelectBusiness?org_id=" +
orgId
);
await runtest(page, "SelectBusiness");

await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/Search/Issued?org_id=-" + orgId + "&amend=True"
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/Search/Issued?org_id=" +
orgId +
"&amend=True"
);
await runtest(page, "Amend");

await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/PayrollExtract/ViewFiles?org_id=-" + orgId
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/PayrollExtract/ViewFiles?org_id=" +
orgId
);
await runtest(page, "ViewPayroll");

await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/PayrollExtract/Upload?org_id=-" + orgId
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/PayrollExtract/Upload?org_id=" +
orgId
);
await runtest(page, "UploadPayroll");

Expand All @@ -99,15 +105,76 @@ async function runtest(page, name) {
await runtest(page, "MoveAll");

//Move Folder Confirmation Page
await page.select("select[id=FromFolder]","#none#");
await page.select("select[id=FromFolder]", "#none#");
await page.select("select[id=ToFolder]", orgId + "01");

await Promise.all([
page.waitForNavigation(), // The promise resolves after navigation has finished
page.click("button[type=submit]")
]);

await runtest(page,"MoveAllConfirmation");
await runtest(page, "MoveAllConfirmation");

//ROE Web Assistant - should be run in sequence
//For some reason the promis all is needed so the page.type doesn't get jubled into one feild
//Welcome
await page.goto(
"https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/Assistant/IntroductionWelcome?org_id=" +
orgId
);
await runtest(page, "AssistantIntroductionWelcome");
//new roe
await Promise.all([
page.click(
"body > div > div.row > main > fieldset > form > div:nth-child(2) > label > input[type=radio]"
)
]);
await page.click("body > div > div.row > main > fieldset > form > button");
await page.waitForNavigation();
await runtest(page, "AssistantIntroductionNewROE");
//confirm user
await page.click("body > div > div.row > main > a.btn.btn-primary");
await page.waitForNavigation();
await runtest(page, "AssistantConfirmUser");
//employer
await Promise.all([
page.click(
"body > div > div.row > main > form > fieldset > div:nth-child(3) > label > input[type=radio]"
)
]);
await page.click("body > div > div.row > main > form > button");
await page.waitForNavigation();
await runtest(page, "AssistantEmployerInfo");
//employee
await Promise.all([page.select("#OrgBusinessId", "117816201")]);
await Promise.all([page.type("#Address_Line1", "123 AutoTest St")]);
await Promise.all([page.type("#Address_City", "AutoTest")]);
await Promise.all([
page.select("#Address_ProvinceState", "AB"),
page.select("#Address_Country", "CA"),
page.type("#Address_PostalCode", "K1T3S7")
]);
await Promise.all([page.type("#Contact_FirstName", "Auto")]);
await Promise.all([page.type("#Contact_LastName", "Test")]);
await Promise.all([page.type("#Contact_AreaCode", "999")]);
await Promise.all([page.type("#Contact_PhoneNumber", "9999999")]);
await page.click(
"body > div > div.row > main > div.roe-wb-frmvld > form > button"
);
await page.waitForNavigation();
await runtest(page, "AssistantEmployeeInfo");
//employment
await Promise.all([page.type("#Sin", "123456782")]);
await Promise.all([page.type("#FirstName", "Auto")]);
await Promise.all([page.type("#LastName", "Test")]);
await Promise.all([page.type("#AddressLine1", "123 AutoTest St")]);
await Promise.all([page.type("#AddressLine2", "AutoTest")]);
await Promise.all([page.type("#PostalCode", "K1T3S7")]);
await page.click(
"body > div > div.row > main > div.roe-wb-frmvld > form > button"
);
await page.waitForNavigation();
await runtest(page, "AssistantEmploymentInfo");

await page.goto("https://srv136.services.gc.ca/ROE-RE/ROEWeb-REWeb/pro/Requests/Prints?org_id=-" + orgId);
await runtest(page, "RequestedPrintFiles");
Expand Down

0 comments on commit 992610a

Please # to comment.