Skip to content

Commit

Permalink
Merge develop into release/v1.29 (#1068)
Browse files Browse the repository at this point in the history
  • Loading branch information
nmanu1 committed May 10, 2022
2 parents a38eac2 + de6108a commit c818d20
Show file tree
Hide file tree
Showing 10 changed files with 79 additions and 203 deletions.
25 changes: 6 additions & 19 deletions .github/workflows/coverage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,9 @@ on:
pull_request:

jobs:
Coveralls:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npx jest tests/static/ --coverage
- name: Coveralls
uses: coverallsapp/github-action@master
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
call_coveralls:
uses: yext/slapshot-reusable-workflows/.github/workflows/coverage.yml@v1
with:
test_script: npx jest tests/static/ --coverage
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
118 changes: 37 additions & 81 deletions .github/workflows/percy-snapshots.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: Percy Snapshots

on:
on:
push:
branches-ignore: dev/*
pull_request:
Expand All @@ -14,90 +14,46 @@ jobs:
- id: nonce
run: echo "::set-output name=result::${{ github.run_id }}-$(date +%s)"

default-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_default:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

iframe-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_iframe:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js iframe
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js iframe
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

spanish-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_spanish:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js spanish
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js spanish
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}

rtl-snapshots:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.18]
call_snapshots_rtl:
needs: nonce
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- name: Percy snapshots
run: npx percy exec --parallel -- node tests/percy/index.js rtl
env:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
uses: yext/slapshot-reusable-workflows/.github/workflows/percy_snapshots.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
percy_script: npx percy exec --parallel -- node tests/percy/index.js rtl
PERCY_PARALLEL_NONCE: ${{ needs.nonce.outputs.result }}
PERCY_PARALLEL_TOTAL: 4
secrets:
PERCY_TOKEN: ${{ secrets.PERCY_TOKEN }}
20 changes: 4 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,7 @@ name: Run Tests
on: [push, pull_request]

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
node-version: [12.x, 14.x, 15.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm test
call_run_tests:
uses: yext/slapshot-reusable-workflows/.github/workflows/run_tests.yml@v1
with:
build_script: ''
26 changes: 5 additions & 21 deletions .github/workflows/sync_develop_and_main.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,11 @@
name: create PR from main to develop
name: Create PR from main to develop

on:
push:
branches: [main, master]

permissions:
contents: read
pull-requests: write

jobs:
createPullRequest:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: extract package version
id: vars
run: |
PACKAGE_VERSION="v$(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')"
echo ::set-output name=tag::${PACKAGE_VERSION}
- uses: repo-sync/pull-request@v2
with:
source_branch: "${{ github.event.repository.default_branch }}"
destination_branch: "develop"
pr_title: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
pr_body: "Merge ${{ github.event.repository.default_branch }} (${{ steps.vars.outputs.tag }}) into develop"
github_token: ${{ secrets.GITHUB_TOKEN }}
call_sync_develop_and_main:
uses: yext/slapshot-reusable-workflows/.github/workflows/sync_develop_and_main.yml@v1
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
49 changes: 4 additions & 45 deletions .github/workflows/version-update.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,49 +4,8 @@ on:
push:
branches: [release/*, hotfix/*]

permissions:
contents: write
pull-requests: write

jobs:
update-version:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
- name: update package version
id: vars
run: |
BRANCH_NAME="${GITHUB_REF#refs/heads/}"
PACKAGE_VERSION="${GITHUB_REF##*/}"
echo ::set-output name=branch::${BRANCH_NAME}
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+(\.[0-9]+)?$ ]]
then
if [[ $PACKAGE_VERSION =~ ^v[0-9]+\.[0-9]+$ ]]
then
PACKAGE_VERSION="${PACKAGE_VERSION}.0"
fi
echo ::set-output name=version::${PACKAGE_VERSION}
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
if npm version ${PACKAGE_VERSION} | tee >( grep -q 'npm ERR! Version not changed' )
then
echo "Package version is already in sync with branch name."
echo ::set-output name=should_create_pr::0
exit 0
fi
echo ::set-output name=should_create_pr::1
git push -u origin HEAD:"dev/update-version-${PACKAGE_VERSION}"
else
echo "Branch name ${BRANCH_NAME} does not have the correct format with package version."
exit 1
fi
- name: create version update pr
if: steps.vars.outputs.should_create_pr == 1
uses: repo-sync/pull-request@v2
with:
source_branch: "dev/update-version-${{ steps.vars.outputs.version }}"
destination_branch: "${{ steps.vars.outputs.branch }}"
pr_title: "Update Package Version to ${{ steps.vars.outputs.version }}"
pr_body: "*An automated PR which updates the version number in package.json and package-lock.json files*"
github_token: ${{ secrets.GITHUB_TOKEN }}
call_version_update:
uses: yext/slapshot-reusable-workflows/.github/workflows/version_update.yml@v1
secrets:
caller_github_token: ${{ secrets.GITHUB_TOKEN }}
21 changes: 4 additions & 17 deletions .github/workflows/wcag_test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,7 @@ on:
branches: [develop, hotfix/*, release/*, support/*]

jobs:
WCAG-test:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [14.x]

steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v2
with:
node-version: ${{ matrix.node-version }}
- run: npm ci
- run: npm run setup-test-site
- run: npm run build-test-site
- run: npm run wcag
call_wcag_test:
uses: yext/slapshot-reusable-workflows/.github/workflows/wcag_test.yml@v1
with:
build_script: npm run setup-test-site && npm run build-test-site
6 changes: 5 additions & 1 deletion layouts/html.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -146,9 +146,13 @@
} else if (window.isOverlay) {
window.Overlay.onMessage(message);
} else if (message.eventType && message.eventType === 'click') {
ANSWERS.components
ANSWERS?.components
.getActiveComponents('AutoComplete')
.forEach(autocompleteComponent => autocompleteComponent.close());
} else if (message.action === 'update-tab-navigation') {
ANSWERS?.components
.getActiveComponents('Navigation')
.forEach(navigationComponent => navigationComponent.setParentUrl(message.parentUrl));
}
}
};
Expand Down
6 changes: 5 additions & 1 deletion script/iframe-messaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,8 @@ ANSWERS.core.storage.registerListener({
sessionId: ANSWERS.core.getOrSetupSessionId()
}));
}
});
});

window.parentIFrame.sendMessage(JSON.stringify({
action: 'answers-initialized'
}));
7 changes: 7 additions & 0 deletions static/js/iframe-common.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,13 @@ export function generateIFrame(domain, answersExperienceFrame) {
document.body.scrollTop = iframeOffsetTop; // For Safari
return;
}
if (message.action === 'answers-initialized') {
sendToIframe({
action: 'update-tab-navigation',
parentUrl: window.location.href
});
return;
}
const params = message.params;
const pageTitle = message.pageTitle;
pageTitle && (iframe.title = pageTitle);
Expand Down
4 changes: 2 additions & 2 deletions tests/wcag/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@ const PORT = 5042;
* API documentation: https://github.com/dequelabs/axe-core/blob/master/doc/API.md
* - set reporter to 'no-passes' to only return violation results
* - set runOnly with tag values below to run WCAG standards:
* - WCAG 2.0 Level A, AA, AAA
* - WCAG 2.0 Level A, AA
* - WCAG 2.1 Level A, AA
*/
const config = {
reporter: "no-passes",
runOnly: {
type: 'tag',
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa', 'wcag2aaa'],
values: ['wcag2a', 'wcag2aa', 'wcag21a', 'wcag21aa'],
}
}

Expand Down

0 comments on commit c818d20

Please sign in to comment.