Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NXT-333 Write automation test regression scripts for next-web projects #280

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
08626ee
NXT-333 Create new features and supporting ts files for nextweb proje…
FunmiOsho Jul 12, 2024
58141f1
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Jul 12, 2024
f141205
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Jul 15, 2024
da76aac
NXT-333 fix Lint and typecheck issue
FunmiOsho Jul 15, 2024
42c24ad
NXT-333 update supporting action file and fix eslint issue
FunmiOsho Jul 15, 2024
8d01659
NXT-333 import nice digital wdio, fix feature and supporting files
FunmiOsho Jul 15, 2024
07e7154
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Jul 22, 2024
a518afc
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Sep 3, 2024
134335d
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Sep 4, 2024
4389fd5
NXT-333 update feature test, wdio config, tsconfig, docker sh, gitign…
FunmiOsho Sep 5, 2024
b8600c7
NXT-333 Add new feature test files and supporting files
FunmiOsho Sep 12, 2024
e79d64a
NXT-333 Update error log for test, docker compose indev mock data
FunmiOsho Sep 16, 2024
95edc75
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Sep 16, 2024
4092219
NXT-333 new feature test and supporting files and update to indicator…
FunmiOsho Sep 16, 2024
1d3e43c
NXT-333 update wdio config file to run chrome without error and updat…
FunmiOsho Sep 17, 2024
c12b3c0
NXT-333 new feature tests and supporting files, update wdio config an…
FunmiOsho Sep 17, 2024
701e3d7
NXT-333 update compose file, test file and set up custom env variable
FunmiOsho Sep 19, 2024
1a128ed
NXT-333 update changes to custom env variables
FunmiOsho Sep 19, 2024
7ab58a9
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Sep 20, 2024
4052a07
NXT-333 update test feature and docker compose
FunmiOsho Sep 20, 2024
e9430db
NXT-333 update to docker compose
FunmiOsho Sep 20, 2024
1a58499
NXT-333 update feature tests and docker compose file
FunmiOsho Sep 24, 2024
9ddfcb5
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Sep 30, 2024
91dee4f
NXT-333 exclude storyblok home and news tests and tidy feature tests
FunmiOsho Sep 30, 2024
93ac5e8
NXT-333 update wdio config to exclude additional storyblok test and i…
FunmiOsho Sep 30, 2024
ddf0183
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Nov 20, 2024
b68739e
NXT-333 Update feature tests, wdio config, add new custom env variabl…
FunmiOsho Nov 20, 2024
d831f41
Merge branch 'main' into Write-automation-test-regression-scripts-for…
FunmiOsho Nov 26, 2024
6e26753
NXT-333 Upadate feature and supporting files, ReadMe and wdio config …
FunmiOsho Nov 27, 2024
fc93158
NXT-333 lint issue sorted
FunmiOsho Nov 27, 2024
87ce180
NXT-333 fix lint and prettier issue
FunmiOsho Nov 28, 2024
c68e8b0
NXT-333 tidy up features files and supporting files and wdio config.
FunmiOsho Nov 28, 2024
9816d5e
NXT-333 update functional tests
FunmiOsho Nov 28, 2024
6c0fef2
NXT-333 update tests and config file and supporting files
FunmiOsho Nov 28, 2024
f200f82
NXT-333 update feature test file
FunmiOsho Nov 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,9 @@
"editor.defaultFormatter": "alexkrechik.cucumberautocomplete"
},
"cucumberautocomplete.steps": [
"functional-tests/node_modules/@nice-digital/wdio-cucumber-steps/lib/given/definitions.js",
"functional-tests/node_modules/@nice-digital/wdio-cucumber-steps/lib/when/definitions.js",
"functional-tests/node_modules/@nice-digital/wdio-cucumber-steps/lib/then/definitions.js",
"functional-tests/steps/given.ts",
"functional-tests/steps/when.ts",
"functional-tests/steps/then.ts"
Expand Down
1 change: 1 addition & 0 deletions functional-tests/.dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
node_modules
errorShots
1 change: 1 addition & 0 deletions functional-tests/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
allure-results
allure-report
docker-output
errorShots
37 changes: 19 additions & 18 deletions functional-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,23 @@
**Table of Contents** *generated with [DocToc](https://github.com/thlorenz/doctoc)*

- [Functional tests for Next Web](#functional-tests-for-next-web)
- [Table of contents](#table-of-contents)
- [Stack](#stack)
- [Software](#software)
- [:rocket: Set up](#rocket-set-up)
- [Install Java JDK](#install-java-jdk)
- [Run the tests](#run-the-tests)
- [Using VSCode](#using-vscode)
- [Using npm](#using-npm)
- [Different URLs](#different-urls)
- [Docker](#docker)
- [Steps to Run NextWeb in Docker with Teamcity built image](#steps-to-run-nextweb-in-docker-with-teamcity-built-image)
- [Development mode](#development-mode)
- [Excluding tests](#excluding-tests)
- [Running single features](#running-single-features)
- [Troubleshooting](#troubleshooting)
- [session not created: This version of ChromeDriver only supports Chrome version xx](#session-not-created-this-version-of-chromedriver-only-supports-chrome-version-xx)
- [Port 4444 is already in use](#port-4444-is-already-in-use)
- [Table of contents](#table-of-contents)
- [Stack](#stack)
- [Software](#software)
- [:rocket: Set up](#rocket-set-up)
- [Install Java JDK](#install-java-jdk)
- [Run the tests](#run-the-tests)
- [Using VSCode](#using-vscode)
- [Using npm](#using-npm)
- [Different URLs](#different-urls)
- [Docker](#docker)
- [Steps to Run NextWeb in Docker with Teamcity built image](#steps-to-run-nextweb-in-docker-with-teamcity-built-image)
- [Development mode](#development-mode)
- [Excluding tests](#excluding-tests)
- [Running single features](#running-single-features)
- [Troubleshooting](#troubleshooting)
- [session not created: This version of ChromeDriver only supports Chrome version xx](#session-not-created-this-version-of-chromedriver-only-supports-chrome-version-xx)
- [Port 4444 is already in use](#port-4444-is-already-in-use)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

Expand All @@ -42,6 +42,7 @@
- [Using npm](#using-npm)
- [Different URLs](#different-urls)
- [Docker](#docker)
- [Steps to Run NextWeb in Docker with Teamcity built image](#steps-to-run-nextweb-in-docker-with-teamcity-built-image)
- [Development mode](#development-mode)
- [Excluding tests](#excluding-tests)
- [Running single features](#running-single-features)
Expand Down Expand Up @@ -91,7 +92,7 @@ This runs the tests against the [NextJS web app](../web/) running on http://loca
5. Install dependencies from npm:
1. Run 'npm: Install Dependencies' from the VS Code command palette (_Ctrl+Shift+P_) and choose the functional-tests folder from the next dropdown (or just install all)
2. Or run `cd functional-tests && npm ci` on the command line
6. Run `npm run dev` from the _web_ folder to run the NextJS web app on [locahost](http://localhost:3000):
6. Run `npm run build` & `npm start` from the _web_ folder to run the NextJS web app on [locahost](http://localhost:3000):
7. Run 'Run Test Task' from the command palette (_Ctrl+Shift+P_) and choose 'Functional tests - all'
1. Or run 'Functional tests - current feature' to run just the currently opened feature file.

Expand Down
28 changes: 22 additions & 6 deletions functional-tests/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: '2.2'
services:
selenium-hub:
image: selenium/hub:3.141.59-20210713
Expand Down Expand Up @@ -27,26 +26,33 @@ services:
volumes:
- ./:/next-web/tests
- /next-web/tests/node_modules/
- ./errorShots:/next-web/tests/errorShots

# New Next Web (NextJS web app)
next-web:
image: nextweb:latest
## Uncomment the two lines below to run with a specific image with a specific Teamcity build number
## image: xxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/nextweb:nnnn
## command: ["npm", "run", "host-console-logging"]
# image: xxxxxxxxxxxx.dkr.ecr.eu-west-1.amazonaws.com/nextweb:nnnn
# command: ["npm", "run", "host-console-logging"]
container_name: next-web
build: ./../web/
depends_on:
- mock-search-api
- mock-publications
- mock-indev
ports:
# Next Web runs on 8092 in PM2: see pm2.ecosystem.json in the web-host folder
- '3000:3000'
volumes:
- ./../web:/web
environment:
- SEARCH_BASE_URL=http://mock-search-api.nice.org.uk/api
- PUBLICATIONS_BASE_URL=http://mock-publications.nice.org.uk
- INDEV_BASE_URL=http://mock-indev.nice.org.uk
- SEARCH_BASE_URL
- PUBLICATIONS_BASE_URL
- INDEV_BASE_URL
- STORYBLOK_TOKEN
- STORYBLOK_ROUTE_CATCHALL
- JOTFORM_BASE_URL
- JOTFORM_APIKEY
networks:
default:
aliases:
Expand All @@ -56,6 +62,7 @@ services:
mock-search-api:
build: https://github.com/nice-digital/mocks-apis.git#main:search-apis
container_name: mock-search-api
command: npm start
networks:
default:
aliases:
Expand All @@ -64,11 +71,20 @@ services:
mock-publications:
build: https://github.com/nice-digital/mocks-apis.git#main:publications
container_name: mock-publications
command: npm start
networks:
default:
aliases:
- mock-publications.nice.org.uk

mock-indev:
build: https://github.com/nice-digital/mocks-apis.git#main:indev
container_name: mock-indev
command: npm start
networks:
default:
aliases:
- mock-indev.nice.org.uk
networks:
default:
name: next-web-functional-tests
2 changes: 2 additions & 0 deletions functional-tests/docker-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ function processTestOutput() {
echo "Making docker-output folder"
mkdir -p docker-output

docker cp nxt-test-runner:/next-web/tests/errorShots ./docker-output/errorShots

echo "Copying allure report out of nxt-test-runner"
docker cp nxt-test-runner:/next-web/tests/allure-report ./docker-output

Expand Down
20 changes: 20 additions & 0 deletions functional-tests/features/blogs.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
Feature: Individual blog
As a user I can open individual blog details page
As a user of blog I can use the breadcrumb navigation

Background:
Given I open the home page

Scenario: User can view blog page
Given I open the blogs page
Then I expect that element "h1" contains the text "NextWeb-automation-Blog-1-DONOTUSE"
Then I expect to see blog author image does exist
Then I expect to see blog author name contains the text "Oomi~Osh"
Then I expect to see blog author title contains the text "NICE-DIT Snr tester"
Then I expect the blogs tag contains the text "Blogs"

Scenario: User can navigate Home breadcrumbs
Given I open the blogs page
Given I click on the home breadcrumb link
Then I expect the url is "/"
Then I expect to see the section heading contains the text "Latest from NICE"
38 changes: 38 additions & 0 deletions functional-tests/features/filterGalp.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Feature: The list of guidance list page is reduced when user filter by name
As a user of guidance list page
As a user I filter using keywords, reference number
We want to be able to filter the Indicators list by title and sorting

Background:
Given I open the home page

Scenario: User can apply reference number filter published guidance list page
Given I open the published guidance list page
And I enter keyword or reference number "TA100" to filter page list
And I pause for 2000ms
Then I expect the result list count contains "Showing 1 to 1 of 1"

Scenario: User can apply keyword filter published guidance list page
Given I open the published guidance list page
And I enter keyword or reference number "TA846" to filter page list
And I pause for 5000ms
Then I expect the result list count contains "Showing 1 to 1 of 1"

Scenario: User can apply keyword filter topic selection list page
Given I open the topic selection list page
And I enter keyword or reference number "testingst" to filter page list
# Then I expect the result list count contains "No results found"

Scenario: User can apply keyword filter in consultation guidance list page
Given I open the in consultation guidance list page
And I enter keyword or reference number "testingst" to filter page list
# Then I expect the result list count contains "No results found"

Scenario: User can apply date filter
Given I open the published guidance list page
And I enter From date "01/01/2024" to filter page list
And I pause for 2000ms
# Then I expect the result list count contains "Showing 1 to 10 of 111"
Given I open the topic selection list page
And I enter From date "02/02/2024" to filter page list
# Then I expect the result list count contains "Showing 1 to 10 of 23"
30 changes: 30 additions & 0 deletions functional-tests/features/filterIndicator.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Feature: The list of indicators is reduced when user filter by name
As a user of indicators list page
As a user I filter using keywords, reference number
We want to be able to filter the indicators list by title and sorting

Background:
Given I open the home page
And I pause for 2000ms

Scenario: User can apply reference number filter published indicators list page
Given I open the published indicators list page
And I enter keyword or reference number "IND65" to filter page list
And I pause for 2000ms
Then I expect the result list count contains "Showing 1 to 1 of 1"

Scenario: User can apply keyword filter in development indicators list page
Given I open the in development indicators list page
And I enter keyword or reference number "IND85" to filter page list
# Then I expect the result list count contains "No results found"

Scenario: User can apply keyword filter in consultation indicators list page
Given I open the in consultation indicators list page
And I enter keyword or reference number "testingst" to filter page list
# Then I expect the result list count contains "No results found"

Scenario: User can apply date filter
Given I open the published indicators list page
And I enter From date "01/01/2024" to filter page list
# And I pause for 2000ms
# Then I expect the result list count contains "Showing 1 to 10 of 19"
24 changes: 24 additions & 0 deletions functional-tests/features/filterRrlp.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
Feature: The list of published recommendation for research page is reduced when user filter by name
As a user of published recommendation for research list page
As a user I filter using keywords, reference number

Background:
Given I open the home page

Scenario: User can apply reference number filter published recommendation for research list page
Given I open the recommendation for research list page
And I enter keyword or reference number "NG289-3" to filter page list
And I pause for 2000ms
# Then I expect the result list count contains "Showing 1 to 1 of 1"

Scenario: User can apply keyword filter published guidance list page
Given I open the recommendation for research list page
And I enter keyword or reference number "CG276-3" to filter page list
And I pause for 5000ms
/

# Scenario: User can apply date filter
# Given I open the recommendation for research list page
# And I enter From date "01/01/2024" to filter page list
# And I pause for 2000ms
# # Then I expect the result list count contains "Showing 1 to 10 of 138"
27 changes: 27 additions & 0 deletions functional-tests/features/guidanceListPage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Feature: Published guidance list page
As a user I can use the published guidance list page and in consultation guidance list page
As a user I can use the in development guidance list page and awaiting development guidance list page
As a user I can use the topic selection list page

Background:
Given I open the home page

Scenario: User can see guidance page heading
Given I open the published guidance list page
Then I expect that element "h1" contains the text "Published: Guidance, quality standards and advice"

Scenario: User can see in consultation guidance page heading
Given I open the in consultation guidance list page
Then I expect that element "h1" contains the text "In consultation: Guidance and quality standards"

Scenario: User can see in development guidance page heading
Given I open the in development guidance list page
Then I expect that element "h1" contains the text "In development: Guidance, quality standards and advice"

Scenario: User can see awaiting development guidance page heading
Given I open the awaiting development guidance list page
Then I expect that element "h1" contains the text "Awaiting development: Guidance and quality standards"

Scenario: User can see topic selection page heading
Given I open the topic selection list page
Then I expect that element "h1" contains the text "Guidance in topic selection"
17 changes: 17 additions & 0 deletions functional-tests/features/guidancePagination.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
Feature: Users can page through the list of published guidance page
As a user of published guidance list page
We want to be able to page through the list of published guidance page

Background:
Given I open the home page
# Given I have a screen that is 1400 by 900 pixels

Scenario: User can page through the list of indicators
Given I open the published guidance list page
Then I expect the first pagination option is "1"
When I click the second pagination option
Then I expect the first pagination option is "Previous page"
And I click the next page option
And I click the previous page option
And I click the previous page option
Then I expect the first pagination option is "1"
15 changes: 15 additions & 0 deletions functional-tests/features/home.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
Feature: Home page
As a user of NICE home page

Background:
Given I open the home page

Scenario: User can view home page and navigate to new page
Then I expect to see the section heading contains the text "Latest from NICE"
Then I expect to see the section heading link contains the text "Implementation and planning"
Then I expect to see another section heading link contains the text "More ways we support you"
When I can click on the Sign in link
And I open the home page
And I pause for 2000ms
When I click on the home news link
Then I expect that element "h1" contains the text "News, blogs and podcasts"
21 changes: 21 additions & 0 deletions functional-tests/features/hubPage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
Feature: Hub detail page
As a member of NICE I can see the hub detail page
As a user of Hub project I can use the breeadcrumb

Background:
Given I open the home page
And I pause for 2000ms

Scenario: User can see hub detail page headings and navigate home breadcrumb
Then I open the HUB10001 overview page
Then I expect that element "h1" contains the text "Women’s and reproductive health guidelines"
And I pause for 2000ms
Then I expect to see the hub page heading contains the text "Guidelines"
And I pause for 2000ms
Given I click on the home breadcrumb link
Then I expect the url is "/"
Then I open the HUB10002 overview page
And I pause for 2000ms
Then I expect that element "h1" contains the text "Cardiometabolic disease prevention and treatment guidelines"
# Then I see table contains the text "Updates planned and in progress"

16 changes: 16 additions & 0 deletions functional-tests/features/indicator.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Feature: Individual indicator page
As a user I can open individual indicator details page
As a user of indicator project I can use the breadcrumb

Background:
Given I open the IND63 overview page

Scenario: User can see individual published indicator page heading and navigate home breadcrumb
Then I expect that element "h1" contains the text "Pregnancy and neonates: mental health at booking appointment"
Then I expect to see the indicator page heading contains the text "How to use NICE indicators and how we develop them"
And I pause for 2000ms
Given I open the IND63 indicator page
Then I expect to see the first horizontal nav item contains the text "Indicator"
Then I expect to see the second horizontal nav item contains the text "History"
Given I click on the home breadcrumb link
Then I expect the url is "http://localhost:3000/"
18 changes: 18 additions & 0 deletions functional-tests/features/indicatorListPage.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Feature: Published indicators list page
As a user I can use the indicators list page tabs

Background:
Given I open the home page

Scenario: User can see published indicators page heading
Given I open the published indicators list page
Then I expect that element "h1" contains the text "Published: Indicators"

Scenario: User can see in consultation indicators page heading
Given I open the in consultation indicators list page
Then I expect that element "h1" contains the text "In consultation: Indicators"

Scenario: User can see in development indicators page heading
Given I open the in development indicators list page
Then I expect that element "h1" contains the text "In development: Indicators"

Loading