Skip to content
This repository has been archived by the owner on Mar 26, 2022. It is now read-only.

Commit

Permalink
Sample Login e2e test
Browse files Browse the repository at this point in the history
Use this as an example
  • Loading branch information
Migarve55 committed Feb 27, 2019
1 parent 1e4cf40 commit 3bd0a8a
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
2 changes: 1 addition & 1 deletion e2e/src/app.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AppPage } from './app.po';

describe('workspace-project App', () => {
describe('Basic app test', () => {
let page: AppPage;

beforeEach(() => {
Expand Down
17 changes: 17 additions & 0 deletions e2e/src/login.e2e-spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { LoginPage } from './login.po';

describe('workspace-project App', () => {
let page: LoginPage;

beforeEach(() => {
page = new LoginPage();
});

it('should display welcome message', () => {
page.navigateTo();
expect(page.getParagraphText()).toEqual('PROFILE DEMO APP');
});

//TODO: other tests

});
25 changes: 25 additions & 0 deletions e2e/src/login.po.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { browser, by, element } from 'protractor';

export class LoginPage {

navigateTo() {
return browser.get('/login');
}

getParagraphText() {
return element(by.css('app-root h1')).getText();
}

getLoginSelector() {
return element(by.css('logic-selector'));
}

getGoButton() {
return element(by.id('btn-go'));
}

getRegisterButton() {
return element(by.id('btn-register'));
}

}
4 changes: 2 additions & 2 deletions src/app/login/login.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,13 +43,13 @@ <h2>
placeholder="Enter WebID"
style="margin-top:10px; padding: 12px 10px; width: 340px; height: 16px; display: block; margin-left: auto; margin-right: auto;"
[(ngModel)]="customProviderUrl" />
<button class="wide-button" (click)="onLogin()" *ngIf="selectedProviderUrl !== undefined || customProviderUrl !== undefined" [disabled]="selectedProviderUrl===null && !customProviderUrl" style="margin-top:10px;">Go</button>
<button id="btn-go" class="wide-button" (click)="onLogin()" *ngIf="selectedProviderUrl !== undefined || customProviderUrl !== undefined" [disabled]="selectedProviderUrl===null && !customProviderUrl" style="margin-top:10px;">Go</button>
</div>

<!-- REGISTRATION -->
<div class="registration-link">
<p style="margin: 12px;">Don't have a Solid Identity?</p>
<button class="wide-button" (click)="goToRegistration()">Register</button>
<button id="btn-register" class="wide-button" (click)="goToRegistration()">Register</button>
</div>

<!-- HELP -->
Expand Down

0 comments on commit 3bd0a8a

Please sign in to comment.