Skip to content

Commit 947bbde

Browse files
FrostyApeOneFrostyApeOne
authored andcommitted
Moved Cypress Tests to the src/Tests folder
1 parent 40e5e01 commit 947bbde

45 files changed

Lines changed: 3837 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,9 @@ _NCrunch*
145145
# Add migrations (Will come back and look at how to handle migrations)
146146
*/Migrations/LegacyTramsDb
147147

148-
# node_modules
149-
CypressTests/node_modules
148+
# Node.js Tools for Visual Studio
149+
.ntvs_analysis.dat
150+
node_modules/
150151

151152
# screenshots and videos
152153
CypressTests/cypress/screenshots
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
cypress/videos
2+
cypress.env.json
3+
cypress/reports
4+
cypress/downloads
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
export class Logger {
3+
public static log(message: string) {
4+
cy.log("log", message);
5+
}
6+
}

src/Tests/DfE.ExternalApplications.CypressTests/Cypress/Constants/Cypressconstants.ts

Whitespace-only changes.
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
2+
3+
export class AuthenticationInterceptor {
4+
register() {
5+
cy.intercept(
6+
{
7+
url: Cypress.env('url') + "/**",
8+
middleware: true,
9+
},
10+
(req) => {
11+
// Set an auth header on every request made by the browser
12+
req.headers = {
13+
...req.headers,
14+
Authorization: `Bearer ${Cypress.env('authKey')}`,
15+
"x-user-context-name": (Cypress.env('username')), // must be present, but not used
16+
"x-user-context-id": "", // must be present for antiforgery claims
17+
"x-user-ad-id": "",
18+
"x-cypress-user": "cypressUser",
19+
};
20+
},
21+
).as("AuthInterceptor");
22+
}
23+
}
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
// Import the necessary classes and methods
2+
import GovUKPage from '../../pages/GovUKPage';
3+
import TestLoginPage from '../../pages/TestLoginPage';
4+
import Dashboardpage from '../../pages/Dashboardpage';
5+
import { Logger } from '../../Common/logger';
6+
import '../../support/commands';
7+
import Contributors from '../../pages/ContributorsPage';
8+
import ReasonsAndBenefits from '../../pages/TaskListPages/ReasonsAndBenefitsPage';
9+
import Academies from '../../pages/TaskListPages/DetailsofAcademies';
10+
11+
describe('Create an Application', () => {
12+
13+
beforeEach(() => {
14+
cy.login();
15+
cy.executeAccessibilityTests();
16+
});
17+
18+
it('should navigate to the Gov.uk , scroll to the button and click start button', () => {
19+
Logger.log("Scroll to the start button on Gov.uk page");
20+
GovUKPage.scrollToStartButton();
21+
22+
Logger.log("Clicking the start button on the dashboard");
23+
GovUKPage.clickStartBtn() ;
24+
// Wait for the page to load after clicking the start button
25+
26+
// Add assertions or further actions here as needed
27+
Logger.log("Verify if redirected to TestLogin page");
28+
cy.url().should('include', '/TestLogin'); // Example assertion
29+
30+
Logger.log("Logging in with the test user");
31+
TestLoginPage.enterUsername(Cypress.env('username'));
32+
Logger.log("Clicking the Continue button on the TestLogin page");
33+
TestLoginPage.SignInBtn();
34+
// Add assertions or further actions here as needed
35+
36+
// assertion to check if redirected to dashboard
37+
Logger.log("Verify if redirected to Dashboard page");
38+
cy.url().should('include', '/dashboard');
39+
//Go to Dashboard and click Start New Application
40+
41+
Logger.log("Clicking the Start New Application button");
42+
Dashboardpage.clickStartBtn();
43+
44+
45+
Logger.log("Verify if redirected to Dashboard page");
46+
cy.url().should('include', '/contributors');
47+
// Add a contributor
48+
49+
Logger.log("Adding a contributor");
50+
Contributors.addContributor();
51+
// Verify if the navigated to Contributors Page
52+
Logger.log("Verify if redirected to Contributors page");
53+
cy.url().should('include', '/contributors');
54+
55+
// Verify if the contributor is added
56+
Logger.log("Verifying if the contributor is added");
57+
Contributors.verifyContributor();
58+
Logger.log("Clicking the Proceed button on Contributors page");
59+
Contributors.ClickProceedBtn();
60+
61+
// Verify if the navigated to Task List Page
62+
Logger.log("Verify if redirected to Task List page");
63+
cy.url().should('include', '/applications/');
64+
// Click on the Invite Contributors button
65+
Contributors.inviteContributors();
66+
67+
// Select Details of Academies task
68+
Logger.log("Clicking the Details of Academies task");
69+
Academies.clickDetailsOfAcademies();
70+
// Verify if the navigated to Details of Academies page
71+
cy.url().should('include', '/summary');
72+
// Click on the Change Academies button
73+
Academies.clickChangeAcademies();
74+
// Search for the academy
75+
Logger.log("Searching for the academy");
76+
Academies.searchAcademy();
77+
// Verify if the academy is selected
78+
Logger.log("Verifying if the academy is selected");
79+
Academies.verifyselectedAcademy();
80+
// Click on the Mark Complete checkbox
81+
Logger.log("Clicking the Mark Complete checkbox");
82+
Academies.clickMarkCompleteCheckbox();
83+
// Click on the Save and Continue button
84+
Logger.log("Clicking the Save and Continue button on Details of Academies page");
85+
Academies.clickSaveAndContinue();
86+
87+
});
88+
89+
});
90+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import DashboardPage from '../../pages/Dashboardpage';
2+
import TestLoginPage from '../../pages/TestLoginPage';
3+
4+
5+
beforeEach(() => {
6+
cy.log("Visit the homepage before each test");
7+
8+
});
9+
10+
11+
12+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import DashboardPage from '../../pages/Dashboardpage';
2+
import TestLoginPage from '../../pages/TestLoginPage';
3+
4+
5+
beforeEach(() => {
6+
cy.log("Visit the homepage before each test");
7+
8+
});
9+
10+
11+
12+
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Import the necessary classes and methods
2+
import GovUKPage from '../../pages/GovUKPage';
3+
import TestLoginPage from '../../pages/TestLoginPage';
4+
import Dashboardpage from '../../pages/Dashboardpage';
5+
import { Logger } from '../../Common/logger';
6+
import '../../support/commands';
7+
import Contributors from '../../pages/ContributorsPage';
8+
import ReasonsAndBenefits from '../../pages/TaskListPages/ReasonsAndBenefitsPage';
9+
import Academies from '../../pages/TaskListPages/DetailsofAcademies';
10+
11+
describe('Create an Application', () => {
12+
13+
beforeEach(() => {
14+
cy.login();
15+
cy.executeAccessibilityTests();
16+
});
17+
18+
it('should navigate to the Gov.uk , scroll to the button and click start button', () => {
19+
Logger.log("Scroll to the start button on Gov.uk page");
20+
GovUKPage.scrollToStartButton();
21+
22+
Logger.log("Clicking the start button on the dashboard");
23+
GovUKPage.clickStartBtn() ;
24+
// Wait for the page to load after clicking the start button
25+
26+
// Add assertions or further actions here as needed
27+
Logger.log("Verify if redirected to TestLogin page");
28+
cy.url().should('include', '/TestLogin'); // Example assertion
29+
30+
Logger.log("Logging in with the test user");
31+
TestLoginPage.enterUsername(Cypress.env('username'));
32+
Logger.log("Clicking the Continue button on the TestLogin page");
33+
TestLoginPage.ContinueBtn();
34+
// Add assertions or further actions here as needed
35+
36+
// assertion to check if redirected to dashboard
37+
Logger.log("Verify if redirected to Dashboard page");
38+
cy.url().should('include', '/dashboard');
39+
//Go to Dashboard and click Start New Application
40+
41+
Logger.log("Clicking the Start New Application button");
42+
Dashboardpage.clickStartBtn();
43+
44+
45+
Logger.log("Verify if redirected to Dashboard page");
46+
cy.url().should('include', '/contributors');
47+
// Add a contributor
48+
49+
Logger.log("Adding a contributor");
50+
Contributors.addContributor();
51+
// Verify if the navigated to Contributors Page
52+
Logger.log("Verify if redirected to Contributors page");
53+
cy.url().should('include', '/contributors');
54+
55+
// Verify if the contributor is added
56+
Logger.log("Verifying if the contributor is added");
57+
Contributors.verifyNewContributor();
58+
Logger.log("Clicking the Proceed button on Contributors page");
59+
Contributors.ClickProceedBtn();
60+
61+
// Verify if the navigated to Task List Page
62+
Logger.log("Verify if redirected to Task List page");
63+
cy.url().should('include', '/applications/');
64+
// Click on the Invite Contributors button
65+
Contributors.inviteContributors();
66+
67+
});
68+
69+
});
70+
71+
72+
73+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import DashboardPage from '../../pages/Dashboardpage';
2+
import TestLoginPage from '../../pages/TestLoginPage';
3+
4+
5+
beforeEach(() => {
6+
cy.log("Visit the homepage before each test");
7+
8+
});
9+
10+
11+
12+

0 commit comments

Comments
 (0)