Skip to content

Commit 9a75aec

Browse files
authored
Merge pull request #10 from ls1intum/9-develop-be-able-to-connect-to-local-and-deployed-instance
9 develop be able to connect to local and deployed instance
2 parents c9db814 + 71b2f6e commit 9a75aec

File tree

11 files changed

+117
-467
lines changed

11 files changed

+117
-467
lines changed

.github/workflows/playwright.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ jobs:
88
test:
99
timeout-minutes: 60
1010
runs-on: ubuntu-latest
11+
env:
12+
BASE_URL: ${{ secrets.BASE_URL }}
13+
KEYCLOAK_USER: ${{ secrets.KEYCLOAK_USER }}
14+
KEYCLOAK_PWD: ${{ secrets.KEYCLOAK_PWD }}
1115
steps:
1216
- uses: actions/checkout@v4
1317
- uses: actions/setup-node@v4

.gitignore

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,8 @@ node_modules/
55
/playwright-report/
66
/blob-report/
77
/playwright/.cache/
8-
/tests-example/
8+
/tests-example/
9+
10+
# For Local Development
11+
/.auth/
12+
playwright.env

pages/LandingPage.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,14 @@ export class LandingPage {
1010
this.page = page;
1111
}
1212

13-
async goto() {
14-
await this.page.goto('/');
15-
}
16-
1713
async clickLoginButton() {
1814
return this.page.getByRole('button', { name: 'Login' }).click();
1915
}
2016

21-
17+
async login(username: string, password: string) {
18+
await this.clickLoginButton();
19+
await this.page.getByRole('textbox', { name: 'Username' }).fill(username);
20+
await this.page.getByRole('textbox', { name: 'Password' }).fill(password);
21+
await this.page.getByRole('button', { name: 'Sign in' }).click();
22+
}
2223
}

playwright.config.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,24 @@ export default defineConfig({
3838

3939
/* Configure projects for major browsers */
4040
projects: [
41+
{ name: 'setup', testMatch: /.*\.setup\.ts/ },
42+
4143
{
4244
name: 'chromium',
43-
use: { ...devices['Desktop Chrome'] },
45+
use: {
46+
...devices['Desktop Chrome'],
47+
storageState: './.auth/user.json',
48+
},
49+
dependencies: ['setup'],
50+
},
51+
52+
{
53+
name: 'local',
54+
testMatch: /.*\.ide\.spec\.ts/,
55+
use: {
56+
headless: false,
57+
baseURL: process.env.LOCAL_URL || 'http://localhost:3000',
58+
},
4459
},
4560

4661
],

playwright.env

Lines changed: 0 additions & 1 deletion
This file was deleted.

playwright.env.template

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
BASE_URL=https://theia.artemis.cit.tum.de # The URL of the Theia Landing Page
2+
LOCAL_URL=http://localhost:3000 # Locally deployed Theia (Change the URL/Port if needed)
3+
INSTANCE_URL=https://instance.theia.artemis.cit.tum.de # The URL of the Theia Onlinde IDE (Local or Deployed)
4+
KEYCLOAK_USER= # Username for Keycloak
5+
KEYCLOAK_PWD= # Password for Keycloak

0 commit comments

Comments
 (0)