forked from pauloborba/teachingassistant
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5c594af
commit 08c6d4f
Showing
9 changed files
with
137 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'], | ||
} | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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)); | ||
}); | ||
|
||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" | ||
] | ||
} |