Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
23 changes: 0 additions & 23 deletions .env

This file was deleted.

56 changes: 56 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: E2E Testing

on:
push:
branches: master
pull_request:
branches: master

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
node-version: [16.x]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Set up Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}

- name: Install dependencies
run: npm ci

- name: Start the dev server and Cypress testing
env:
REACT_APP_url: ${{secrets.REACT_APP_url}}
REACT_APP_UCI_BASE_URL: ${{secrets.REACT_APP_UCI_BASE_URL}}
REACT_APP_nl_url: ${{secrets.REACT_APP_nl_url}}
REACT_APP_user_segment_url: ${{secrets.REACT_APP_user_segment_url}}
REACT_APP_nl_login_url: ${{secrets.REACT_APP_nl_login_url}}
REACT_APP_nl_login_token: ${{secrets.REACT_APP_nl_login_token}}
REACT_APP_nl_application_id: ${{secrets.REACT_APP_nl_application_id}}
REACT_APP_blobUrl: ${{secrets.REACT_APP_blobUrl}}
REACT_APP_botPhoneNumber: ${{secrets.REACT_APP_botPhoneNumber}}
REACT_APP_adapterId: ${{secrets.REACT_APP_adapterId}}
REACT_APP_broadcastAdapterId: ${{secrets.REACT_APP_broadcastAdapterId}}
REACT_APP_userId: ${{secrets.REACT_APP_userId}}
REACT_APP_orgId: ${{secrets.REACT_APP_orgId}}
REACT_APP_token: ${{secrets.REACT_APP_token}}
REACT_APP_LOGIC_TRANSFORMER_ID: ${{secrets.REACT_APP_LOGIC_TRANSFORMER_ID}}
REACT_APP_HOSTED_FORM_URL: ${{secrets.REACT_APP_HOSTED_FORM_URL}}
REACT_APP_USER_ID: ${{secrets.REACT_APP_USER_ID}}
REACT_APP_USER_PASSWORD: ${{secrets.REACT_APP_USER_PASSWORD}}
run: npm run start & sleep 10 && npm run test
- name: Uploading Test Video (can be downloaded from Summary)
uses: actions/upload-artifact@v3
if: always()
with:
name: Test Video
path: cypress/videos
retention-days: 7
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

# misc
.DS_Store
.env
.env.local
.env.development.local
.env.test.local
Expand Down
14 changes: 14 additions & 0 deletions cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { defineConfig } from "cypress";
require('dotenv').config()

export default defineConfig({
e2e: {
setupNodeEvents(on, config) {
config.env = {
...process.env,
...config.env
}
return config
}
},
});
47 changes: 47 additions & 0 deletions cypress/e2e/login.cy.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
describe('Login page', () => {
beforeEach(() => {
cy.visit('http://localhost:3000');
});

it('should have user id input box with correct attributes', () => {
cy.get(
'#root > div > div.row > div > div > div.col-4.p-5 > form > div:nth-child(1) > input'
)
.should('exist')
.should('have.attr', 'name', 'loginId');
});

it('should have password input box with correct attributes', () => {
cy.get(
'#root > div > div.row > div > div > div.col-4.p-5 > form > div:nth-child(2) > input'
)
.should('exist')
.should('have.attr', 'name', 'password');
});

it('should have a sign in button with correct attributes', () => {
cy.get('#root > div > div.row > div > div > div.col-4.p-5 > form > button')
.should('exist')
.should('have.text', 'Sign in');
});

it('should sign in and check if the user is logged in', () => {
// Enter values in the user id and password inputs
cy.get(
'#root > div > div.row > div > div > div.col-4.p-5 > form > div:nth-child(1) > input'
).type(Cypress.env('REACT_APP_USER_ID'));
cy.get(
'#root > div > div.row > div > div > div.col-4.p-5 > form > div:nth-child(2) > input'
).type(Cypress.env('REACT_APP_USER_PASSWORD'));
// Press the sign-in button
cy.get(
'#root > div > div.row > div > div > div.col-4.p-5 > form > button'
).click();

cy.wait(1000);
cy.get(
'#root > div > div.row > div.col-2.p-0 > div > aside > div > div > div.css-1vmkajq > div > p'
).should('exist'); // Assuming the UCI Dashboard text appears after logging in
// Add more assertions to verify the presence of logged-in elements or updated application state
});
});
5 changes: 5 additions & 0 deletions cypress/fixtures/example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"name": "Using fixtures to represent data",
"email": "hello@cypress.io",
"body": "Fixtures are a great way to mock data for responses to routes"
}
37 changes: 37 additions & 0 deletions cypress/support/commands.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/// <reference types="cypress" />
// ***********************************************
// This example commands.ts shows you how to
// create various custom commands and overwrite
// existing commands.
//
// For more comprehensive examples of custom
// commands please read more here:
// https://on.cypress.io/custom-commands
// ***********************************************
//
//
// -- This is a parent command --
// Cypress.Commands.add('login', (email, password) => { ... })
//
//
// -- This is a child command --
// Cypress.Commands.add('drag', { prevSubject: 'element'}, (subject, options) => { ... })
//
//
// -- This is a dual command --
// Cypress.Commands.add('dismiss', { prevSubject: 'optional'}, (subject, options) => { ... })
//
//
// -- This will overwrite an existing command --
// Cypress.Commands.overwrite('visit', (originalFn, url, options) => { ... })
//
// declare global {
// namespace Cypress {
// interface Chainable {
// login(email: string, password: string): Chainable<void>
// drag(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// dismiss(subject: string, options?: Partial<TypeOptions>): Chainable<Element>
// visit(originalFn: CommandOriginalFn, url: string, options: Partial<VisitOptions>): Chainable<Element>
// }
// }
// }
20 changes: 20 additions & 0 deletions cypress/support/e2e.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// ***********************************************************
// This example support/e2e.ts is processed and
// loaded automatically before your test files.
//
// This is a great place to put global configuration and
// behavior that modifies Cypress.
//
// You can change the location of this file or turn off
// automatically serving support files with the
// 'supportFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/configuration
// ***********************************************************

// Import commands.js using ES2015 syntax:
import './commands'

// Alternatively you can use CommonJS syntax:
// require('./commands')
8 changes: 8 additions & 0 deletions cypress/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"lib": ["es5", "dom"],
"types": ["cypress", "node"]
},
"include": ["**/*.ts"]
}
Binary file added cypress/videos/login.cy.ts.mp4
Binary file not shown.
Loading