Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
c3f2a64
add initial example workflow
zoe-marie Feb 21, 2024
f2a70b0
update testing steps to yarn test
zoe-marie Feb 21, 2024
545a87d
add checkout repo
zoe-marie Feb 21, 2024
dad37a7
add setup node js
zoe-marie Feb 21, 2024
59dc37e
add yarn install
zoe-marie Feb 21, 2024
253b4e8
rename test
zoe-marie Feb 21, 2024
be8bf38
change test text to correct value
zoe-marie Feb 27, 2024
e22c711
add end to end tests
zoe-marie Feb 27, 2024
53ccce0
add playwright url for test env
zoe-marie Feb 27, 2024
a1a282e
add install playwright browser
zoe-marie Feb 27, 2024
582805c
fix: typo in localhost
zoe-marie Feb 27, 2024
580b128
test: add some logging
zoe-marie Feb 27, 2024
c8a58c3
test: ci env variable
zoe-marie Feb 27, 2024
69c84b7
fix: make CI env variable empty
zoe-marie Feb 27, 2024
151f57b
fix: unset CI env var, set by default in GithHub Actions
zoe-marie Feb 27, 2024
f947b08
try without playwright browser
zoe-marie Feb 27, 2024
14881e0
add pre commit tests
zoe-marie Feb 28, 2024
2a66977
this is a test commit
zoe-marie Feb 28, 2024
920f3dd
change test comand
zoe-marie Mar 7, 2024
c7117b7
change when test runs
zoe-marie Mar 7, 2024
9f6e54b
add initial example workflow
zoe-marie Feb 21, 2024
7f953ba
update testing steps to yarn test
zoe-marie Feb 21, 2024
32bdb74
add checkout repo
zoe-marie Feb 21, 2024
fb86ce6
add setup node js
zoe-marie Feb 21, 2024
5c20ad9
add yarn install
zoe-marie Feb 21, 2024
ab24e9e
rename test
zoe-marie Feb 21, 2024
4db2965
change test text to correct value
zoe-marie Feb 27, 2024
60709c5
add end to end tests
zoe-marie Feb 27, 2024
85c5942
add playwright url for test env
zoe-marie Feb 27, 2024
59668f5
add install playwright browser
zoe-marie Feb 27, 2024
32d3d09
fix: typo in localhost
zoe-marie Feb 27, 2024
fb495c7
test: add some logging
zoe-marie Feb 27, 2024
515093f
test: ci env variable
zoe-marie Feb 27, 2024
158228d
fix: make CI env variable empty
zoe-marie Feb 27, 2024
571414c
fix: unset CI env var, set by default in GithHub Actions
zoe-marie Feb 27, 2024
0461793
try without playwright browser
zoe-marie Feb 27, 2024
de3f34e
add pre commit tests
zoe-marie Feb 28, 2024
60371e7
this is a test commit
zoe-marie Feb 28, 2024
9cb53d6
change test comand
zoe-marie Mar 7, 2024
94f399b
change when test runs
zoe-marie Mar 7, 2024
1eebba2
Merge branch 'feature/create-test-job' of https://github.com/codeuniv…
zoe-marie Mar 7, 2024
18ce80c
change backstage url port in e2e test
zoe-marie Mar 7, 2024
c21039a
Update test command in run-tests.yml
zoe-marie Mar 7, 2024
1263581
add testing section to readme
zoe-marie Mar 7, 2024
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
38 changes: 38 additions & 0 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Test and E2E tests
run-name: Run tests and E2E tests

on:
push:
pull_request:
branches:
- main
jobs:
run-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Use Node.js
uses: actions/setup-node@v3
with:
node-version: '20'
- run: yarn install
- run: yarn backstage-cli repo test

run-e2e-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4 #chekcout te repository
- name: Use Node.js
uses: actions/setup-node@v3 #setup node version 20
with:
node-version: '20'

- name: Install dependencies #install dependencies
run: yarn install

- name: Run E2E tests
env:
PLAYWRIGHT_URL: http://localhost:3000 # set the URL of the app to test with playwright
CI: # unset CI because it is set by default in Github actions
run: |
yarn test:e2e
14 changes: 14 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,17 @@ This file changes some base values that are necessary to build the correct image
**`app-config.production.yaml`:**
<br>
This file adds one line to the kubernetes plugin setup, which is only needed if the app is hosted inside of a kubernetes cluster.

# Testing

Before committing your changes, run the tests pls. ✨

```sh
yarn test
```

to run tests without end to end testing run:

```sh
yarn backstage-cli repo test
```
7 changes: 6 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"tsc": "tsc",
"tsc:full": "tsc --skipLibCheck false --incremental false",
"clean": "backstage-cli repo clean",
"test": "backstage-cli repo test",
"test": "backstage-cli repo test && playwright test",
"test:all": "backstage-cli repo test --coverage",
"test:e2e": "playwright test",
"fix": "backstage-cli repo fix",
Expand All @@ -31,6 +31,10 @@
"docker:remove-all": "docker compose down",
"new": "backstage-cli new --scope internal"
},
"pre-commit": [
"yarn test",
"yarn e2e-test"
],
"workspaces": {
"packages": [
"packages/*",
Expand Down Expand Up @@ -62,4 +66,5 @@
"prettier --write"
]
}

}
2 changes: 1 addition & 1 deletion packages/app/e2e-tests/app.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,5 @@ import { test, expect } from '@playwright/test';
test('App should render the welcome page', async ({ page }) => {
await page.goto('/');

await expect(page.getByText('My Company Catalog')).toBeVisible();
await expect(page.getByText('Scaffolded Backstage App')).toBeVisible();
});
2 changes: 1 addition & 1 deletion packages/app/src/App.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ describe('App', () => {
{
data: {
app: { title: 'Test' },
backend: { baseUrl: 'http://localhost:7007' },
backend: { baseUrl: 'http://localhost:3000' },
techdocs: {
storageUrl: 'http://localhost:7007/api/techdocs/static/docs',
},
Expand Down
12 changes: 2 additions & 10 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -8915,7 +8915,8 @@
resolved "https://registry.yarnpkg.com/@types/range-parser/-/range-parser-1.2.7.tgz#50ae4353eaaddc04044279812f52c8c65857dbcb"
integrity sha512-hKormJbkJqzQGhziax5PItDUTMAM9uE2XXQmM37dyd4hVM+5aVl7oVxMVUiVQn2oCQFN/LKCZdvSM0pFRqbSmQ==

"@types/react-dom@*", "@types/react-dom@^18.0.0":
"@types/react-dom@*", "@types/react-dom@^18", "@types/react-dom@^18.0.0":
"@types/react-dom@*", "@types/react-dom@^18", "@types/react-dom@^18.0.0":
version "18.2.19"
resolved "https://registry.yarnpkg.com/@types/react-dom/-/react-dom-18.2.19.tgz#b84b7c30c635a6c26c6a6dfbb599b2da9788be58"
integrity sha512-aZvQL6uUbIJpjZk4U8JZGbau9KDeAwMfmhyWorxgBkqDIEf6ROjRozcmPIicqsUwPUjbkDfHKgGee1Lq65APcA==
Expand Down Expand Up @@ -8953,15 +8954,6 @@
dependencies:
"@types/react" "*"

"@types/react@*", "@types/react@^16.13.1 || ^17.0.0 || ^18.0.0":
version "18.2.56"
resolved "https://registry.yarnpkg.com/@types/react/-/react-18.2.56.tgz#2d3e9021a0b6eb5bfc227761cc61b1c6dc6e0cd8"
integrity sha512-NpwHDMkS/EFZF2dONFQHgkPRwhvgq/OAvIaGQzxGSBmaeR++kTg6njr15Vatz0/2VcCEwJQFi6Jf4Q0qBu0rLA==
dependencies:
"@types/prop-types" "*"
"@types/scheduler" "*"
csstype "^3.0.2"

"@types/react@^16.13.1 || ^17.0.0":
version "17.0.75"
resolved "https://registry.yarnpkg.com/@types/react/-/react-17.0.75.tgz#cffbc76840a12fcadaf5a3cf14878bb06efcf73d"
Expand Down