From ab92a337c992632cee30ea7804d6da0ceaf6a9f2 Mon Sep 17 00:00:00 2001 From: Yen Truong <36055303+yen-tt@users.noreply.github.com> Date: Tue, 29 Mar 2022 14:48:12 -0400 Subject: [PATCH] update search bar only acceptance test (#1696) Search bar only acceptance test previously failed due to trailing slash appended to url (before the params). Updated to use slapshot's theme test site url instead of netlify url. Since the theme test site also append additional params (such as referrerPageUrl), the test is modified to check for the beginning portion of the url instead of the full url. ![Screen Shot 2022-03-29 at 11 51 04 AM](https://user-images.githubusercontent.com/36055303/160653017-052f45e2-3e53-495c-9e2e-1969b43f037d.png) J=none TEST=manual ran `npx testcafe -c 3 "chrome:headless,firefox:headless" --config-file ./.circleci/testcafe_search_bar.json -q` (from config.yml) and see that test passed --- package.json | 2 +- tests/acceptance/acceptancesuites/searchbaronlysuite.js | 4 ++-- tests/acceptance/fixtures/html/searchbaronly.html | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 6b21da9bc..e004fdb8f 100644 --- a/package.json +++ b/package.json @@ -242,4 +242,4 @@ "./zh-Hant/modern.min": "./dist/zh-Hant-answers-modern.min.js", "./zh-Hant/template": "./dist/zh-Hant-answerstemplates.compiled.min.js" } -} +} \ No newline at end of file diff --git a/tests/acceptance/acceptancesuites/searchbaronlysuite.js b/tests/acceptance/acceptancesuites/searchbaronlysuite.js index 4e82ae446..358cdbc74 100644 --- a/tests/acceptance/acceptancesuites/searchbaronlysuite.js +++ b/tests/acceptance/acceptancesuites/searchbaronlysuite.js @@ -22,6 +22,6 @@ test('Basic search and redirect flow', async t => { const getUrl = ClientFunction(() => window.location.href); const clientUrl = await getUrl(); - const expectedUrl = 'https://answers-js-demo.netlify.app/sites/rose?query=amani+farooque+phone+number'; - await t.expect(clientUrl).eql(expectedUrl); + const expectedUrl = 'https://theme.slapshot.pagescdn.com/?query=amani+farooque+phone+number'; + await t.expect(clientUrl.startsWith(expectedUrl)).ok(); }); diff --git a/tests/acceptance/fixtures/html/searchbaronly.html b/tests/acceptance/fixtures/html/searchbaronly.html index 927960754..70f448944 100644 --- a/tests/acceptance/fixtures/html/searchbaronly.html +++ b/tests/acceptance/fixtures/html/searchbaronly.html @@ -22,7 +22,7 @@ this.addComponent('SearchBar', { container: '.search-bar-container', clearButton: true, - redirectUrl: 'https://answers-js-demo.netlify.app/sites/rose' + redirectUrl: 'https://theme.slapshot.pagescdn.com' }); } });