Skip to content

Commit

Permalink
fix: login improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
forsti0506 committed Jan 24, 2021
1 parent c1ed243 commit 8007276
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 24 deletions.
22 changes: 3 additions & 19 deletions .idea/workspace.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion lib/a11y-sitechecker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -167,12 +167,13 @@ async function analyzeSite(url: string, axeSpecs: Spec, page: Page, config: Conf
await analyzeSite(page.url(), axeSpecs, page, config);
} catch (e) {
log('seems like click was no navigation. Analyze and do it. ' + e);
await waitForHTML(page);
if (page.url() !== url && !alreadyVisited.includes(url)) {
await analyzeSite(page.url(), axeSpecs, page, config);
await page.goto(url, { waitUntil: 'load' });
await waitForHTML(page);
} else if (config.analyzeClicksWithoutNavigation) {
debug('Experimintal feature! Please check if there are to much clicks!');
debug('Experimintal feature! Please check if there are to many clicks!');
const axe = await new AxePuppeteer(page);
axe.configure(axeSpecs);
const axeResults = await axe.analyze();
Expand Down
13 changes: 9 additions & 4 deletions lib/utils/login.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,15 @@ export async function executeLogin(url: string, page: Page, config: Config): Pro
if (!config.login) {
return;
}
await page.goto(url, { waitUntil: 'networkidle2' });
await waitForHTML(page);
await saveScreenshot(page, config.imagesPath, 'loginSite.png', config.saveImages);
await page.screenshot({ path: 'images/yeah.png' });
try {
await page.goto(url, { waitUntil: 'networkidle2' });
await page.waitForNavigation({ waitUntil: 'networkidle2' });
await waitForHTML(page);
await saveScreenshot(page, config.imagesPath, 'loginSite.png', config.saveImages);
} catch (e) {
await waitForHTML(page);
await saveScreenshot(page, config.imagesPath, 'loginSite.png', config.saveImages);
}
for (const step of config.login) {
for (const input of step.input) {
await page.waitForSelector(input.selector);
Expand Down

0 comments on commit 8007276

Please sign in to comment.