-
-
Save bernadetealves/58d0a3600abcdc2ee54cbf2c94a9eae8 to your computer and use it in GitHub Desktop.
Código da página - Page
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
'use strict'; | |
class Usuario { | |
constructor() { | |
this.nome = () => element(by.name("name")); | |
this.email = () => element(by.name("email")); | |
this.empresa = () => element(by.name("company")); | |
this.cpf = () => element(by.name("cpf")); | |
this.telefone = () => browser.findElement(by.name("phone")); | |
this.login = () => browser.findElement(by.name("login")); | |
this.senha = () => browser.findElement(by.name("password")); | |
this.confirmacaoSenha = () => browser.findElement(by.name("password-confirm")); | |
this.perfilUsuario = () => element(by.className('.form-control')).$('[value="10"]'); | |
this.grupoAcesso = () => element(by.name('accessgroup')).$('[value="5994c17e25a04d3c2417b81a"]'); | |
this.botaoVoltar = () => element(by.css(".bottom-buttons .btn-lightbrown")); | |
this.botaoAtualizar = () => element(by.css(".bottom-buttons .btn-orange [type=submit]")); | |
} | |
criarUsuario(nome, email) { | |
this.nome().sendKeys(nome); | |
this.email().sendKeys(email); | |
this.empresa().sendKeys(empresa); | |
this.cpf().sendKeys(cpf); | |
this.telefone().sendKeys(telefone); | |
this.login().sendKeys(login); | |
this.senha().sendKeys(senha); | |
this.confirmacaoSenha().sendKeys(confirmacaoSenha); | |
this.perfilUsuario().click(); | |
this.grupoAcesso().click(); | |
this.botaoAtualizar().click(); | |
} | |
visit() { | |
browser.get("/users/new"); | |
} | |
} | |
module.exports = Usuario; |
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
let chai = require('chai'); | |
let chaiAsPromised = require('chai-as-promised'); | |
let expect = chai.expect; | |
let assert = chai.assert; | |
let faker = require('faker'); | |
let CPF = require("cpf_cnpj").CPF; | |
chai.should(); | |
chai.use(chaiAsPromised); | |
'use strict'; | |
const Login = require('../page-objects/login.po.js'); | |
const Dashboard = require('../page-objects/dashboard.po.js'); | |
const Usuario = require('../page-objects/criarUsuario.po.js'); | |
const { | |
error | |
} = require('../../../helpers/appMessages'); | |
describe("Cadastro de Usuário", () => { | |
const login = new Login(); | |
const dashboard = new Dashboard(); | |
const usuario = new Usuario(); | |
beforeEach('Entrar no site', () => { | |
login.visit(); | |
}); | |
it('/Criar Usuário', () => { | |
login.fazerLogin("admin", "mpoadmin"); | |
let perfil = dashboard.perfil(); | |
expect(perfil.getText()).to.eventually.equal('Administrador'); | |
dashboard.linkMenuCriarUsuario().click(); | |
let logoNovoUsuario = dashboard.logoCriarUsuario(); | |
expect(logoNovoUsuario.getText()).to.eventually.equal('Criar usuário'); | |
usuario.criarUsuario("maria", "maria@hotmail.com", "Company", "53342049626", "1123654789", "mariapia", "mariapia123", "mariapia123"); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment