Skip to content

Commit

Permalink
live-html-gui-done
Browse files Browse the repository at this point in the history
  • Loading branch information
yacekmm committed Dec 6, 2024
1 parent dcd3241 commit 70809cd
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 19 deletions.
39 changes: 39 additions & 0 deletions services/promoter-ui/src/e2e/test/concerts/concert-operations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {BrowserTools} from "../shared/browser-tools";
import {By, element} from "protractor";

export class ConcertOperations {
private browserTools: BrowserTools;
Expand All @@ -7,4 +8,42 @@ export class ConcertOperations {
this.browserTools = browserTools;
}

assertPageIsOpened() {
this.browserTools.getPageTitle().then(pageTitle => expect(pageTitle).toEqual('Promoter Platform'));
return this;
}

openAddConcert() {
element(By.id("menu-concerts-add")).click()
return this;
}

createConcert() {
element(By.id("input-concert-title")).sendKeys("concert Title");
element(By.id("create-concert-submit")).click();
return this;
}

assertCreateConcertSuccess() {
let successConfirmation = element(By.className("mat-simple-snackbar"));
this.browserTools.waitUntilIsVisible(successConfirmation)
.then(unused =>
expect(successConfirmation.isDisplayed()).toBeTruthy()
);
return this;
}

openConcertsList() {
element(By.id("menu-concerts-list")).click();
return this;
}

assertAllConcertsListed(expectedConcertTitles: string[]) {
element.all(By.className('mat-row'))
.all(By.className('concert-title'))
.getText()
.then(value =>
expect(value).toEqual(expectedConcertTitles)
);
}
}
31 changes: 12 additions & 19 deletions services/promoter-ui/src/e2e/test/concerts/concert.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,42 +1,35 @@
import {browser, By, element, protractor} from "protractor";
import {BrowserTools} from "../shared/browser-tools";
import {ConcertOperations} from "./concert-operations";

describe('ui', () => {

let browserTools: BrowserTools
let concertOperations: ConcertOperations

beforeEach(() => {
browserTools = new BrowserTools();
browserTools.initBrowser();
concertOperations = new ConcertOperations(browserTools);
});

it('opens page', () => {
browserTools.getPageTitle().then(pageTitle => expect(pageTitle).toEqual('Promoter Platform'));
concertOperations
.assertPageIsOpened();
});

it('creates concert', function () {
element(By.id("menu-concerts-add")).click()
element(By.id("input-concert-title")).sendKeys("concert Title");
element(By.id("create-concert-submit")).click();
let successConfirmation = element(By.className("mat-simple-snackbar"));
browserTools.waitUntilIsVisible(successConfirmation)
.then(unused =>
expect(successConfirmation.isDisplayed()).toBeTruthy()
);
concertOperations
.openAddConcert()
.createConcert()
.assertCreateConcertSuccess()
});

it('lists stub concerts', () => {
element(By.id("menu-concerts-list")).click();

element.all(By.className('mat-row'))
.all(By.className('concert-title'))
.getText()
.then(value =>
expect(value).toEqual(['Rihanna in Rome', 'Rock concert 2'])
);
concertOperations
.openConcertsList()
.assertAllConcertsListed(['Rihanna in Rome', 'Rock concert 2'])
});


});


0 comments on commit 70809cd

Please sign in to comment.