Skip to content

Commit

Permalink
Spsh 265 Angebote per Link öffnen (#5)
Browse files Browse the repository at this point in the history
* Test case Angebot itsLearning öffnen finished

* fix
  • Loading branch information
jakobmadp authored Jan 4, 2024
1 parent 18c5f9f commit 66112ea
Show file tree
Hide file tree
Showing 6 changed files with 83 additions and 3 deletions.
11 changes: 11 additions & 0 deletions pages/email4teacher.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { type Locator, Page } from '@playwright/test';

export class Email4TeacherPage{
readonly page: Page;
readonly text_h1: Locator;

constructor(page){
this.page = page;
this.text_h1 = page.getByRole('heading', { name: 'E-Mail', exact: true }).locator('span');
}
}
11 changes: 11 additions & 0 deletions pages/itslearning.page.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import { type Locator, Page } from '@playwright/test';

export class ItsLearningPage{
readonly page: Page;
readonly text_h1: Locator;

constructor(page){
this.page = page;
this.text_h1 = page.getByRole('heading', { name: 'Schulen des Landes Schleswig-Holstein' });
}
}
4 changes: 2 additions & 2 deletions pages/menue.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ export class MenuePage{

constructor(page){
this.page = page;
this.button_Anmelden = page.getByRole('button', { name: 'Anmelden' });
this.button_Abmelden = page.getByRole('button', { name: 'Abmelden' });
this.button_Anmelden = page.getByRole('link', { name: 'Anmelden' });
this.button_Abmelden = page.getByRole('link', { name: 'Abmelden' });
this.button_Startseite = page.getByRole('link', { name: 'Home' });
}
}
4 changes: 4 additions & 0 deletions pages/start.page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ import { type Locator, Page } from '@playwright/test';
export class StartPage{
readonly page: Page;
readonly text_h2_Ueberschrift: Locator;
readonly card_item_email: Locator;
readonly card_item_itslearning: Locator;

constructor(page){
this.page = page;
this.text_h2_Ueberschrift = page.getByRole('heading', { name: 'Alle Angebote' });
this.card_item_email = page.getByTestId('provider-card-1');
this.card_item_itslearning = page.getByTestId('provider-card-2');
}
}
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { defineConfig, devices } from '@playwright/test';
import dotenv from "dotenv";
dotenv.config({
path: "./.env.helm",
path: "./.env.dev",
});

export default defineConfig({
Expand Down
54 changes: 54 additions & 0 deletions tests/workflow.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
import { test, expect } from '@playwright/test';
import { LoginPage } from '../pages/login.page';
import { MenuePage } from '../pages/menue.page';
import { StartPage } from '../pages/start.page';
import { Email4TeacherPage } from '../pages/email4teacher.page';
import { ItsLearningPage } from '../pages/itslearning.page';

const PW = process.env.PW;
const USER = process.env.USER;
const URL_PORTAL = process.env.URL_PORTAL;

test.describe(`Testfälle für den Test von workflows: Umgebung: ${process.env.UMGEBUNG}: URL: ${process.env.URL_PORTAL}:`, () => {
test('SPSH-122 Angebote per Link öffnen', async ({ page}) => {
const Login = new LoginPage(page);
const Menue = new MenuePage(page);
const Startseite = new StartPage(page);

await test.step(`Portal öffnen ${URL_PORTAL}`, async () => {
await page.goto(URL_PORTAL);
})

await test.step(`Annmelden mit Benutzer ${USER}`, async () => {
await Menue.button_Anmelden.click();
await Login.login(USER, PW);
await expect(Menue.button_Abmelden).toBeVisible();
})

await test.step(`Startseite öffnen`, async () => {
await Menue.button_Startseite.click();
await Startseite.text_h2_Ueberschrift.click();
})

await test.step(`Kacheln Email für Lehrkräfte und Itslearning öffnen, danach beide Kacheln wieder schließen`, async () => {
const page_Email4Teacher_Promise = page.waitForEvent('popup');
await Startseite.card_item_email.click();
const page_Email4Teacher = await page_Email4Teacher_Promise;
const Email4Teacher = new Email4TeacherPage(page_Email4Teacher);
await Email4Teacher.text_h1.click();

const page_Itslearning_Promise = page.waitForEvent('popup');
await Startseite.card_item_itslearning.click();
const page_Itslearning = await page_Itslearning_Promise;
const Itslearning = new ItsLearningPage(page_Itslearning);
await Itslearning.text_h1.click();

await page_Itslearning.close();
await page_Email4Teacher.close();
})

await test.step(`Prüfen, dass die Startseite noch geöffnet ist`, async () => {
await Startseite.text_h2_Ueberschrift.click();
})
})
})

0 comments on commit 66112ea

Please sign in to comment.