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 ae02ae6 commit 9f81e9a
Showing 1 changed file with 77 additions and 12 deletions.
89 changes: 77 additions & 12 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@ const { AxePuppeteer } = require("axe-puppeteer");
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'])
.withTags(["wcag2a", "wcag2aa"])
.exclude([
"ul[role=menubar]" //Exlude MenuBar as it's WET and not accessible
])
Expand All @@ -23,12 +22,11 @@ async function runtest(page, name) {
}

(async () => {

const orgId = process.env.ROEWEB_ORGID;
const username = process.env.ROEWEB_UNAME;
const password = process.env.ROEWEB_PWORD;

const browser = await puppeteer.launch({ headless: true});
const browser = await puppeteer.launch({ headless: true });
console.log("Getting New Page");
const page = await browser.newPage();
console.log("Bypassing CSP");
Expand Down Expand Up @@ -58,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 @@ -101,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.close();
await browser.close();
Expand Down

0 comments on commit 9f81e9a

Please sign in to comment.