From 8172b61a8b32f70503f95e01a773fbc564ef7ef0 Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Mon, 28 Nov 2022 10:48:23 -0500 Subject: [PATCH 1/4] Update GH worflows to remove deprecation warnings (#1789) Upgrade GitHub actions (`actions/checkout`, `actions/setup-node`, `actions/upload-artifact`, `actions/download-artifact`, and `aws-actions/configure-aws-credentials`) and update `set-output` calls to remove all deprecation warnings from the workflows. These warnings were for the deprecation of [Node 12](https://github.blog/changelog/2022-09-22-github-actions-all-actions-will-begin-running-on-node16-instead-of-node12/) and for the `set-output` and `save-state` [commands](https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/). J=SLAP-2427 TEST=manual Test in this PR as well as on `dev/test-output-changes`. See that the warnings are no longer present (except for the exception mentioned in [this PR](https://github.com/yext/slapshot-reusable-workflows/pull/25)). Note: The Browserstack acceptance test is failing because the Google Maps JS API dropped support for IE11 recently (see Oliver's [post](https://yext.slack.com/archives/C016ZKY42CF/p1668808136926099) on Slack). --- .github/workflows/acceptance.yml | 12 ++++++------ .github/workflows/acceptance_search_bar.yml | 6 +++--- .github/workflows/build.yml | 8 ++++---- .github/workflows/build_i18n.yml | 14 +++++++------- .github/workflows/deploy.yml | 8 ++++---- .github/workflows/deploy_hold.yml | 10 +++++----- .github/workflows/extract_versions.yml | 6 +++--- .github/workflows/format_branch_name.yml | 2 +- .github/workflows/miscellaneous_tests.yml | 6 +++--- .github/workflows/should_deploy_major_version.yml | 6 +++--- .github/workflows/unit_test.yml | 8 ++++---- 11 files changed, 43 insertions(+), 43 deletions(-) diff --git a/.github/workflows/acceptance.yml b/.github/workflows/acceptance.yml index 5e8290bb7..6e7a4dc04 100644 --- a/.github/workflows/acceptance.yml +++ b/.github/workflows/acceptance.yml @@ -13,15 +13,15 @@ jobs: name: Headless Acceptance runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ @@ -31,15 +31,15 @@ jobs: name: Browserstack Acceptance runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ diff --git a/.github/workflows/acceptance_search_bar.yml b/.github/workflows/acceptance_search_bar.yml index 677c6ee78..34be78983 100644 --- a/.github/workflows/acceptance_search_bar.yml +++ b/.github/workflows/acceptance_search_bar.yml @@ -13,15 +13,15 @@ jobs: name: Headless Acceptance runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05653b2ea..be8c6d674 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,18 +13,18 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - run: npm run ${{ inputs.build_script }} - name: Create build-output artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build-output - path: dist/ \ No newline at end of file + path: dist/ diff --git a/.github/workflows/build_i18n.yml b/.github/workflows/build_i18n.yml index 688ae9bd1..828af0c97 100644 --- a/.github/workflows/build_i18n.yml +++ b/.github/workflows/build_i18n.yml @@ -14,16 +14,16 @@ jobs: outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - - uses: actions/setup-node@v2 + - uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - id: set-matrix run: | - echo ::set-output name=matrix::$(node -e 'console.log(require("./conf/i18n/constants").ALL_LANGUAGES)') + echo matrix=$(node -e 'console.log(require("./conf/i18n/constants").ALL_LANGUAGES)') >> $GITHUB_OUTPUT build: needs: create_language_matrix @@ -32,11 +32,11 @@ jobs: matrix: language: ${{ fromJson(needs.create_language_matrix.outputs.matrix) }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' @@ -47,7 +47,7 @@ jobs: npm run size fi - name: Create build-output artifact - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: build-output - path: dist/ \ No newline at end of file + path: dist/ diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 39b6bb2ba..b9db3f7ca 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -26,14 +26,14 @@ jobs: deploy-aws: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -50,7 +50,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ diff --git a/.github/workflows/deploy_hold.yml b/.github/workflows/deploy_hold.yml index 6c0bc7a48..ae637ec02 100644 --- a/.github/workflows/deploy_hold.yml +++ b/.github/workflows/deploy_hold.yml @@ -27,14 +27,14 @@ jobs: runs-on: ubuntu-latest environment: production # sets in github repo with reviewer requirement protection rule steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ - name: Configure AWS Credentials - uses: aws-actions/configure-aws-credentials@v1 + uses: aws-actions/configure-aws-credentials@v1-node16 with: aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} @@ -52,7 +52,7 @@ jobs: steps: - uses: actions/checkout@v3 - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ @@ -68,4 +68,4 @@ jobs: parent: false destination: assets-eu.sitescdn.net/${{ inputs.bucket }}/${{ inputs.directory }} headers: |- - cache-control: ${{ inputs.cache-control }} \ No newline at end of file + cache-control: ${{ inputs.cache-control }} diff --git a/.github/workflows/extract_versions.yml b/.github/workflows/extract_versions.yml index 216d4b032..52a6d5c9d 100644 --- a/.github/workflows/extract_versions.yml +++ b/.github/workflows/extract_versions.yml @@ -28,10 +28,10 @@ jobs: run: | MAJOR_VERSION="$(echo "${GITHUB_REF_NAME##${{ inputs.ignore_prefix }}}" | cut -d '.' -f 1)" echo "Major version: $MAJOR_VERSION" - echo ::set-output name=major_version::${MAJOR_VERSION} + echo major_version=${MAJOR_VERSION} >> $GITHUB_OUTPUT MINOR_VERSION="$(echo "${GITHUB_REF_NAME##${{ inputs.ignore_prefix }}}" | cut -d '.' -f 1,2)" echo "Minor version: $MINOR_VERSION" - echo ::set-output name=minor_version::${MINOR_VERSION} + echo minor_version=${MINOR_VERSION} >> $GITHUB_OUTPUT FULL_VERSION="${GITHUB_REF_NAME##${{ inputs.ignore_prefix }}}" echo "Full version: $FULL_VERSION" - echo ::set-output name=full_version::${FULL_VERSION} \ No newline at end of file + echo full_version=${FULL_VERSION} >> $GITHUB_OUTPUT diff --git a/.github/workflows/format_branch_name.yml b/.github/workflows/format_branch_name.yml index b45991286..4e463ed32 100644 --- a/.github/workflows/format_branch_name.yml +++ b/.github/workflows/format_branch_name.yml @@ -18,4 +18,4 @@ jobs: run: | FORMATTED_BRANCH="$(echo ${GITHUB_REF_NAME} | sed "s/\//-/g")" echo $FORMATTED_BRANCH - echo ::set-output name=formatted_branch::${FORMATTED_BRANCH} \ No newline at end of file + echo formatted_branch=${FORMATTED_BRANCH} >> $GITHUB_OUTPUT diff --git a/.github/workflows/miscellaneous_tests.yml b/.github/workflows/miscellaneous_tests.yml index 0e803f9eb..445951b88 100644 --- a/.github/workflows/miscellaneous_tests.yml +++ b/.github/workflows/miscellaneous_tests.yml @@ -8,12 +8,12 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - run: sudo apt-get install -qq gettext - - run: ./.github/run_translation_verification.sh \ No newline at end of file + - run: ./.github/run_translation_verification.sh diff --git a/.github/workflows/should_deploy_major_version.yml b/.github/workflows/should_deploy_major_version.yml index b2b7adfd8..f2fe4ef6b 100644 --- a/.github/workflows/should_deploy_major_version.yml +++ b/.github/workflows/should_deploy_major_version.yml @@ -17,7 +17,7 @@ jobs: outputs: should_deploy_major_version: ${{ steps.vars.outputs.should_deploy_major_version }} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 with: fetch-depth: 0 - name: allow for major version deployment if the next minor version from current tag does not exist @@ -30,7 +30,7 @@ jobs: if [ -z "$TAGS_FOR_NEXT_MINOR" ] then echo 'Major version should be deployed.' - echo ::set-output name=should_deploy_major_version::true + echo should_deploy_major_version=true >> $GITHUB_OUTPUT else echo 'Major version should not be deployed.' - fi \ No newline at end of file + fi diff --git a/.github/workflows/unit_test.yml b/.github/workflows/unit_test.yml index 2b903314d..c89c81e47 100644 --- a/.github/workflows/unit_test.yml +++ b/.github/workflows/unit_test.yml @@ -8,16 +8,16 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 - name: Use Node.js 16 - uses: actions/setup-node@v2 + uses: actions/setup-node@v3 with: node-version: 16 cache: 'npm' - run: npm ci - name: Download build-output artifact - uses: actions/download-artifact@v2 + uses: actions/download-artifact@v3 with: name: build-output path: dist/ - - run: npm run test \ No newline at end of file + - run: npm run test From 54ede2d9c4a51986fd088d8f2f715b880c00ce74 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" <41898282+github-actions[bot]@users.noreply.github.com> Date: Tue, 29 Nov 2022 14:58:23 -0500 Subject: [PATCH 2/4] Update Package Version to v1.15.1 (#1790) *An automated PR which updates the version number in package.json and package-lock.json files* --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index b64efa890..291047532 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@yext/answers-search-ui", - "version": "1.15.0", + "version": "1.15.1", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@yext/answers-search-ui", - "version": "1.15.0", + "version": "1.15.1", "license": "BSD-3-Clause", "dependencies": { "@mapbox/mapbox-gl-language": "^0.10.1", diff --git a/package.json b/package.json index 5eafc3756..c5d465885 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@yext/answers-search-ui", - "version": "1.15.0", + "version": "1.15.1", "description": "Javascript Search Programming Interface", "main": "dist/answers-umd.js", "repository": { From b138213c3f732077f777e776600af6e5d034f1cb Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Tue, 29 Nov 2022 17:01:11 -0500 Subject: [PATCH 3/4] Remove Browserstack acceptance testing on IE11 (#1791) Now that the Google Maps JS API has dropped support for IE11, Browserstack acceptance tests on IE11 fail. This PR updates the Browserstack acceptance test script to only run on Safari, and not IE11 anymore. J=SLAP-2502 TEST=auto See that the Browserstack check on this PR only runs on Safari and there are no more Google Maps API errors. --- .github/run_browserstack_acceptance.sh | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/.github/run_browserstack_acceptance.sh b/.github/run_browserstack_acceptance.sh index ab418324f..3d4de9f13 100755 --- a/.github/run_browserstack_acceptance.sh +++ b/.github/run_browserstack_acceptance.sh @@ -6,12 +6,4 @@ export BROWSERSTACK_BUILD_ID="${GITHUB_REF_NAME} - ${GITHUB_RUN_ID}" COMMIT_MSG_TITLE=$(git log -n 1 --pretty=format:%s) export BROWSERSTACK_TEST_RUN_NAME=$COMMIT_MSG_TITLE -if [[ $GITHUB_REF_NAME == release/* - || $GITHUB_REF_NAME == hotfix/* - || $GITHUB_REF_NAME == master - || $GITHUB_REF_NAME == support/* ]] -then - npx testcafe "browserstack:ie@11.0,browserstack:safari" --config-file ./.github/testcafe.json -q -else - npx testcafe -c 2 "browserstack:ie@11.0" --config-file ./.github/testcafe.json -q -fi +npx testcafe "browserstack:safari" --config-file ./.github/testcafe.json -q successThreshold=1 From 4567c4fc0790a88663a40818cd24a8050d15e288 Mon Sep 17 00:00:00 2001 From: nmanu1 <88398086+nmanu1@users.noreply.github.com> Date: Thu, 1 Dec 2022 14:04:12 -0500 Subject: [PATCH 4/4] Remove IE11NoCacheHook (#1793) Now that we've removed acceptance testing on IE11, the `IE11NoCacheHook` is no longer needed. This PR removes it and its uses. J=SLAP-2502 TEST=none --- .../acceptancesuites/facetsonload.js | 4 +-- .../acceptancesuites/facetssuite.js | 11 +------ .../acceptancesuites/filterboxsuite.js | 8 +---- .../acceptancesuites/filtersearchsuite.js | 8 ++--- .../acceptancesuites/sortoptionssuite.js | 13 ++------ .../acceptancesuites/universalsuite.js | 11 +------ .../acceptancesuites/verticalsuite.js | 7 +---- tests/acceptance/ie11nocachehook.js | 31 ------------------- tests/acceptance/utils.js | 17 ---------- 9 files changed, 9 insertions(+), 101 deletions(-) delete mode 100644 tests/acceptance/ie11nocachehook.js diff --git a/tests/acceptance/acceptancesuites/facetsonload.js b/tests/acceptance/acceptancesuites/facetsonload.js index 79b696885..c959a6a15 100644 --- a/tests/acceptance/acceptancesuites/facetsonload.js +++ b/tests/acceptance/acceptancesuites/facetsonload.js @@ -4,8 +4,7 @@ import { RequestLogger } from 'testcafe'; import { browserBackButton, browserRefreshPage, - browserForwardButton, - registerIE11NoCacheHook + browserForwardButton } from '../utils'; import { getMostRecentQueryParamsFromLogger } from '../requestUtils'; import { MockedVerticalSearchRequest } from '../fixtures/responses/vertical/search'; @@ -23,7 +22,6 @@ test('Facets work with back/forward navigation and page refresh', async t => { url: VERTICAL_SEARCH_URL_REGEX }); await t.addRequestHooks(logger); - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); async function getFacetsFromRequest () { const urlParams = await getMostRecentQueryParamsFromLogger(logger); diff --git a/tests/acceptance/acceptancesuites/facetssuite.js b/tests/acceptance/acceptancesuites/facetssuite.js index 115ea76fd..d6d8db472 100644 --- a/tests/acceptance/acceptancesuites/facetssuite.js +++ b/tests/acceptance/acceptancesuites/facetssuite.js @@ -1,12 +1,6 @@ -import { - FACETS_PAGE, - VERTICAL_SEARCH_URL_REGEX -} from '../constants'; +import { FACETS_PAGE } from '../constants'; import FacetsPage from '../pageobjects/facetspage'; import { MockedVerticalSearchRequest } from '../fixtures/responses/vertical/search'; -import { - registerIE11NoCacheHook -} from '../utils'; import SearchRequestLogger from '../searchrequestlogger'; import { MockedVerticalAutoCompleteRequest } from '../fixtures/responses/vertical/autocomplete'; @@ -16,9 +10,6 @@ fixture`Facets page` MockedVerticalSearchRequest, MockedVerticalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); - }) .page`${FACETS_PAGE}`; test('can select and reset a single facet', async t => { diff --git a/tests/acceptance/acceptancesuites/filterboxsuite.js b/tests/acceptance/acceptancesuites/filterboxsuite.js index 6b7553b01..f0e88f90f 100644 --- a/tests/acceptance/acceptancesuites/filterboxsuite.js +++ b/tests/acceptance/acceptancesuites/filterboxsuite.js @@ -4,8 +4,7 @@ import { Selector, RequestLogger } from 'testcafe'; import { browserBackButton, browserRefreshPage, - browserForwardButton, - registerIE11NoCacheHook + browserForwardButton } from '../utils'; import { getRequestFilters, @@ -22,9 +21,6 @@ fixture`FilterBox page` MockedVerticalSearchRequest, MockedVerticalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); - }) .page`${FILTERBOX_PAGE}`; test('single option filterbox works with back/forward navigation and page refresh', async t => { @@ -32,7 +28,6 @@ test('single option filterbox works with back/forward navigation and page refres url: VERTICAL_SEARCH_URL_REGEX }); await t.addRequestHooks(radiusFilterLogger); - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); const searchComponent = FacetsPage.getSearchComponent(); await searchComponent.enterQuery('all'); await searchComponent.submitQuery(); @@ -75,7 +70,6 @@ test('multioption filterbox works with back/forward navigation and page refresh' url: VERTICAL_SEARCH_URL_REGEX }); await t.addRequestHooks(filterBoxLogger); - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); const martyFilter = { c_puppyPreference: { $eq: 'Marty' diff --git a/tests/acceptance/acceptancesuites/filtersearchsuite.js b/tests/acceptance/acceptancesuites/filtersearchsuite.js index 7f9dfbb21..105ad208d 100644 --- a/tests/acceptance/acceptancesuites/filtersearchsuite.js +++ b/tests/acceptance/acceptancesuites/filtersearchsuite.js @@ -1,11 +1,10 @@ -import { FACETS_PAGE, VERTICAL_SEARCH_URL_REGEX } from '../constants'; +import { FACETS_PAGE } from '../constants'; import FacetsPage from '../pageobjects/facetspage'; import { Selector } from 'testcafe'; import { browserBackButton, browserRefreshPage, - browserForwardButton, - registerIE11NoCacheHook + browserForwardButton } from '../utils'; import { MockedFilterSearchRequest } from '../fixtures/responses/filtersearch/search'; import { MockedVerticalSearchRequest } from '../fixtures/responses/vertical/search'; @@ -19,9 +18,6 @@ fixture`FilterSearch suite` MockedVerticalSearchRequest, MockedVerticalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); - }) .page`${FACETS_PAGE}`; test('filtersearch works with back/forward navigation and page refresh', async t => { diff --git a/tests/acceptance/acceptancesuites/sortoptionssuite.js b/tests/acceptance/acceptancesuites/sortoptionssuite.js index ef0f744e9..133c6fe67 100644 --- a/tests/acceptance/acceptancesuites/sortoptionssuite.js +++ b/tests/acceptance/acceptancesuites/sortoptionssuite.js @@ -1,14 +1,8 @@ -import { - FACETS_PAGE, - VERTICAL_SEARCH_URL_REGEX -} from '../constants'; +import { FACETS_PAGE } from '../constants'; import FacetsPage from '../pageobjects/facetspage'; import { MockedVerticalSearchRequest } from '../fixtures/responses/vertical/search'; import { Selector } from 'testcafe'; -import { - browserRefreshPage, - registerIE11NoCacheHook -} from '../utils'; +import { browserRefreshPage } from '../utils'; import SearchRequestLogger from '../searchrequestlogger'; import { MockedVerticalAutoCompleteRequest } from '../fixtures/responses/vertical/autocomplete'; @@ -17,9 +11,6 @@ fixture`SortOptions suite` MockedVerticalSearchRequest, MockedVerticalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); - }) .page`${FACETS_PAGE}`; test('selecting a sort option and refreshing maintains that sort selection', async t => { diff --git a/tests/acceptance/acceptancesuites/universalsuite.js b/tests/acceptance/acceptancesuites/universalsuite.js index b2003cdbd..f4055fb00 100644 --- a/tests/acceptance/acceptancesuites/universalsuite.js +++ b/tests/acceptance/acceptancesuites/universalsuite.js @@ -1,13 +1,7 @@ import UniversalPage from '../pageobjects/universalpage'; -import { - UNIVERSAL_PAGE, - UNIVERSAL_SEARCH_URL_REGEX -} from '../constants'; +import { UNIVERSAL_PAGE } from '../constants'; import { MockedUniversalAutoCompleteRequest } from '../fixtures/responses/universal/autocomplete'; import { MockedUniversalSearchRequest } from '../fixtures/responses/universal/search'; -import { - registerIE11NoCacheHook -} from '../utils'; import SearchRequestLogger from '../searchrequestlogger'; /** @@ -23,9 +17,6 @@ fixture`Universal search page works as expected` MockedUniversalSearchRequest, MockedUniversalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, UNIVERSAL_SEARCH_URL_REGEX); - }) .page`${UNIVERSAL_PAGE}`; test('Basic universal flow', async t => { diff --git a/tests/acceptance/acceptancesuites/verticalsuite.js b/tests/acceptance/acceptancesuites/verticalsuite.js index 5bbf5e860..35855d745 100644 --- a/tests/acceptance/acceptancesuites/verticalsuite.js +++ b/tests/acceptance/acceptancesuites/verticalsuite.js @@ -7,8 +7,7 @@ import { MockedVerticalSearchRequest } from '../fixtures/responses/vertical/sear import { RequestLogger } from 'testcafe'; import { browserBackButton, - browserRefreshPage, - registerIE11NoCacheHook + browserRefreshPage } from '../utils'; import SearchRequestLogger from '../searchrequestlogger'; import { MockedVerticalAutoCompleteRequest } from '../fixtures/responses/vertical/autocomplete'; @@ -19,9 +18,6 @@ fixture`Vertical search page works as expected` MockedVerticalSearchRequest, MockedVerticalAutoCompleteRequest ) - .beforeEach(async t => { - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); - }) .page`${VERTICAL_PAGE}`; test('pagination flow', async t => { @@ -70,7 +66,6 @@ test('spell check flow', async t => { url: VERTICAL_SEARCH_URL_REGEX }); await t.addRequestHooks(spellCheckLogger); - await registerIE11NoCacheHook(t, VERTICAL_SEARCH_URL_REGEX); const searchComponent = VerticalPage.getSearchComponent(); await searchComponent.enterQuery('varginia'); await searchComponent.submitQuery(); diff --git a/tests/acceptance/ie11nocachehook.js b/tests/acceptance/ie11nocachehook.js deleted file mode 100644 index 56491d9fd..000000000 --- a/tests/acceptance/ie11nocachehook.js +++ /dev/null @@ -1,31 +0,0 @@ -import { RequestHook } from 'testcafe'; - -/** - * IE11NoCacheHook solves the problem of IE11 caching all ajax requests - * by default by adding a 'no-store' header to requests in ie11. - * - * Without this hook, ajax requests cached by IE11 will be ignored - * testcafe's RequestLogger. This is only a problem in IE11. - */ -export default class IE11NoCacheHook extends RequestHook { - /** - * This comes from the suggestion here on the testcafe github - * https://github.com/DevExpress/testcafe/issues/3780#issuecomment-496955368 - * The --disable-page-caching flag did not work for ie11, and neither - * did trying to set the header in onRequest(), so this workaround was used instead. - * - * @param {Object} event - */ - _onConfigureResponse (event) { - super._onConfigureResponse(event); - event.setHeader('cache-control', 'no-store'); - } - - async onRequest () { - // We don't need to do anything here, but still need to override the method. - } - - async onResponse () { - // We don't need to do anything here, but still need to override the method. - } -} diff --git a/tests/acceptance/utils.js b/tests/acceptance/utils.js index eb0b5d17f..3530cefdf 100644 --- a/tests/acceptance/utils.js +++ b/tests/acceptance/utils.js @@ -1,5 +1,4 @@ import { ClientFunction, Selector } from 'testcafe'; -import IE11NoCacheHook from './ie11nocachehook'; /* global location */ @@ -23,22 +22,6 @@ export async function getCurrentUrlParams () { return new URLSearchParams(urlParams); } -/** - * Register the Ie11NoCacheHook, if the current browser is IE11. - * - * @param {import('testcafe').TestController} testInstance - * @param {string} url - */ -export async function registerIE11NoCacheHook (testInstance, url) { - const isIE11 = await ClientFunction(() => { - return !!window.MSInputMethodContext && !!document.documentMode; - })(); - if (isIE11) { - const ie11Hook = new IE11NoCacheHook(url); - return testInstance.addRequestHooks(ie11Hook); - } -} - export async function waitForResults () { const resultsSelector = await Selector('.yxt-Results'); await resultsSelector.with({ visibilityCheck: true })();