Skip to content

Commit

Permalink
adicao de dependencias
Browse files Browse the repository at this point in the history
  • Loading branch information
pauloborba committed Sep 30, 2017
1 parent 5c594af commit 08c6d4f
Show file tree
Hide file tree
Showing 9 changed files with 137 additions and 9 deletions.
12 changes: 6 additions & 6 deletions gui/ta-gui/src/app/alunos.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,19 @@
<table>
<tr>
<td><label>Nome </label></td>
<td><input [(ngModel)]="aluno.nome" ></td>
<td><input [(ngModel)]="aluno.nome" name="namebox"></td>
<td><button (click)="criarAluno(aluno)">Adicionar</button></td>
</tr>
<tr>
<td><label>CPF </label></td>
<td><input [(ngModel)]="aluno.cpf" ></td>
<td><input [(ngModel)]="aluno.cpf" name="cpfbox"></td>
<td *ngIf="cpfduplicado">
Já existe um aluno com esse CPF
</td>
</tr>
<tr>
<td><label>e-mail </label></td>
<td><input [(ngModel)]="aluno.email" ></td>
<td><input [(ngModel)]="aluno.email"></td>
</tr>
</table>

Expand All @@ -25,9 +25,9 @@
<th>CPF</th>
<th>e-mail</th>
</tr>
<tr *ngFor="let a of alunos">
<td>{{a.nome}}</td>
<td>{{a.cpf}}</td>
<tr *ngFor="let a of alunos" name="alunolist">
<td name="nomelist">{{a.nome}}</td>
<td name="cpflist">{{a.cpf}}</td>
<td>{{a.email}}</td>
</tr>
</table>
Expand Down
2 changes: 1 addition & 1 deletion gui/ta-gui/src/app/app.component.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ <h1>
</h1>

<nav>
<a routerLink="/alunos">Alunos</a>
<a name ="alunos" routerLink="/alunos">Alunos</a>
<a routerLink="/metas">Metas</a>
</nav>

Expand Down
5 changes: 4 additions & 1 deletion server/ta-server/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@
"author": "Paulo Borba",
"license": "MIT",
"dependencies": {
"express": "^4.15.4"
"express": "^4.15.4",
"body-parser": "^1.18.2",
"@types/body-parser": "^1.16.5",
"@types/express": "^4.0.37",
},
"devDependencies": {}
}
1 change: 0 additions & 1 deletion server/ta-server/ta-server.js

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

32 changes: 32 additions & 0 deletions tests-acceptance/config/config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { browser, Config } from 'protractor';

export let config: Config = {

seleniumAddress: 'http://127.0.0.1:4444/wd/hub',

SELENIUM_PROMISE_MANAGER: false,

capabilities: {
browserName: 'chrome'
},

framework: 'custom',
frameworkPath: require.resolve('protractor-cucumber-framework'),

specs: [
'../../features/*.feature'
],

onPrepare: () => {

browser.ignoreSynchronization = true;
browser.manage().window().maximize();

},
cucumberOpts: {
compiler: "ts:ts-node/register",
strict: true,
format: ['pretty'],
require: ['../../stepdefinitions/*.ts'],
}
};
9 changes: 9 additions & 0 deletions tests-acceptance/features/alunos.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Feature: As a professor
I want to register students
So that I can manage their learning goals

Scenario: Registering student with non registered CPF
Given I am at the students page
Given I cannot see a student with CPF "683" in the students list
When I try to register the student "Paulo" with CPF "683"
Then I can see "Paulo" with CPF "683" in the students list
27 changes: 27 additions & 0 deletions tests-acceptance/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"name": "testes-acceptance",
"description": "Testes de aceitação do teaching assistant",
"scripts": {
"tsc": "tsc",
"test": "protractor typeScript/config/config.js",
"webdriver-update": "webdriver-manager update",
"webdriver-start": "webdriver-manager start"
},
"author": "Paulo Borba",
"devDependencies": {
"@types/cucumber": "0.0.38",
"@types/node": "^8.0.31",
"@types/selenium-webdriver": "^3.0.0",
"chai": "^4.0.2",
"chai-as-promised": "^7.0.0",
"cucumber": "^2.3.0",
"mkdirp": "^0.5.1",
"protractor-cucumber-framework": "^3.1.1"
},
"dependencies": {
"cucumber-html-reporter": "^2.0.0",
"protractor": "^5.1.2",
"ts-node": "^3.1.0",
"typescript": "^2.2.1"
}
}
40 changes: 40 additions & 0 deletions tests-acceptance/stepdefinitions/alunos.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { defineSupportCode } from 'cucumber';
import { browser, $, element, ElementArrayFinder, by } from 'protractor';
let chai = require('chai').use(require('chai-as-promised'));
let expect = chai.expect;

let sleep = (ms => new Promise(resolve => setTimeout(resolve, ms)));

let sameCPF = ((elem, cpf) => elem.element(by.name('cpflist')).getText().then(text => text === cpf));
let sameName = ((elem, name) => elem.element(by.name('nomelist')).getText().then(text => text === name));

defineSupportCode(function ({ Given, When, Then }) {

Given(/^I am at the students page$/, async () => {
await browser.get("http://localhost:4200/");
await expect(browser.getTitle()).to.eventually.equal('TaGui');
await $("a[name='alunos']").click();
})

Given(/^I cannot see a student with CPF "(.*?)" in the students list$/, async (cpf) => {
var allcpfs : ElementArrayFinder = element.all(by.name('cpflist'));
var samecpfs = allcpfs.filter(elem =>
elem.getText().then(text => text === cpf));
await samecpfs;
await samecpfs.then(elems => expect(Promise.resolve(elems.length)).to.eventually.equal(0));
});

When(/^I try to register the student "(.*?)" with CPF "(.*?)"$/, async (name, cpf) => {
await $("input[name='namebox']").sendKeys(<string> name);
await $("input[name='cpfbox']").sendKeys(<string> cpf);
await element(by.buttonText('Adicionar')).click();
});

Then(/^I can see "(.*?)" with CPF "(.*?)" in the students list$/, async (name, cpf) => {
var allalunos : ElementArrayFinder = element.all(by.name('alunolist'));
var samenamecpf = allalunos.filter(elem => sameCPF(elem,cpf) && sameName(elem,name));
await samenamecpf;
await samenamecpf.then(elems => expect(Promise.resolve(elems.length)).to.eventually.equal(1));
});

})
18 changes: 18 additions & 0 deletions tests-acceptance/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"compilerOptions": {
"module": "commonjs",
"target": "es6",
"moduleResolution": "node",
"sourceMap": false,
"declaration": false,
"removeComments": false,
"noImplicitAny": false,
"outDir": "typeScript",
"typeRoots": [ "./node_modules/@types" ],
"types": ["node","cucumber"]
},
"exclude": [
"node_modules",
"typescript"
]
}

0 comments on commit 08c6d4f

Please sign in to comment.