-
Notifications
You must be signed in to change notification settings - Fork 12
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
Experiment/create ephemeral UI test accts #1898
Open
andrewleith
wants to merge
46
commits into
main
Choose a base branch
from
experiment/create-ephemeral-ui-test-accts
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 43 commits
Commits
Show all changes
46 commits
Select commit
Hold shift + click to select a range
225d696
fix: simplify email address names to avoid issues with IMAP
andrewleith c3eb799
fix: modify Login method to accept email alias to check for when conn…
andrewleith be37e0b
fix: new accounts go to /services page since they only belong to one …
andrewleith 7971d88
feat: new plugin to generate a random email alias, then call an endpo…
andrewleith 2f4ade7
fix: update cypress config to expose the create-account plugin, and s…
andrewleith 7dc450d
feat: update the login command to get the ephemeral email account bef…
andrewleith 706be29
feat(create-account): update create account task and pass notify test…
andrewleith d7e7f81
fix(tou_test): success can either be the /accounts page or a /service…
andrewleith db9a550
chore(email-account): refactor and clean up code a bit; ensure connec…
andrewleith fb5bd26
feat(config): simplify config
andrewleith 1d3bd62
fix up ids
andrewleith f199ad4
chore(refactor): refactor login command; add login command for platfo…
andrewleith c987242
task(cypress config): add back SMS template ID
andrewleith ac9019a
fix(tou_prompt test): add assertion to ensure success of agreeing to …
andrewleith b79f8a0
fix(create-account): simplify call to api; remove posting of the pass…
andrewleith 77c143a
chore(email-account): remove debug logging
andrewleith 624da0b
Merge branch 'main' into experiment/create-ephemeral-ui-test-accts
andrewleith 36bfe45
fix: add template category to the test that will be empty for email
andrewleith 213e7e4
fix(create-account): remove pw prop
andrewleith 862a203
Merge branch 'main' into experiment/create-ephemeral-ui-test-accts
andrewleith 689222b
chore: remove debug log
andrewleith b3082b5
fix: dont try to delete emails when there is none
andrewleith 8e06612
fix: update calls to login across tests
andrewleith 9a7d00d
chore: update test and get values from config
andrewleith e871344
Merge branch 'main' into experiment/create-ephemeral-ui-test-accts
andrewleith 6978d52
chore: add README, extra npm script
andrewleith 9c64b3b
chore: formatting
andrewleith b45c710
Merge branch 'main' into experiment/create-ephemeral-ui-test-accts
andrewleith 63a1b92
fix(cypress): update tests to use updated, simplified `cy.login()` co…
andrewleith d3f2d37
chore: formatting
andrewleith becd2ab
chore: update config to use staging
andrewleith 7388a22
Merge branch 'main' into experiment/create-ephemeral-ui-test-accts
andrewleith bbe2bdb
fix(remaining_messages_summary test): add assert to ensure test waits…
andrewleith c314ea8
chore: remove debug code
andrewleith 0183f84
fix(template_filters test): make sure the scenario ends in no results
andrewleith 213c122
fix(cypress login): use cypress auth to get new user
andrewleith b2e0597
Merge branch 'experiment/create-ephemeral-ui-test-accts' of https://g…
andrewleith 47a192b
fix failing tests
andrewleith 17a806d
Merge branch 'experiment/create-ephemeral-ui-test-accts' of https://g…
andrewleith 1548f49
fix(cypress config): add back retries
andrewleith 5f53f67
please [review] me
andrewleith 2cec1b1
Merge branch 'experiment/create-ephemeral-ui-test-accts' of https://g…
andrewleith 62a2536
fix: change secret name for new user password so this wont conflict w…
andrewleith c10d268
chore: README updates
andrewleith 413a870
chore: remove unused import
andrewleith 5aaa300
chore: removed comments
andrewleith File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Notify + Cypress 🎉 | ||
|
||
## Setup | ||
This folder contains Cypress tests suites. In order to run them, you'll need to install cypress and its dependencies. If you're running inside the dev container, rebuild your dev container to get the necessary packages. | ||
|
||
## Running the tests | ||
### In your devcontainer | ||
There are some issues getting the cypress UI to launch within the devcontainer. For now, you can run the headless tests inside the dev container but if you want to launch the cypress UI you will need to do that outside of the dev container. | ||
|
||
There are 3 helper scripts in `package.json` to run 2 of the test suites. Run these from the `tests_cypress/` folder: | ||
- `npm run cypress`: this will open Cypress with its UI and you can choose any test suite to run | ||
- `npm run a11y`: this will run the accessibility tests in headless mode using the electron browser | ||
- `npm run ci`: this will run the headless CI tests in headless mode using the electron browser | ||
|
||
### Outside of your devcontainer | ||
To launch the cypress UI, where you can choose your test suite and visually debug and inspect tests, run (from the `tests_cypress/` folder): | ||
- `npm run cypress`: this will open the cypress UI where you can choose which tests to run and in which browser | ||
|
||
### Local installation | ||
To install cypress locally, use the following command, from the `tests_cypress/` folder: | ||
```bash | ||
npm install | ||
npx cypress install | ||
``` | ||
|
||
## Configuration | ||
- `cypress.env.json`: this file contains sensitive items like api keys and passphrases that you'll need to run the tests. You'll need to add the file `cypress.env.json` into the `tests_cypress/` folder and its contents can be found in 1password. | ||
- `config.js`: this file contains non-sensitive items like template ids and hostnames that you'll need to run the tests | ||
|
||
### `cypress.env.json` contents | ||
| key | description | | ||
| --------------- | ----------------------------------------------- | | ||
| ADMIN_SECRET | Secret admin uses to authenticate against API | | ||
| ADMIN_USERNAME | Username admin uses to authenticate against API | | ||
| NOTIFY_USER | Notify user used by the tests | | ||
| NOTIFY_PASSWORD | Password of NOTIFY_USER | | ||
| IMAP_PASSWORD | IMAP password of gmail account for NOTIFY_USER | | ||
|
||
### Target environment 🎯 | ||
The tests are configured to run against the staging environment by default. To run the tests against your local environment, you'll need to create a local service and API keys and store these values in your config. You will also need to update the `ConfigToUse` variable in `config.js` file: | ||
```js | ||
const ConfigToUse = config.LOCAL; | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,20 @@ | ||
let COMMON = { | ||
Services: { | ||
Cypress: 'd4e8a7f4-2b8a-4c9a-8b3f-9c2d4e8a7f4b' | ||
}, | ||
Templates: { | ||
'SMOKE_TEST_EMAIL': 'f47ac10b-58cc-4372-a567-0e02b2c3d479', | ||
'SMOKE_TEST_SMS': 'e4b8f8d0-6a3b-4b9e-8c2b-1f2d3e4a5b6c', | ||
}, | ||
}; | ||
|
||
let STAGING = { | ||
CONFIG_NAME: "STAGING", | ||
Hostnames: { | ||
API: 'https://api.staging.notification.cdssandbox.xyz', | ||
Admin: 'https://staging.notification.cdssandbox.xyz', | ||
DDAPI: 'https://api.document.staging.notification.cdssandbox.xyz', | ||
}, | ||
Services: { | ||
Notify: 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553', | ||
Cypress: '5c8a0501-2aa8-433a-ba51-cefb8063ab93' | ||
}, | ||
Templates: { | ||
'FILE_ATTACH_TEMPLATE_ID': '7246c71e-3d60-458b-96af-af17a5b07659', | ||
'SIMPLE_EMAIL_TEMPLATE_ID': '939dafde-1b60-47f0-a6d5-c9080d92a4a8', | ||
'VARIABLES_EMAIL_TEMPLATE_ID': '1101a00a-11b7-4036-865c-add43fcff7c9', | ||
'SMOKE_TEST_EMAIL': '5e26fae6-3565-44d5-bfed-b18680b6bd39', | ||
'SMOKE_TEST_EMAIL_BULK': '04145882-0f21-4d57-940d-69883fc23e77', | ||
'SMOKE_TEST_EMAIL_ATTACH': 'bf85def8-01b4-4c72-98a8-86f2bc10f2a4', | ||
'SMOKE_TEST_EMAIL_LINK': '37924e87-038d-48b8-b122-f6dddefd56d5', | ||
'SMOKE_TEST_SMS': '16cae0b3-1d44-47ad-a537-fd12cc0646b6' | ||
}, | ||
Users: { | ||
Team: ['[email protected]'], | ||
NonTeam: ['[email protected]'], | ||
Simulated: ['[email protected]', '[email protected]', '[email protected]'], | ||
SimulatedPhone: ['+16132532222', '+16132532223', '+16132532224'] | ||
}, | ||
Organisations: { | ||
'DEFAULT_ORG_ID': '4eef762f-383d-4068-81ca-c2c5c186eb16', | ||
'NO_CUSTOM_BRANDING_ORG_ID': '4eef762f-383d-4068-81ca-c2c5c186eb16' | ||
}, | ||
ReplyTos: { | ||
Default: '24e5288d-8bfa-4ad4-93aa-592c11a694cd', | ||
Second: '797865c4-788b-4184-91ae-8e45eb07e40b' | ||
}, | ||
viewports: [320, 375, 640, 768] | ||
}; | ||
|
||
let LOCAL = { | ||
|
@@ -43,43 +24,15 @@ let LOCAL = { | |
Admin: 'http://localhost:6012', | ||
DDAPI: 'http://localhost:7000', | ||
}, | ||
Services: { | ||
Notify: 'd6aa2c68-a2d9-4437-ab19-3ae8eb202553', | ||
Cypress: '5c8a0501-2aa8-433a-ba51-cefb8063ab93' | ||
}, | ||
Templates: { | ||
'FILE_ATTACH_TEMPLATE_ID': 'e52acc48-dcb9-4f70-81cf-b87d0ceaef1b', | ||
'SIMPLE_EMAIL_TEMPLATE_ID': '0894dc6c-1b07-465e-91f0-aa76f202a83f', | ||
'VARIABLES_EMAIL_TEMPLATE_ID': 'fa00aa13-87fd-4bc7-9349-ba9270347055', | ||
'SMOKE_TEST_EMAIL': '08673acf-fef1-408d-8ce7-7809907595b2', | ||
'SMOKE_TEST_EMAIL_BULK': 'efbd319b-4de8-41c7-850f-93ec0490d3c2', | ||
'SMOKE_TEST_EMAIL_ATTACH': 'cbd5307f-8662-4cea-9b8e-3bc672bf005c', | ||
'SMOKE_TEST_EMAIL_LINK': '94cce202-b171-440f-b0c1-734368ca9494', | ||
'SMOKE_TEST_SMS': 'a9fff158-a745-417a-b1ec-ceebcba6614f' | ||
}, | ||
Users: { | ||
Team: ['[email protected]'], | ||
NonTeam: ['[email protected]'], | ||
Simulated: ['[email protected]', '[email protected]', '[email protected]'], | ||
SimulatedPhone: ['+16132532222', '+16132532223', '+16132532224'] | ||
}, | ||
Organisations: { | ||
'DEFAULT_ORG_ID': 'ff9e5ddd-926f-4ae2-bc87-f5104262ca17', | ||
'NO_CUSTOM_BRANDING_ORG_ID': '39b3230e-300a-42f4-bfb7-40b20b704d44' | ||
}, | ||
ReplyTos: { | ||
Default: '8c2a9b22-8fec-4ad9-bca8-658abbb7406e', | ||
Second: 'fc4d2266-5594-47d0-8056-7bef62d59177' | ||
}, | ||
viewports: [320, 375, 640, 768] | ||
}; | ||
|
||
const config = { | ||
COMMON, | ||
STAGING, | ||
LOCAL, | ||
}; | ||
|
||
// choose which config to use here | ||
const ConfigToUse = config.STAGING; | ||
const ConfigToUse = { ...config.COMMON, ...config.STAGING }; | ||
|
||
module.exports = ConfigToUse; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -82,7 +82,7 @@ const pages = [ | |
describe(`A11Y - App pages [${config.CONFIG_NAME}]`, () => { | ||
for (const page of pages) { | ||
it(`${page.name}`, () => { | ||
cy.login(Cypress.env("NOTIFY_USER"), Cypress.env("NOTIFY_PASSWORD")); | ||
cy.login(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The login command has been simplified to use the generated user and the password automatically. |
||
cy.a11yScan(page.route, { | ||
a11y: true, | ||
htmlValidate: true, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The result of this call is "cached" in the
global
object here, which means only one set of test users is generated for every test run or every time you launch the cypress UI. To get a new user, just quit cypress and launch it again.