Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Masked input test #56

Draft
wants to merge 151 commits into
base: audit-2024
Choose a base branch
from
Draft
Changes from 2 commits
Commits
Show all changes
151 commits
Select commit Hold shift + click to select a range
c31cef2
Initial commit, Added input masking test, Added tests for masking fun…
sahilSingh-sapient Mar 5, 2024
11dc9e4
Updated input-masking tests. Added keyboard interaction test
sahilSingh-sapient Mar 6, 2024
4eba83a
Fix spelling in text content
Mar 7, 2024
a092667
Replace gremlin characters
Mar 7, 2024
07d888a
Fix spelling within meta info
Mar 13, 2024
5ebfe12
Improve scripts to use localhost if IP is blocked by firewall
Mar 12, 2024
5ec98a7
Switch the colours for npm notifications and do not use
Mar 12, 2024
7ce6950
Add a hover style to drawer button controls
Mar 12, 2024
1ca90a7
Add File work-in-progress comments and add to meta info
Mar 13, 2024
1071cb2
Update HTML closures
Mar 13, 2024
96eea04
Add npm file comment
Mar 13, 2024
0f47e77
Remove wip meta for pages linked in menu
Mar 13, 2024
54120b6
Add the .vscode folder to the .gitignore
Mar 13, 2024
d09603c
Improve sentences
Mar 13, 2024
773e444
Improve sentences on home page
Mar 14, 2024
13efdea
Merge pull request #64 from alisonhall/minor-html-comment-improvements
zoltan-dulac Mar 14, 2024
00fc8f0
Merge pull request #57 from alisonhall/fix-spelling
zoltan-dulac Mar 14, 2024
2783a0f
Merge pull request #60 from alisonhall/improve-script-for-firewall
zoltan-dulac Mar 14, 2024
cf25a11
Merge pull request #61 from alisonhall/switch-notification-colours
zoltan-dulac Mar 14, 2024
34f4f9b
Merge pull request #62 from alisonhall/hover-style-on-drawers
zoltan-dulac Mar 14, 2024
dd8d9cc
Update the sitemap with content previously work-in-progres
Mar 15, 2024
2500953
Update spelling and text on the code quality page
Mar 15, 2024
87e1d26
Clean up the unit test code that is shown on the code quality page
Mar 15, 2024
e759c99
Added test cases for keyboard and mouse interactions & input validati…
sahilSingh-sapient Mar 15, 2024
171ea28
Merge pull request #69 from alisonhall/update-sitemap
zoltan-dulac Mar 15, 2024
ded8acd
Minor grammar change
Mar 15, 2024
450259b
Merge pull request #70 from alisonhall/updates-to-code-quality-page
zoltan-dulac Mar 15, 2024
653c3e3
Corrected labels for mark tag tests.
zoltan-dulac Mar 18, 2024
4688c89
Standardize JS/Javascript/javascript to JavaScript
Mar 27, 2024
84b8005
Fix the NPM instruction notification text
Mar 27, 2024
3108c20
Fix spelling in animated-gif-with-pause-button
Mar 27, 2024
d5e55de
Fix and clarify the content about disabled buttons
Mar 27, 2024
3f7d7d6
Add an aria and JS disabled button example
Mar 27, 2024
0b91b5c
Improve text content for the button page
Mar 27, 2024
9e42185
Add package script to run ESLint tests
Mar 27, 2024
a582f56
Add GitHub Actions for pull request to main
Mar 27, 2024
f59ae8f
Only have basic ESLint action
Mar 28, 2024
68f7b88
Update eslint settings
Mar 28, 2024
95f3405
Rename actions file, add job for automation tests
Mar 28, 2024
277b78e
Fix ESLint issue
Mar 28, 2024
aea1419
Start server and run tests concurrently in actions
Mar 28, 2024
0d9a8a0
Install Chrome in GitHub Actions
Mar 28, 2024
ef369bd
Alow downgrades of Chrome
Mar 28, 2024
1de9f38
Fix carousel-init code
Mar 28, 2024
e50f30e
Debug the Chrome version
Mar 28, 2024
f7df1c9
Temporarily skip Pa11y tests
Mar 28, 2024
5e67425
Re-enable pa11y tests, add configs, use localhost
Mar 28, 2024
68773c2
Add Google Chrome path, use IP
Mar 28, 2024
920863f
Upgrade the pa11y-ci package version
Mar 28, 2024
ea5fd73
Update the pa11y config
Mar 28, 2024
ae2df7a
Set the pa11y executable path for Linux only
Mar 28, 2024
fb85859
Fix command
Mar 28, 2024
b4e9208
Try to separate starting the server from running the tests
Mar 28, 2024
72a835e
Cleanup actions
Mar 28, 2024
e116f46
Add installation comments
Mar 28, 2024
b374405
Update ESLint settings to match current code
Mar 28, 2024
7fe208f
Add a script command to run the ESLint tests
Mar 28, 2024
9acd534
Fix linting issues
Mar 28, 2024
165dcc0
Upgrade the pa11y-ci npm package version
Mar 28, 2024
6db6c4b
Add a GitHub action on push to run the ESLint scan
Mar 28, 2024
4fa498f
Add a GitHub action on push to run the automated tests
Mar 28, 2024
9cd2734
Update the pa11y config with an optional Chrome exec path
Mar 28, 2024
bf6c16e
Add additional options for installing Lynx and PHP on Linux
Mar 28, 2024
1997be5
Add a callout about updating the GitHub Actions if the prerequisites …
Mar 28, 2024
27e20ac
Add comments to github actions file
Mar 28, 2024
320d352
Install prettier related packages
Mar 28, 2024
e1c816e
Add basic prettier configuration
Mar 28, 2024
92f8cc9
Add filetype to callInAllWebComponents file
Mar 28, 2024
9382388
Update prettier config, integrate it with eslint
Apr 1, 2024
98626df
Add the husky and git-format-staged packages for git hooks
Apr 1, 2024
75caaec
Add a default editorconfig file for 4 spaces as the indent
Apr 1, 2024
028b48e
Update the husky prepare script to not install on prod or CI
Apr 1, 2024
09b7f21
Add a command to check if prettier needs to fix anything
Apr 1, 2024
d3846d6
Add a precommit hook to run prettier on staged lines of files
Apr 1, 2024
43202aa
Merge pull request #71 from alisonhall/update-button-page-content
zoltan-dulac Apr 4, 2024
efd04c6
Merge pull request #72 from alisonhall/add-github-actions-on-push
zoltan-dulac Apr 4, 2024
c3d06f2
Merge branch 'main' into add-automatic-formatting
Apr 4, 2024
b65e289
Fix file reference issue from Switch.js to switch.js
zoltan-dulac Apr 4, 2024
dbfbaf5
Merge pull request #77 from PublicisSapient/switch-case-sensitive-iss…
zoltan-dulac Apr 4, 2024
a1168f8
Merge branch 'main' into add-automatic-formatting
Apr 4, 2024
3b2cf19
Added option to choose different tab selected on load by looking at w…
zoltan-dulac Apr 16, 2024
8dc612c
Made the selected tab coded with a data attribute, since we don't wan…
zoltan-dulac Apr 16, 2024
23b4d58
Added documentation on selecting first tab functionality.
zoltan-dulac Apr 16, 2024
580088b
Merge pull request #78 from PublicisSapient/tabs-choose-select-on-load
zoltan-dulac Apr 16, 2024
ba9dfa7
- Fix docs for hamburger flyout menu.
zoltan-dulac May 12, 2024
ca2998c
update carousel unit test.
zoltan-dulac May 12, 2024
ea3709b
Adding carousel unit test fix.
zoltan-dulac May 12, 2024
b76417f
Fix the carousel
zoltan-dulac May 12, 2024
0b402c9
Add latest google chrome in push-actions.yml
zoltan-dulac May 12, 2024
61e0b4e
Force Chrome version update to 124.0 in push-actions.yml
zoltan-dulac May 12, 2024
651478a
Fix defect in push-actions.yml chrome install script.
zoltan-dulac May 12, 2024
89e37c8
Fix false positive on the 2nd carousel in axe.
zoltan-dulac May 12, 2024
02e3761
Added comment about why axe test was excluded for 2nd carousel example.
zoltan-dulac May 12, 2024
74e721d
Merge pull request #80 from PublicisSapient/hamburger-menu-documentation
zoltan-dulac May 12, 2024
f7089bb
Added instructions for Github Actions.
zoltan-dulac May 12, 2024
082441a
Merge pull request #81 from PublicisSapient/update-unit-test-docs-2024
zoltan-dulac May 13, 2024
71a0ac4
Updated image.
zoltan-dulac May 13, 2024
f86b6ac
Merge branch 'main' into add-automatic-formatting
zoltan-dulac May 24, 2024
b7ce0b8
Update package-lock
May 24, 2024
36ccd95
Add comments around formatting and commits
May 24, 2024
0f63630
Merge pull request #85 from PublicisSapient/add-automatic-formatting-2
zoltan-dulac May 24, 2024
75f9248
Add README info about contributing and PRs
May 24, 2024
a4438bd
Apply automatic formatting to all files
May 24, 2024
58395b0
Merge pull request #87 from PublicisSapient/apply-automatic-formatting
zoltan-dulac May 24, 2024
62e488a
Merge branch 'main' into add-pr-info-to-readme
zoltan-dulac May 24, 2024
521677a
Merge pull request #86 from PublicisSapient/add-pr-info-to-readme
alisonhall May 28, 2024
e2c816d
Adding npm publish information.
zoltan-dulac May 29, 2024
7854e1c
Merge pull request #105 from PublicisSapient/dev-notes-2024
zoltan-dulac May 29, 2024
6e58fca
Use the automatically changed CSS file formatting
May 30, 2024
b315e36
Merge pull request #107 from PublicisSapient/update-css-formatting
alisonhall May 30, 2024
121c5a9
Fixed #67: Needed to make folder for cache if not there.
AbsentSemicolon Jun 4, 2024
b980505
Merge pull request #111 from PublicisSapient/fix-marquee-demo
zoltan-dulac Jun 4, 2024
69cc56e
Fixed PHP binPath for windows users
lunarias Jun 4, 2024
213880c
Fix the command to format files on pre-commit
Jun 4, 2024
a40e337
Format existing files
Jun 4, 2024
3987b17
Fix the link comment format
Jun 4, 2024
8d2cfbe
Merge pull request #114 from PublicisSapient/fix-format-precommit
alisonhall Jun 4, 2024
2ec0b8e
test commit for readme file
josiahwilliams Jun 5, 2024
6e56402
test commit for new github userid
josiahwilliams Jun 5, 2024
f0275bf
Adding additional instructions for Java install
josiahwilliams Jun 5, 2024
e3fe8b8
Updates info for testing
josiahwilliams Jun 5, 2024
3843530
Updates Java install instructions. Clarifies local server for tests
josiahwilliams Jun 5, 2024
fbae215
removing : and space between asterik
Neha-Singla Jun 5, 2024
4ef405f
Merge pull request #115 from PublicisSapient/chore/update-readme
josiahwilliams Jun 6, 2024
eea84f0
Merge branch 'main' into binPath-fixed
josiahwilliams Jun 6, 2024
37979f9
Merge pull request #112 from PublicisSapient/binPath-fixed
lunarias Jun 6, 2024
2458cbe
commiting asterik space fix
Neha-Singla Jun 6, 2024
d738a6b
Merge branch 'main' into 89-vd-change-form-error-checking-page
Neha-Singla Jun 6, 2024
4739fb3
PR comments
Neha-Singla Jun 6, 2024
49b87fa
Merge branch '89-vd-change-form-error-checking-page' of https://githu…
Neha-Singla Jun 6, 2024
fc3fd5d
feat: Adding icons next to headings to have summarized info
shiprarawal Jun 7, 2024
2202040
Fix prettier precommit for images
Jun 10, 2024
b7744a4
Merge pull request #129 from PublicisSapient/add-image-to-heading
alisonhall Jun 10, 2024
b124b90
updating with main
Neha-Singla Jun 10, 2024
9bf2d4e
updating with main
Neha-Singla Jun 10, 2024
ff0c5d2
Merge branch 'main' of https://github.com/PublicisSapient/enable-a11y…
Neha-Singla Jun 10, 2024
f1ab975
Merge pull request #119 from PublicisSapient/89-vd-change-form-error-…
Neha-Singla Jun 10, 2024
cc4e4d7
Merge branch 'main' into fix-precommit-for-images
alisonhall Jun 11, 2024
490a831
Merge pull request #132 from PublicisSapient/fix-precommit-for-images
alisonhall Jun 11, 2024
6f1b4a1
Merge branch 'main' of ssh://ssh.github.com:443/PublicisSapient/enabl…
zoltan-dulac Jun 11, 2024
f3ac314
Adding mouseSelection.png
zoltan-dulac Jun 11, 2024
5e8a32b
I think I added the right dependency for robotjs ... let's see.
zoltan-dulac Jun 11, 2024
771a561
Attempt 2 to get robotjs running on CI/CD pipeline: Installing Xvfb
zoltan-dulac Jun 11, 2024
f2edc86
Attempt 3 for CI/CD fix: installing libpng++-dev
zoltan-dulac Jun 11, 2024
7186308
Attempt #4
zoltan-dulac Jun 11, 2024
715cea4
Attempt #4a
zoltan-dulac Jun 11, 2024
175eaf7
commiting css change in .less file also
Neha-Singla Jun 12, 2024
eeb1ba8
Merge pull request #137 from PublicisSapient/89-vd-change-form-error-…
Neha-Singla Jun 12, 2024
8e4924d
Attempt #5 -- ensuring the ESLINT npm ci is done after ensuring X11 l…
zoltan-dulac Jun 12, 2024
4ebcd9d
Merge branch 'main' of ssh://ssh.github.com:443/PublicisSapient/enabl…
zoltan-dulac Jun 12, 2024
6e9fbb0
Merge with main.
zoltan-dulac Jun 12, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions js/test/input-mask.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
"use strict";

import config from "./test-config.js";
import testHelpers from "./test-helpers.js";
import puppeteer from "puppeteer";
let mobileBrowser, desktopBrowser;

describe("Input mask test suite", () => {
beforeAll(async () => {
mobileBrowser = await testHelpers.getMobileBrowser();
desktopBrowser = await testHelpers.getDesktopBrowser();
});
afterAll(async () => {
await testHelpers.pause();
mobileBrowser.close();
desktopBrowser.close();
});
// Masking functionality tests
it("Testing the masking functionality", async () => {
const page = await desktopBrowser.newPage();
await page.goto(`${config.BASE_URL}/input-mask.php`);
await page.type("#tel", "1234567890");
const maskedTelephone = await page.$eval(
"span.enable-input-mask__mask-pre-val",
(span) => span.textContent
);
expect(maskedTelephone).toBe("123-456-7890");
});
it("should render winkey masked correctly", async () => {
const page = await desktopBrowser.newPage();
await page.goto(`${config.BASE_URL}/input-mask.php`);
await page.type("#winkey", "abcdefghijklmnopqrstuvwxy");
const maskedWinKey = await page.$$eval(
"span.enable-input-mask__mask-pre-val",
(spans) => spans[1].textContent
);
expect(maskedWinKey).toBe("ABCDE-FGHIJ-KLMNO-PQRST-UVWXY");
});
it("should render cc masked correctly (non Amex)", async () => {
const page = await desktopBrowser.newPage();
await page.goto(`${config.BASE_URL}/input-mask.php`);
await page.type("#cc", "5555555555555555");
const maskedWinKey = await page.$$eval(
"span.enable-input-mask__mask-pre-val",
(spans) => spans[2].textContent
);
expect(maskedWinKey).toBe("5555 5555 5555 5555");
});
it("should render cc masked correctly (Amex)", async () => {
const page = await desktopBrowser.newPage();
await page.goto(`${config.BASE_URL}/input-mask.php`);
await page.type("#cc", "3455555555555555");
const maskedWinKey = await page.$$eval(
"span.enable-input-mask__mask-pre-val",
(spans) => spans[2].textContent
);
expect(maskedWinKey).toBe("3455 555555 55555");
});
//Simulate keyboard interaction

it("should render formatted value correctly post keyboard interaction", async () => {
const page = await desktopBrowser.newPage();
await page.goto(`${config.BASE_URL}/input-mask.php`, {
waitUntil: "domcontentloaded",
});

const telInput = "#tel";
await page.focus(telInput);
await page.keyboard.type("1234567890");
await page.keyboard.press("Backspace");
await page.keyboard.press("ArrowLeft");
await page.keyboard.type("1");
const maskedTelephone = await page.$eval(
"span.enable-input-mask__mask-pre-val",
(span) => span.textContent
);
expect(maskedTelephone).toBe("123-456-781");
});
});
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are great so far! Thank you.

I would also like to ensure we test the mouse functionality as well:

  1. Can we have a test that will click in the middle of a filled out masked input field? I want the test to be able to detect if the visual cursor and the input cursor match up.
  2. Another similar test to see if, when selecting a string in the middle of the input field, the visual selected and the input selected area match up.
  3. Checking what happens if invalid input occurs. e.g. letters in phone numbers.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy, will work on getting these in.