Skip to content
This repository was archived by the owner on Apr 27, 2023. It is now read-only.

chore: add a browser test for anchor link functionality#506

Open
NuclearRedeye wants to merge 5 commits intomasterfrom
wip/anchor-link-test
Open

chore: add a browser test for anchor link functionality#506
NuclearRedeye wants to merge 5 commits intomasterfrom
wip/anchor-link-test

Conversation

@NuclearRedeye
Copy link
Contributor

No description provided.

@NuclearRedeye NuclearRedeye requested a review from Cooryd June 18, 2021 09:07
"testcafe": "1.9.1",
"ts-jest": "^24.0.2",
"typescript": "~3.6.0",
"wait-port": "^0.2.9",
Copy link
Contributor

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?

Copy link
Contributor Author

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}`;
Copy link
Contributor

@Cooryd Cooryd Jun 18, 2021

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');
Copy link
Contributor

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?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants