Skip to content

Commit

Permalink
update search bar only acceptance test (#1696)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yen-tt committed Mar 29, 2022
1 parent fe37c9b commit ab92a33
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
}
4 changes: 2 additions & 2 deletions tests/acceptance/acceptancesuites/searchbaronlysuite.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
2 changes: 1 addition & 1 deletion tests/acceptance/fixtures/html/searchbaronly.html
Original file line number Diff line number Diff line change
Expand Up @@ -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'
});
}
});
Expand Down

0 comments on commit ab92a33

Please sign in to comment.