diff --git a/API-tests/events.go b/API-tests/events.go index 102bb42c0..a139c6708 100644 --- a/API-tests/events.go +++ b/API-tests/events.go @@ -2,19 +2,19 @@ package main type WorkflowEventsResponse []WorkflowEvent -type WorkflowEvent struct{ - EventID string `json:"eventID"` - EventDescription string `json:"eventDescription"` - EventType string `json:"eventType"` - EventData string `json:"eventData"` +type WorkflowEvent struct { + EventID string `json:"eventID"` + EventDescription string `json:"eventDescription"` + EventType string `json:"eventType"` + EventData string `json:"eventData"` } -type EmailTemplatesRecord struct{ - DisplayName string `displayName` - FileName string `fileName` - EmailToFileName string `emailTo` - EmailCcFileName string `emailCc` - SubjectFileName string `subject` +type EmailTemplatesRecord struct { + DisplayName string `json:"displayName"` + FileName string `json:"fileName"` + EmailToFileName string `json:"emailToFileName"` + EmailCcFileName string `json:"emailCcFileName"` + SubjectFileName string `json:"subjectFileName"` } type EmailTemplatesResponse []EmailTemplatesRecord diff --git a/api-test-helper/main.go b/api-test-helper/main.go index fc5d353b8..94faa9f54 100644 --- a/api-test-helper/main.go +++ b/api-test-helper/main.go @@ -26,6 +26,8 @@ var runningTests = false var mxRunningTests sync.Mutex func handleRunTest(w http.ResponseWriter, r *http.Request) { + modeVerbose := r.URL.Query().Has("-v") + mxRunningTests.Lock() if !runningTests { runningTests = true @@ -35,7 +37,14 @@ func handleRunTest(w http.ResponseWriter, r *http.Request) { cmdClear.Dir = "../API-tests/" cmdClear.Run() - cmd := exec.Command("go", "test", "-v") + var cmd *exec.Cmd + if modeVerbose { + log.Println("Running in verbose mode") + cmd = exec.Command("go", "test", "-v") + } else { + cmd = exec.Command("go", "test") + } + cmd.Dir = "../API-tests/" pipe, err := cmd.StdoutPipe() if err != nil { diff --git a/end2end/README.md b/end2end/README.md index fbebb22fa..67c3af10d 100644 --- a/end2end/README.md +++ b/end2end/README.md @@ -1,9 +1,33 @@ # LEAF End-to-end testing -TODO: Add overview +These tests simulate interactions with LEAF from a web browser to help ensure the user interface is working as intended. + +LEAF uses Playwright for end-to-end testing. The test database is populated and updated via LEAF's API tester. + +## Installing Playwright* Development Tools + +0. Prerequisites: + - Install [node.js](https://nodejs.org/en) +1. Set up and run the [LEAF Development Environment](https://github.com/department-of-veterans-affairs/LEAF/blob/master/docs/InstallationConfiguration.md) +3. On the command line: Navigate to the location where the development environment is installed +4. Change directory into `LEAF-Automated-Tests/end2end` +5. Install Playwright development tools: +``` +npm install -D @playwright/test@latest +npx playwright install +``` + +*Note: If you decide to use Playwright's installation instructions, it will prompt with with some decisions that need to be made. The choices we've made are: + - TypeScript or JavaScript? **TypeScript** + - Name of your tests folder? **tests** + - GitHub Actions workflow? **N** + - Install browsers? **Y** + ## Useful commands +These commands should be run from within the folder: `LEAF-Automated-Tests/end2end` + Start Playwright's code generator UI: ``` npx playwright codegen --ignore-https-errors https://host.docker.internal/Test_Request_Portal/ diff --git a/end2end/package-lock.json b/end2end/package-lock.json index 0668ccfd2..8167e7b94 100644 --- a/end2end/package-lock.json +++ b/end2end/package-lock.json @@ -8,22 +8,19 @@ "name": "app", "version": "1.0.0", "license": "ISC", - "dependencies": { - "mysql2": "^3.11.0" - }, "devDependencies": { - "@playwright/test": "^1.46.0", + "@playwright/test": "^1.48.1", "@types/node": "^22.1.0" } }, "node_modules/@playwright/test": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.46.0.tgz", - "integrity": "sha512-/QYft5VArOrGRP5pgkrfKksqsKA6CEFyGQ/gjNe6q0y4tZ1aaPfq4gIjudr1s3D+pXyrPRdsy4opKDrjBabE5w==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/@playwright/test/-/test-1.48.1.tgz", + "integrity": "sha512-s9RtWoxkOLmRJdw3oFvhFbs9OJS0BzrLUc8Hf6l2UdCNd1rqeEyD4BhCJkvzeEoD1FsK4mirsWwGerhVmYKtZg==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright": "1.46.0" + "playwright": "1.48.1" }, "bin": { "playwright": "cli.js" @@ -42,24 +39,6 @@ "undici-types": "~6.13.0" } }, - "node_modules/aws-ssl-profiles": { - "version": "1.1.1", - "resolved": "https://registry.npmjs.org/aws-ssl-profiles/-/aws-ssl-profiles-1.1.1.tgz", - "integrity": "sha512-+H+kuK34PfMaI9PNU/NSjBKL5hh/KDM9J72kwYeYEm0A8B1AC4fuCy3qsjnA7lxklgyXsB68yn8Z2xoZEjgwCQ==", - "license": "MIT", - "engines": { - "node": ">= 6.0.0" - } - }, - "node_modules/denque": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/denque/-/denque-2.1.0.tgz", - "integrity": "sha512-HVQE3AAb/pxF8fQAoiqpvg9i3evqug3hoiwakOyZAwJm+6vZehbkYXZ0l4JxS+I3QxM97v5aaRNhj8v5oBhekw==", - "license": "Apache-2.0", - "engines": { - "node": ">=0.10" - } - }, "node_modules/fsevents": { "version": "2.3.2", "resolved": "https://registry.npmjs.org/fsevents/-/fsevents-2.3.2.tgz", @@ -75,97 +54,14 @@ "node": "^8.16.0 || ^10.6.0 || >=11.0.0" } }, - "node_modules/generate-function": { - "version": "2.3.1", - "resolved": "https://registry.npmjs.org/generate-function/-/generate-function-2.3.1.tgz", - "integrity": "sha512-eeB5GfMNeevm/GRYq20ShmsaGcmI81kIX2K9XQx5miC8KdHaC6Jm0qQ8ZNeGOi7wYB8OsdxKs+Y2oVuTFuVwKQ==", - "license": "MIT", - "dependencies": { - "is-property": "^1.0.2" - } - }, - "node_modules/iconv-lite": { - "version": "0.6.3", - "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.6.3.tgz", - "integrity": "sha512-4fCk79wshMdzMp2rH06qWrJE4iolqLhCUH+OiuIgU++RB0+94NlDL81atO7GX55uUKueo0txHNtvEyI6D7WdMw==", - "license": "MIT", - "dependencies": { - "safer-buffer": ">= 2.1.2 < 3.0.0" - }, - "engines": { - "node": ">=0.10.0" - } - }, - "node_modules/is-property": { - "version": "1.0.2", - "resolved": "https://registry.npmjs.org/is-property/-/is-property-1.0.2.tgz", - "integrity": "sha512-Ks/IoX00TtClbGQr4TWXemAnktAQvYB7HzcCxDGqEZU6oCmb2INHuOoKxbtR+HFkmYWBKv/dOZtGRiAjDhj92g==", - "license": "MIT" - }, - "node_modules/long": { - "version": "5.2.3", - "resolved": "https://registry.npmjs.org/long/-/long-5.2.3.tgz", - "integrity": "sha512-lcHwpNoggQTObv5apGNCTdJrO69eHOZMi4BNC+rTLER8iHAqGrUVeLh/irVIM7zTw2bOXA8T6uNPeujwOLg/2Q==", - "license": "Apache-2.0" - }, - "node_modules/lru-cache": { - "version": "8.0.5", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-8.0.5.tgz", - "integrity": "sha512-MhWWlVnuab1RG5/zMRRcVGXZLCXrZTgfwMikgzCegsPnG62yDQo5JnqKkrK4jO5iKqDAZGItAqN5CtKBCBWRUA==", - "license": "ISC", - "engines": { - "node": ">=16.14" - } - }, - "node_modules/mysql2": { - "version": "3.11.0", - "resolved": "https://registry.npmjs.org/mysql2/-/mysql2-3.11.0.tgz", - "integrity": "sha512-J9phbsXGvTOcRVPR95YedzVSxJecpW5A5+cQ57rhHIFXteTP10HCs+VBjS7DHIKfEaI1zQ5tlVrquCd64A6YvA==", - "license": "MIT", - "dependencies": { - "aws-ssl-profiles": "^1.1.1", - "denque": "^2.1.0", - "generate-function": "^2.3.1", - "iconv-lite": "^0.6.3", - "long": "^5.2.1", - "lru-cache": "^8.0.0", - "named-placeholders": "^1.1.3", - "seq-queue": "^0.0.5", - "sqlstring": "^2.3.2" - }, - "engines": { - "node": ">= 8.0" - } - }, - "node_modules/named-placeholders": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/named-placeholders/-/named-placeholders-1.1.3.tgz", - "integrity": "sha512-eLoBxg6wE/rZkJPhU/xRX1WTpkFEwDJEN96oxFrTsqBdbT5ec295Q+CoHrL9IT0DipqKhmGcaZmwOt8OON5x1w==", - "license": "MIT", - "dependencies": { - "lru-cache": "^7.14.1" - }, - "engines": { - "node": ">=12.0.0" - } - }, - "node_modules/named-placeholders/node_modules/lru-cache": { - "version": "7.18.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-7.18.3.tgz", - "integrity": "sha512-jumlc0BIUrS3qJGgIkWZsyfAM7NCWiBcCDhnd+3NNM5KbBmLTgHVfWBcg6W+rLUsIpzpERPsvwUP7CckAQSOoA==", - "license": "ISC", - "engines": { - "node": ">=12" - } - }, "node_modules/playwright": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.46.0.tgz", - "integrity": "sha512-XYJ5WvfefWONh1uPAUAi0H2xXV5S3vrtcnXe6uAOgdGi3aSpqOSXX08IAjXW34xitfuOJsvXU5anXZxPSEQiJw==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/playwright/-/playwright-1.48.1.tgz", + "integrity": "sha512-j8CiHW/V6HxmbntOfyB4+T/uk08tBy6ph0MpBXwuoofkSnLmlfdYNNkFTYD6ofzzlSqLA1fwH4vwvVFvJgLN0w==", "dev": true, "license": "Apache-2.0", "dependencies": { - "playwright-core": "1.46.0" + "playwright-core": "1.48.1" }, "bin": { "playwright": "cli.js" @@ -178,9 +74,9 @@ } }, "node_modules/playwright-core": { - "version": "1.46.0", - "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.46.0.tgz", - "integrity": "sha512-9Y/d5UIwuJk8t3+lhmMSAJyNP1BUC/DqP3cQJDQQL/oWqAiuPTLgy7Q5dzglmTLwcBRdetzgNM/gni7ckfTr6A==", + "version": "1.48.1", + "resolved": "https://registry.npmjs.org/playwright-core/-/playwright-core-1.48.1.tgz", + "integrity": "sha512-Yw/t4VAFX/bBr1OzwCuOMZkY1Cnb4z/doAFSwf4huqAGWmf9eMNjmK7NiOljCdLmxeRYcGPPmcDgU0zOlzP0YA==", "dev": true, "license": "Apache-2.0", "bin": { @@ -190,26 +86,6 @@ "node": ">=18" } }, - "node_modules/safer-buffer": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz", - "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==", - "license": "MIT" - }, - "node_modules/seq-queue": { - "version": "0.0.5", - "resolved": "https://registry.npmjs.org/seq-queue/-/seq-queue-0.0.5.tgz", - "integrity": "sha512-hr3Wtp/GZIc/6DAGPDcV4/9WoZhjrkXsi5B/07QgX8tsdc6ilr7BFM6PM6rbdAX1kFSDYeZGLipIZZKyQP0O5Q==" - }, - "node_modules/sqlstring": { - "version": "2.3.3", - "resolved": "https://registry.npmjs.org/sqlstring/-/sqlstring-2.3.3.tgz", - "integrity": "sha512-qC9iz2FlN7DQl3+wjwn3802RTyjCx7sDvfQEXchwa6CWOx07/WVfh91gBmQ9fahw8snwGEWU3xGzOt4tFyHLxg==", - "license": "MIT", - "engines": { - "node": ">= 0.6" - } - }, "node_modules/undici-types": { "version": "6.13.0", "resolved": "https://registry.npmjs.org/undici-types/-/undici-types-6.13.0.tgz", diff --git a/end2end/package.json b/end2end/package.json index 53f076289..58924bb96 100644 --- a/end2end/package.json +++ b/end2end/package.json @@ -8,7 +8,7 @@ "license": "ISC", "description": "", "devDependencies": { - "@playwright/test": "^1.47.2", + "@playwright/test": "^1.48.1", "@types/node": "^22.1.0" } }