Skip to content

Commit

Permalink
created .env file
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobmadp committed Oct 11, 2023
1 parent 184822a commit a5d86fc
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 55 deletions.
1 change: 1 addition & 0 deletions .env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
FOO="bar100"
15 changes: 14 additions & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"devDependencies": {
"@playwright/test": "^1.37.1"
"@playwright/test": "^1.37.1",
"dotenv": "^16.3.1"
},
"scripts": {},
"dependencies": {
Expand Down
53 changes: 1 addition & 52 deletions pages/login.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,56 +43,5 @@ exports.LoginPage = class LoginPage{
await this.button_login.click();
}

async loginPortal(username, password, url){
await this.page.goto(url);
await this.button_cookieOK.click();
await this.button_openLoginPage.click();
await this.button_cookieOK.click();
await this.input_username.click();
await this.input_username.fill(username);
await this.input_password.click();
await this.input_password.fill(password);
await this.button_login.click();
}

async loginAndereURL(username, password, url){
await this.page.goto(url);
await this.button_cookieOK.click();
await this.button_cookieOK.click();
await this.input_username.click();
await this.input_username.fill(username);
await this.input_password.click();
await this.input_password.fill(password);
await this.button_login.click();
}

async login_sameSessionMitAndererURL(username, password, url){
await this.page.goto(url);
await this.input_username.click();
await this.input_username.fill(username);
await this.input_password.click();
await this.input_password.fill(password);
await this.button_login.click();
}

async login_sameSession(username, password){
await this.button_openLoginPage.click();
await this.input_username.click();
await this.input_username.fill(username);
await this.input_password.click();
await this.input_password.fill(password);
await this.button_login.click();
}

async checkPWErforderlich(){
await expect(this.text_PasswortAbgelaufen).toBeVisible();
}

async passwortAendern(passwortNeu){
await this.input_neuesPasswort.click();
await this.input_neuesPasswort.fill(passwortNeu);
await this.input_neuesPasswortWiederholen.click();
await this.input_neuesPasswortWiederholen.fill(passwortNeu);
await this.button_passwortAendern.click();
}

}
5 changes: 5 additions & 0 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import { defineConfig, devices } from '@playwright/test';
require("dotenv").config({ path: "./.env.local" });

/**
* Read environment variables from file.
Expand Down Expand Up @@ -96,4 +97,8 @@ export default defineConfig({
// command: 'npm run start',
// port: 3000,
// },


});

console.log(process.env.FOO); // prints "bar"
2 changes: 1 addition & 1 deletion tests/TF_001_Login.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ test.describe('Erfolgreicher Standard Login', () => {
})

await test.step('Negativer login', async () => {
await Login.loginAndereURL('xxxxxxxx', 'xxxxxxx', url);
await Login.login('xxxxxxxx', 'xxxxxxx', url);
})
})
})
Expand Down
5 changes: 5 additions & 0 deletions tests/test1.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { test, expect } from '@playwright/test';

test("env", async ({ page }) => {
console.log(process.env.FOO); // also prints "bar"
})

0 comments on commit a5d86fc

Please sign in to comment.