Skip to content

Commit

Permalink
feat: add a browser lib to produce sa11y minified JS bundle (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
Mohan Raj Rajamanickam authored Aug 19, 2020
1 parent 81c09be commit 8a44543
Show file tree
Hide file tree
Showing 26 changed files with 1,833 additions and 1,052 deletions.
3 changes: 1 addition & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ jobs:
- checkout
- run: yarn build:ci
- run: yarn test:ci
- store_artifacts:
path: coverage
- run: yarn codecov
workflows:
build-and-test:
jobs:
Expand Down
8 changes: 0 additions & 8 deletions .github/workflows-disabled/README.md

This file was deleted.

23 changes: 0 additions & 23 deletions .github/workflows-disabled/build.yml

This file was deleted.

29 changes: 0 additions & 29 deletions .github/workflows-disabled/codecov.yml

This file was deleted.

54 changes: 54 additions & 0 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: 'CodeQL'

on:
push:
branches: [master, media]
pull_request:
# The branches below must be a subset of the branches above
branches: [master]
schedule:
- cron: '0 22 * * 2'

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest

steps:
- name: Checkout repository
uses: actions/checkout@v2
with:
# We must fetch at least the immediate parents so that if this is
# a pull request then we can checkout the head.
fetch-depth: 2

# If this run was triggered by a pull request event, then checkout
# the head of the pull request instead of the merge commit.
- run: git checkout HEAD^2
if: ${{ github.event_name == 'pull_request' }}

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
# Override language selection by uncommenting this and choosing your languages
with:
languages: javascript

# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl

# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language

#- run: |
# make bootstrap
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
22 changes: 15 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,35 @@
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->


- [(2020-06-25)](#2020-06-25)
- [0.3.0-beta (2020-08-12)](#030-beta-2020-08-12)
- [Features](#features)
- [0.2.0-beta (2020-06-25)](#020-beta-2020-06-25)
- [Features](#features-1)
- [Bug Fixes](#bug-fixes)
- [BREAKING CHANGES](#breaking-changes)
- [(2020-06-02) v0.1.0-alpha](#2020-06-02-v010-alpha)
- [Features](#features-1)
- [(2020-05-29)](#2020-05-29)
- [Features](#features-2)
- [(2020-05-29)](#2020-05-29)
- [Features](#features-3)
- [(2020-05-07)](#2020-05-07)
- [Bug Fixes](#bug-fixes-1)
- [Features](#features-3)
- [Features](#features-4)
- [(2020-04-07)](#2020-04-07)
- [Bug Fixes](#bug-fixes-2)
- [Features](#features-4)
- [Features](#features-5)
- [(2020-03-20)](#2020-03-20)
- [Bug Fixes](#bug-fixes-3)
- [Features](#features-5)
- [Features](#features-6)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

# (2020-06-25)
# 0.3.0-beta (2020-08-12)

### Features

- **browser-lib:** add a new package for producing bundled minified version of sa11y ([#32](https://github.com/salesforce/sa11y/pull/32))

# [0.2.0-beta](https://github.com/salesforce/sa11y/releases/tag/v0.2.0-beta) (2020-06-25)

### Features

Expand Down
13 changes: 12 additions & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ We want to encourage the developer community to contribute to Sa11y. This guide
- [Building](#building)
- [Testing](#testing)
- [Unit Testing](#unit-testing)
- [Integration Testing](#integration-testing)
- [Release](#release)
- [Use local npm registry for testing](#use-local-npm-registry-for-testing)
- [Editor Configurations](#editor-configurations)
Expand Down Expand Up @@ -126,6 +127,14 @@ If you want to debug these tests, you can do as follows:

Your test should now be running in the Chrome debugger. You get your handy console to poke around all sorts of stuff! Now simply hit "Enter" in the terminal running your Jest process anytime you want to re-run your currently selected specs. You'll be dropped right back into the Chrome debugger.

### Integration Testing

- Integration tests are available for certain packages executed using [WebdriverIO](https://webdriver.io/)
- To [debug WebdriverIO tests](https://webdriver.io/docs/api/browser/debug.html)
- Add `await browser.debug();` to introduce a breakpoint
- Run test using `yarn test:debug` or `DEBUG=true yarn test`
- To apply different configuration settings to aid debugging (e.g. disable headless, increase timeouts, increase logging)

## Release

- Generate Changelog
Expand Down Expand Up @@ -256,7 +265,9 @@ the ones related to the files you make changes to!

#### Run tests

Test your change by running the unit tests and integration tests. Instructions [here](#testing).
Test your change by running [the unit tests and integration tests](#testing).

- `yarn test`

#### Test CI config

Expand Down
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

Automated Accessibility Testing Libraries and Tools ([@sa11y packages](https://www.npmjs.com/org/sa11y)) based on [axe-core][axe] providing support for [Jest](#jest-integration) unit tests, [WebdriverIO](#wdio-integration) component/integration tests used by teams in Salesforce. However, they are not specific to Salesforce and can be used to test any UI [supported by axe-core](https://github.com/dequelabs/axe-core#supported-browsers) for accessibility. These libraries are designed to be flexible, customizable and reusable to support automated accessibility testing in different testing workflows from unit to integration tests.

[![Build](https://circleci.com/gh/salesforce/sa11y.svg?style=svg)](https://app.circleci.com/pipelines/github/salesforce/sa11y?branch=master)
[![Build Status](https://circleci.com/gh/salesforce/sa11y.svg?style=svg)](https://app.circleci.com/pipelines/github/salesforce/sa11y?branch=master)
[![Code Coverage](https://codecov.io/gh/salesforce/sa11y/branch/master/graph/badge.svg)](https://codecov.io/gh/salesforce/sa11y)

<!-- Temp disabling code cov badge due to https://github.com/salesforce/sa11y/issues/14
Re-enable with a code cov service that works with CircleCi -->
Expand All @@ -19,6 +20,7 @@ Automated Accessibility Testing Libraries and Tools ([@sa11y packages](https://w
- [assertAccessible API](#assertaccessible-api)
- [a11y results formatter](#a11y-results-formatter)
- [Preset accessibility rules](#preset-accessibility-rules)
- [Minified bundle for testing in browser](#minified-bundle-for-testing-in-browser)
- [Internal packages](#internal-packages)
- [Test utilities](#test-utilities)
- [Integration Tests](#integration-tests)
Expand Down Expand Up @@ -72,6 +74,10 @@ This repo contains the following packages for automated accessibility testing:
- The Recommended preset rule is used by default in the Jest a11y matcher and assert Accessible APIs
- The APIs can be overridden to use the Base or Full ruleset as necessary

### [Minified bundle for testing in browser](./packages/browser-lib/README.md)

- Provides a minified version of selected `@sa11y` libraries to be injected into a browser (using webdriver) and executed from integration testing workflows.

### Internal packages

#### [Test utilities](./packages/test-utils/README.md)
Expand Down
2 changes: 1 addition & 1 deletion cSpell.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"ignorePaths": ["node_modules/**", "package.json"],
"ignoreWords": ["circleci", "CNCF", "dlitem", "doctoc", "SPDX", "tsdoc", "wcag", "wdio", "webdriverio"],
"ignoreWords": ["circleci", "CNCF", "dlitem", "doctoc", "iife", "SPDX", "tsdoc", "wcag", "wdio", "webdriverio"],
"flagWords": ["master-slave", "slave", "blacklist", "whitelist"],
"allowCompoundWords": true
}
4 changes: 4 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
comment:
layout: 'reach, diff, files'
branches: # branch names that can post comment
- 'master'
3 changes: 2 additions & 1 deletion jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
* For full license text, see the LICENSE file in the repo root or https://opensource.org/licenses/BSD-3-Clause
*/

const browserLibTestPath = '<rootDir>/packages/browser-lib';
const integrationTestPath = '<rootDir>/packages/test-integration';
const wdioTestPath = '<rootDir>/packages/wdio';

Expand All @@ -18,7 +19,7 @@ module.exports = {
},
},
// Exclude integration tests from being run with config as it has its own config and setup
testPathIgnorePatterns: [integrationTestPath, wdioTestPath],
testPathIgnorePatterns: [browserLibTestPath, integrationTestPath, wdioTestPath],
// Direct Jest to read the jest config file from integration tests
projects: ['<rootDir>', integrationTestPath],
};
57 changes: 29 additions & 28 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "sa11y-monorepo",
"version": "0.2.0-beta",
"version": "0.3.0-beta",
"private": true,
"description": "Salesforce Accessibility Automated Testing Libraries and Tools (@sa11y packages)",
"license": "BSD-3-Clause",
Expand All @@ -16,10 +16,10 @@
"packages/*"
],
"scripts": {
"build": "tsc --build",
"build": "tsc --build && yarn workspace @sa11y/browser-lib build",
"build:ci": "yarn install --frozen-lockfile && yarn build",
"build:clean": "yarn build --clean && rimraf packages/**/dist && yarn install && yarn build",
"build:watch": "yarn build --watch",
"build:clean": "tsc --build --clean && rimraf packages/**/dist && yarn build:ci",
"build:watch": "tsc --build --watch",
"commit": "! git diff --cached --exit-code && lint-staged && git-cz",
"install:clean": "lerna clean --yes; yarn install",
"lint": "eslint . --ext ts,js,md",
Expand All @@ -42,7 +42,7 @@
"test:clean": "yarn build:clean && yarn test:ci",
"test:debug": "node --inspect node_modules/.bin/jest --runInBand --watch",
"test:watch": "yarn test --watch",
"test:wdio": "yarn workspace @sa11y/wdio test",
"test:wdio": "yarn workspace @sa11y/wdio test; yarn workspace @sa11y/browser-lib test ",
"update": "yarn audit; yarn upgrade-interactive --latest && yarn test:clean"
},
"config": {
Expand All @@ -55,57 +55,58 @@
"commit-msg": "commitlint -e $GIT_PARAMS",
"pre-commit": "lint-staged",
"pre-push": "yarn test:clean",
"post-checkout": "yarn install && yarn build"
"post-checkout": "yarn build:ci"
}
},
"devDependencies": {
"@babel/core": "^7.10.4",
"@babel/preset-env": "^7.10.4",
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@babel/preset-typescript": "^7.10.4",
"@commitlint/cli": "^9.1.1",
"@commitlint/config-conventional": "^9.1.1",
"@types/jest": "^26.0.4",
"@types/node": "^14.0.23",
"@types/jest": "^26.0.10",
"@types/node": "^14.6.0",
"@typescript-eslint/eslint-plugin": "^2.33.0",
"@typescript-eslint/parser": "^2.33.0",
"@wdio/cli": "^6.2.0",
"@wdio/local-runner": "^6.2.0",
"@wdio/mocha-framework": "^6.2.0",
"@wdio/spec-reporter": "^6.1.23",
"@wdio/sync": "^6.2.0",
"babel-jest": "^26.1.0",
"chromedriver": "^83.0.1",
"@wdio/cli": "^6.4.0",
"@wdio/local-runner": "^6.4.0",
"@wdio/mocha-framework": "^6.4.0",
"@wdio/spec-reporter": "^6.4.0",
"@wdio/sync": "^6.4.0",
"babel-jest": "^26.3.0",
"chromedriver": "^84.0.1",
"codecov": "^3.7.2",
"commitizen": "^4.1.2",
"conventional-changelog-cli": "^2.0.34",
"cspell": "^4.0.61",
"depcheck": "^1.0.0",
"conventional-changelog-cli": "^2.1.0",
"cspell": "^4.1.0",
"depcheck": "^1.2.0",
"doctoc": "^1.4.0",
"eslint": "^7.4.0",
"eslint": "^7.7.0",
"eslint-config-prettier": "^6.11.0",
"eslint-import-resolver-typescript": "^2.0.0",
"eslint-import-resolver-typescript": "^2.2.1",
"eslint-plugin-eslint-comments": "^3.1.2",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-jest": "^23.18.0",
"eslint-plugin-jest": "^23.20.0",
"eslint-plugin-license-header": "^0.2.0",
"eslint-plugin-markdown": "^2.0.0-alpha.0",
"eslint-plugin-notice": "^0.9.10",
"eslint-plugin-prettier": "^3.1.4",
"eslint-plugin-tsdoc": "^0.2.4",
"eslint-plugin-tsdoc": "^0.2.6",
"eslint-watch": "^7.0.0",
"graphviz-cli": "^1.0.0",
"husky": "^4.2.5",
"jest": "^26.1.0",
"jest": "^26.4.0",
"lerna": "^3.21.0",
"lint-staged": "^10.2.2",
"lockfile-lint": "^4.3.7",
"markdown-link-check": "^3.8.1",
"package-dependency-graph": "^1.7.1",
"package-dependency-graph": "^1.9.1",
"prettier": "^2.0.5",
"rimraf": "^3.0.2",
"ts-node": "^8.10.2",
"typescript": "^3.9.6",
"typescript": "^3.9.7",
"wdio-chromedriver-service": "^6.0.3",
"webdriverio": "^6.2.0"
"webdriverio": "^6.4.0"
},
"engines": {
"node": "^10 || ^12"
Expand Down
Loading

0 comments on commit 8a44543

Please sign in to comment.