Skip to content

Commit

Permalink
feat(test): add github action for the prod
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanlewicki committed Jun 24, 2024
1 parent 5f06225 commit c9d81b5
Show file tree
Hide file tree
Showing 3 changed files with 47 additions and 2 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/cypressProd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Cypress Tests Prod

on: push

jobs:
cypress-run:
runs-on: ubuntu-22.04
env:
VITE_LOGIN_URL: https://openai.ki.fh-swf.de/api/login
VITE_API_BASE_URL: https://openai.ki.fh-swf.de/api/v1
VITE_USER_URL: https://openai.ki.fh-swf.de/api/user
CYPRESS_USER_NAME: "${{ secrets.CYPRESS_USER_NAME }}"
CYPRESS_USER_PASSWORD: "${{ secrets.CYPRESS_USER_PASSWORD }}"
LANGUAGE: de
TESTENV: "PROD"
container:
image: cypress/browsers:node-20.9.0-chrome-118.0.5993.88-1-ff-118.0.2-edge-118.0.2088.46-1
options: --user 1001
steps:
- name: Checkout
uses: actions/checkout@v4

# Install npm dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress run
uses: cypress-io/github-action@v6
with:
browser: chrome
spec: cypress/e2e/uiTest.cy.js
record: false

- uses: actions/upload-artifact@v4
# add the line below to store screenshots only on failures
if: failure()
with:
name: cypress-screenshots
path: cypress/screenshots
if-no-files-found: ignore # 'warn' or 'error' are also available, defaults to `warn`
- uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-videos
path: cypress/videos
if-no-files-found: warn # 'warn' or 'error' are also available, defaults to `warn`
3 changes: 2 additions & 1 deletion cypress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export default defineConfig({
},
env: {
"CYPRESS_USER_NAME": process.env.CYPRESS_USER_NAME,
"CYPRESS_USER_PASSWORD": process.env.CYPRESS_USER_PASSWORD
"CYPRESS_USER_PASSWORD": process.env.CYPRESS_USER_PASSWORD,
"TESTENV": process.env.TESTENV
}
});
2 changes: 1 addition & 1 deletion cypress/support/commands.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ Cypress.Commands.add("getDataTestId", (dataTestSelector) => {
});

export function setupTest(){
if(Cypress.env('TESTENV') === "PROD"){
if(Cypress.env('TESTENV') == "PROD"){
cy.visit("https://openai.ki.fh-swf.de");
cy.get("button").contains("Cluster Login").click()
cy.get('input#username').type(Cypress.env("CYPRESS_USER_NAME"));
Expand Down

0 comments on commit c9d81b5

Please sign in to comment.