-
Notifications
You must be signed in to change notification settings - Fork 1
chore: add a browser test for anchor link functionality #506
base: master
Are you sure you want to change the base?
Conversation
@@ -106,6 +106,7 @@ | |||
"testcafe": "1.9.1", | |||
"ts-jest": "^24.0.2", | |||
"typescript": "~3.6.0", | |||
"wait-port": "^0.2.9", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why has this been added as part of this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a dependency needed to run the make test_browser
target that's missing, hence why I added it. If you start from a clean checkout of reviewer client, and ensure that you don't have wait-port
installed globally. If you try to run that target it will fail with...
make test_browser
yarn wait-port localhost:9000
yarn run v1.22.4
error Command "wait-port" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
make: *** [test_browser] Error 1
import { BASE_URL } from '../../test-utils/baseUrl'; | ||
import { ClientFunction, Selector, t } from 'testcafe'; | ||
|
||
fixture`AnchorLinks`.page`${BASE_URL}`; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The anchor link functionality is limited to the Static pages so far so I think we might want to add test cases to the StaticPages test file instead. These tests should be user story based eg:
- as a user i would like to load in a authorguide page at a specific section
- as a user i should be linked from the coverletter guidance text directly to X section in the author guide (where should this one go? We probably want a test that takes the user through to coverletter section of form then clicking that link theres a navigation helper to get to the correct form section here)
}); | ||
|
||
test('With anchor, scrolls the section into view', async () => { | ||
await t.navigateTo('/author-guide/journal-policies#name-change'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Theres a lot of repetition in these checks
- go to page
- wait for functionality
- expect scroll offset
Could this be added to the StaticPage page object as some form of util function?
No description provided.