Skip to content

Commit c9f6e28

Browse files
committed
CCM-11544 More back link updates
1 parent 608fb94 commit c9f6e28

23 files changed

+95
-137
lines changed

tests/test-team/helpers/template-mgmt-common.steps.ts

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ export function assertHeaderNavigationLinksWhenSignedOut(
204204
export function assertBackLinkTop(
205205
props: CommonStepsProps & { expectedUrl: string }
206206
) {
207-
return test.step('displays "Go back" link at top of page with correct url', async () => {
207+
return test.step('displays back link at the top of the page with correct url', async () => {
208208
const { page, baseURL, expectedUrl } = props;
209209

210210
await page.loadPage();
@@ -220,7 +220,7 @@ export function assertBackLinkTop(
220220
export function assertAndClickBackLinkTop(
221221
props: CommonStepsProps & { expectedUrl: string }
222222
) {
223-
return test.step('when user clicks "Go back", then user is redirected to previous page', async () => {
223+
return test.step('when user clicks the top back link, then user is redirected to previous page', async () => {
224224
await assertBackLinkTop(props);
225225

226226
const { page, baseURL, expectedUrl } = props;
@@ -236,7 +236,7 @@ export function assertAndClickBackLinkTop(
236236
export function assertBackLinkBottom(
237237
props: CommonStepsProps & { expectedUrl: string }
238238
) {
239-
return test.step('displays additional "Go back" link at bottom of the page with correct url', async () => {
239+
return test.step('displays back link at the bottom of the page with correct url', async () => {
240240
const { page, expectedUrl } = props;
241241

242242
await page.loadPage();
@@ -249,8 +249,24 @@ export function assertBackLinkBottom(
249249
});
250250
}
251251

252+
export function assertAndClickBackLinkBottom(
253+
props: CommonStepsProps & { expectedUrl: string }
254+
) {
255+
return test.step('when user clicks the bottom back link, then user is redirected to previous page', async () => {
256+
await assertBackLinkBottom(props);
257+
258+
const { page, baseURL, expectedUrl } = props;
259+
260+
await page.backLinkBottom.click();
261+
262+
await page.page.waitForURL(`${baseURL}/${expectedUrl}`);
263+
264+
await expect(page.page).toHaveURL(`${baseURL}/${expectedUrl}`);
265+
});
266+
}
267+
252268
export function assertBackLinkTopNotPresent(props: CommonStepsProps) {
253-
return test.step('should not display "Go Back" link on page', async () => {
269+
return test.step('should not display a back link at the top of the page', async () => {
254270
const { page } = props;
255271

256272
await page.loadPage();

tests/test-team/template-mgmt-component-tests/email/template-mgmt-edit-email-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TemplateFactory } from '../../helpers/factories/template-factory';
55
import {
66
assertFooterLinks,
77
assertSignOutLink,
8-
assertBackLinkTopNotPresent,
8+
assertNoBackLinks,
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
} from '../../helpers/template-mgmt-common.steps';
@@ -104,7 +104,7 @@ test.describe('Edit Email message template Page', () => {
104104
await assertHeaderLogoLink(props);
105105
await assertSignOutLink(props);
106106
await assertFooterLinks(props);
107-
await assertBackLinkTopNotPresent(props);
107+
await assertNoBackLinks(props);
108108
});
109109

110110
test('when user visits page with previous data, then form fields retain previous data', async ({

tests/test-team/template-mgmt-component-tests/email/template-mgmt-preview-email-page.component.spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { TemplateStorageHelper } from '../../helpers/db/template-storage-helper'
44
import { TemplateMgmtPreviewEmailPage } from '../../pages/email/template-mgmt-preview-email-page';
55
import { TemplateFactory } from '../../helpers/factories/template-factory';
66
import {
7-
assertBackToAllTemplatesBottomLink,
8-
assertBackToAllTemplatesTopLink,
9-
} from '../template-mgmt-preview-common.steps';
7+
assertBackLinkBottom,
8+
assertAndClickBackLinkTop,
9+
} from '../../helpers/template-mgmt-common.steps';
1010
import {
1111
assertFooterLinks,
1212
assertSignOutLink,
@@ -112,8 +112,14 @@ test.describe('Preview Email message template Page', () => {
112112
await assertHeaderLogoLink(props);
113113
await assertSignOutLink(props);
114114
await assertFooterLinks(props);
115-
await assertBackToAllTemplatesTopLink(props);
116-
await assertBackToAllTemplatesBottomLink(props);
115+
await assertBackLinkBottom({
116+
...props,
117+
expectedUrl: `templates/message-templates`,
118+
});
119+
await assertAndClickBackLinkTop({
120+
...props,
121+
expectedUrl: `templates/message-templates`,
122+
});
117123
});
118124

119125
test('when user clicks "Edit template", then the "Edit Email template" page is displayed', async ({

tests/test-team/template-mgmt-component-tests/email/template-mgmt-preview-submitted-email-page.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
assertBackLinkBottom,
12+
assertAndClickBackLinkTop,
1213
} from '../../helpers/template-mgmt-common.steps';
13-
import { assertBackToAllTemplatesTopLink } from '../template-mgmt-preview-submitted-common.steps';
1414
import {
1515
createAuthHelper,
1616
TestUser,
@@ -99,11 +99,14 @@ test.describe('Preview submitted Email message template Page', () => {
9999
await assertHeaderLogoLink(props);
100100
await assertSignOutLink(props);
101101
await assertFooterLinks(props);
102-
await assertBackToAllTemplatesTopLink(props);
103102
await assertBackLinkBottom({
104103
...props,
105104
expectedUrl: `templates/message-templates`,
106105
});
106+
await assertAndClickBackLinkTop({
107+
...props,
108+
expectedUrl: `templates/message-templates`,
109+
});
107110
});
108111
});
109112

tests/test-team/template-mgmt-component-tests/letter/template-mgmt-create-letter-template-page.component.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,11 @@ test.describe('Upload letter Template Page', () => {
4949
await assertHeaderLogoLink(props);
5050
await assertSignOutLink(props);
5151
await assertFooterLinks(props);
52+
await assertBackLinkBottomNotPresent(props);
5253
await assertAndClickBackLinkTop({
5354
...props,
5455
expectedUrl: 'templates/choose-a-template-type',
5556
});
56-
await assertBackLinkBottomNotPresent(props);
5757
});
5858

5959
test('Validate error messages on the upload letter template page with no template name or pdf', async ({

tests/test-team/template-mgmt-component-tests/letter/template-mgmt-preview-submitted-letter-page.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
assertBackLinkBottom,
12+
assertAndClickBackLinkTop,
1213
} from '../../helpers/template-mgmt-common.steps';
13-
import { assertBackToAllTemplatesTopLink } from '../template-mgmt-preview-submitted-common.steps';
1414
import {
1515
createAuthHelper,
1616
TestUser,
@@ -109,11 +109,14 @@ test.describe('Preview submitted Letter message template Page', () => {
109109
await assertHeaderLogoLink(props);
110110
await assertSignOutLink(props);
111111
await assertFooterLinks(props);
112-
await assertBackToAllTemplatesTopLink(props);
113112
await assertBackLinkBottom({
114113
...props,
115114
expectedUrl: `templates/message-templates`,
116115
});
116+
await assertAndClickBackLinkTop({
117+
...props,
118+
expectedUrl: `templates/message-templates`,
119+
});
117120
});
118121
});
119122

tests/test-team/template-mgmt-component-tests/nhs-app/template-mgmt-edit-nhs-app-template-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TemplateStorageHelper } from '../../helpers/db/template-storage-helper'
55
import {
66
assertFooterLinks,
77
assertSignOutLink,
8-
assertBackLinkTopNotPresent,
8+
assertNoBackLinks,
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
} from '../../helpers/template-mgmt-common.steps';
@@ -82,7 +82,7 @@ test.describe('Edit NHS App Template Page', () => {
8282
await assertHeaderLogoLink(props);
8383
await assertSignOutLink(props);
8484
await assertFooterLinks(props);
85-
await assertBackLinkTopNotPresent(props);
85+
await assertNoBackLinks(props);
8686
});
8787

8888
test('Validate error messages on the edit NHS App message template page with no template name or body', async ({

tests/test-team/template-mgmt-component-tests/nhs-app/template-mgmt-preview-nhs-app-page.component.spec.ts

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { TemplateStorageHelper } from '../../helpers/db/template-storage-helper'
44
import { TemplateMgmtPreviewNhsAppPage } from '../../pages/nhs-app/template-mgmt-preview-nhs-app-page';
55
import { TemplateFactory } from '../../helpers/factories/template-factory';
66
import {
7-
assertBackToAllTemplatesBottomLink,
8-
assertBackToAllTemplatesTopLink,
9-
} from '../template-mgmt-preview-common.steps';
7+
assertBackLinkBottom,
8+
assertAndClickBackLinkTop,
9+
} from '../../helpers/template-mgmt-common.steps';
1010
import {
1111
assertFooterLinks,
1212
assertSignOutLink,
@@ -113,8 +113,14 @@ test.describe('Preview NHS App template Page', () => {
113113
await assertHeaderLogoLink(props);
114114
await assertSignOutLink(props);
115115
await assertFooterLinks(props);
116-
await assertBackToAllTemplatesTopLink(props);
117-
await assertBackToAllTemplatesBottomLink(props);
116+
await assertBackLinkBottom({
117+
...props,
118+
expectedUrl: `templates/message-templates`,
119+
});
120+
await assertAndClickBackLinkTop({
121+
...props,
122+
expectedUrl: `templates/message-templates`,
123+
});
118124
});
119125

120126
test('when user clicks "Edit template", then the "Edit NHS App message template" page is displayed', async ({

tests/test-team/template-mgmt-component-tests/nhs-app/template-mgmt-preview-submitted-nhs-app-page.component.spec.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ import {
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
assertBackLinkBottom,
12+
assertAndClickBackLinkTop,
1213
} from '../../helpers/template-mgmt-common.steps';
13-
import { assertBackToAllTemplatesTopLink } from '../template-mgmt-preview-submitted-common.steps';
1414
import {
1515
createAuthHelper,
1616
TestUser,
@@ -94,11 +94,14 @@ test.describe('Preview submitted NHS App message template Page', () => {
9494
await assertHeaderLogoLink(props);
9595
await assertSignOutLink(props);
9696
await assertFooterLinks(props);
97-
await assertBackToAllTemplatesTopLink(props);
9897
await assertBackLinkBottom({
9998
...props,
10099
expectedUrl: `templates/message-templates`,
101100
});
101+
await assertAndClickBackLinkTop({
102+
...props,
103+
expectedUrl: `templates/message-templates`,
104+
});
102105
});
103106
});
104107

tests/test-team/template-mgmt-component-tests/sms/template-mgmt-edit-sms-page.component.spec.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import { TemplateFactory } from '../../helpers/factories/template-factory';
55
import {
66
assertFooterLinks,
77
assertSignOutLink,
8-
assertBackLinkTopNotPresent,
8+
assertNoBackLinks,
99
assertHeaderLogoLink,
1010
assertSkipToMainContent,
1111
} from '../../helpers/template-mgmt-common.steps';
@@ -110,7 +110,7 @@ test.describe('Edit SMS message template Page', () => {
110110
await assertHeaderLogoLink(props);
111111
await assertSignOutLink(props);
112112
await assertFooterLinks(props);
113-
await assertBackLinkTopNotPresent(props);
113+
await assertNoBackLinks(props);
114114
});
115115

116116
test('when user visits page with previous data, then form fields retain previous data', async ({

0 commit comments

Comments
 (0)