To visit the compiled site, please see the develop site or the production site.
yarn
yarn web
amplify checkout env dev
amplify pull to get the latest changes from the AWS backend. The latest amplify folder should be committed regularly to the git branch with the same name as the amplify env (for feature previews with accompanying amplify changes). When a pull request is merged into develop or main, the dev or main environment's latest changes should be committed to the develop or main branch in our git repository. For these reasons, when running amplify pull, it is likely that your environment is already up-to-date.
amplify env checkout annual_weather.
amplify push to provision and test your resources.
Note that amplify mock is not supported with our project because it uses an RDS datastore.
python3.11 -m venv venv && source venv/bin/activate
pip install mysql-connector-python
End user and component testing uses the Cypress library. By accepting your invitation to the Cypress project for the fLEX Admin Portal, you will be able to view videos of test runs and results. To log in to Cypress, simply npx cypress open, select "Log In" and follow the prompts.
When you create a new component or view, developers must write a test for it. Name view tests by the view name followed by .cy.tsx. For example, the test for the Home view is Home.cy.tsx. Name component tests by the name "index" followed by the component name followed by .cy.tsx. For example, the test for the FLEXButton component is indexFLEXButton.cy.tsx.
A basic unit test for the React component should start by testing rendering of the component. For example, in indexFLEXButton.cy.tsx:
import React from "react"
import FLEXButton from "../app/View/Components/FLEXButton/index"
describe("<FLEXButton />", () => {
it("renders", () => {
cy.mount(
<FLEXButton />
)
})
// Add more tests here...
})
For an example of test coverage in components, see indexFLEXCard.cy.tsx. You should cover the configurable props and the component's behavior in response to those props.
For more details on writing tests, see the Cypress React component docs page.
End user test spec files are located in the Cypress e2e folder. These tests are written in TypeScript and use the Cypress API to interact with the application. For example, in auth.spec.cy.ts:
describe("auth end-to-end tests", () => {
const baseUrl = Cypress.env("BASE_URL")
beforeEach(() => {
cy.visit(baseUrl)
})
it("should display the email and password fields", () => {
cy.get("input[type=password]").should("exist")
cy.get("input[type=email]").should("exist")
})
// ... more tests (see file for full example)
})
For more details on writing end user tests, see the Cypress end-to-end testing docs page.
Running end user tests requires the application to be running. To run the application, use yarn web in one terminal and yarn test:e2e in another terminal. Running component tests does not require the application to be running.
yarn test
yarn test:e2e
yarn test:cmp
All tests are ran and recorded automatically in our CI/CD flow for the develop and main branches. To record a test run manually, you can run the following commands:
Run any of the testing commands with :record at the end. For example, yarn test:e2e:record will record the end user tests for other Cypress users in our organization to review.
Failed recorded test cases send a notification to our Slack channel to alert developers of the failure.
To test the production build locally, yarn s will build and serve the compiled site. This is useful for testing the production build locally before deploying.
Serving uses the "serve" npm package. When you run yarn s, serve will give you a link to the local server. Open this link in your web brower to view a test run of the production build.
For more information on the fLEX Admin Portal, see the fLEX Admin Portal documentation. This README file will be used as the front page for the documentation site.
Docs are generated by typedoc and use tsdoc comments from the source code (currently only Model and ViewModel produce meaninfgul docs).
To generate docs, run yarn document and open the generated index.html file in the docs folder in your browser. To deply the docs, run yarn deploy:docs.