Commit 533f89f5 authored by Jose Aurelio do Carmo Ribeiro's avatar Jose Aurelio do Carmo Ribeiro
Browse files

Versão inicial com Cucumber com fluxo principal até o gráfico

parent 70fe345c
// We know this is a duplicate of ./resolveStepDefinition.
// We will remove that one soon and leave only this one in a future version.
const {
Given,
When,
Then,
And,
But,
Before,
After,
defineParameterType,
defineStep,
} = require("./lib/resolveStepDefinition");
module.exports = {
Then,
And,
But,
Given,
When,
Before,
After,
defineParameterType,
defineStep,
};
\ No newline at end of file
{}
{
"viewportWidth": 1024,
"viewportHeight": 768,
"defaultCommandTimeout": 10000,
"baseUrl": "https://cwi.com.br/",
"ignoreTestFiles": ["*.js", "*.ts", "*.md"],
"testFiles": "**/*.feature"
}
\ No newline at end of file
Feature: Criar Simulacao
Scenario: Criar simulacao com SR3
Given Estou logado e acesso o modulo de gerenciamento de Simulacoes
When Seleciono um arquivo SR3 para modelo Reservatorio
And Seleciono um modelo Escoamento
And Adiciono todas as propriedades default
And Clico em Simular
Then O sistema retorna o grafico com a simulacao
\ No newline at end of file
# Automation priority: null
# Automation status: TRANSMITTED
# Test case importance: LOW
# language: pt
Funcionalidade: Criar Simulação
Scenario: Criar Simulação com Arquivo SR3
Given Estou logado e acesso o modulo de gerenciamento de Simulações
When Seleciono um arquivo SR3 para modelo Reservatório
And Seleciono um modelo Escoamento
And Adiciono todas as propriedades default
And Clico em Simular
Then O sistema retorna o gráfico com a simulação
\ No newline at end of file
Feature: Login site CWI
Scenario: Visualizar opção de recuperar senha esquecida
Given Estou logado e acesso o modulo de gerenciamento de Simulacoes
When Seleciono um arquivo SR3 para modelo Reservatorio
When acesso a pagina de login
Then devo visualizar botao de recuperar senha esquecida
\ No newline at end of file
import { Then } from "cypress-cucumber-preprocessor/steps";
Then(`I see {string} in the title`, (title) => {
cy.title().should('include', title)
})
\ No newline at end of file
/* global Given, Then, When, And */
//import { Given, When, Then, And } from "cypress-cucumber-preprocessor/steps";
/// <reference types="Cypress" />
const {
When,
Given,
Then,
And
} = require("cypress-cucumber-preprocessor/steps");
import LoginPage from 'C:/Users/leloe/OneDrive/Documentos/PPE2BDD/ppe2bdd/cypress/support/pageobjects/LoginPage'
Given("Estou logado e acesso o modulo de gerenciamento de Simulacoes", () => {
//loginPage.acessarSite();
cy.visit('http://ppe2srv.tecgraf.puc-rio.br/')
cy.get('.mat-selection-list > :nth-child(1) > .mat-list-item-content > .mat-list-text').click()
cy.get('.btn').click()
cy.wait(1000)
var element = cy.get(':nth-child(1) > .card_EE')
cy.get(':nth-child(1) > .card_EE > .card_buttons_container_EE').click()
cy.wait(2000)
})
When("Seleciono um arquivo SR3 para modelo Reservatorio", () => {
//loginPage.clicarBotaoPaginaLogin();
cy.get('.btn').click()
cy.get('.mat-select-arrow-wrapper').click();
cy.get('.mat-option-text').click();
cy.get('#cad_nome').type('Teste Automatizado')
cy.get('#descricao').type('Teste Automatizado')
var path = cy.get(':nth-child(3) > :nth-child(4) > .mat-form-field-has-label > .mat-form-field-wrapper > .mat-form-field-flex > .mat-form-field-infix > #cad_base')
path.clear()
path.type('Z:\\#EXEMPLOS\\ModelosReservatorio').type('{enter}')
cy.get('#mat-radio-1 > .mat-radio-label > .mat-radio-container > .mat-radio-inner-circle').click()
cy.get('.subcontainer-requisicao > .justify-content-center > :nth-child(3) > .btn').click()
cy.get('.header-ppe2 > .btn').click()
cy.wait(8000)
})
Then("O sistema retorna o grafico com a simulacao", () => {
//loginPage.visualizarBotaoRecuperarSenha();
cy.get('canvas').should('be.visible')
cy.url().should('include', 'grupo-simulacao/grafico').end()
})
And("Seleciono um modelo Escoamento", () => {
//loginPage.visualizarBotaoRecuperarSenha();
})
And("Adiciono todas as propriedades default", () => {
//loginPage.visualizarBotaoRecuperarSenha();
cy.get('#mat-checkbox-1 > .mat-checkbox-layout > .mat-checkbox-label').click()
cy.get('.header-ppe2 > .btn').click()
cy.wait(10000)
cy.get('.tabs-lateral > :nth-child(2)').click()
cy.get('.d-flex > .btn-primary').click();
cy.wait(1000)
})
And("Clico em Simular", () => {
//loginPage.visualizarBotaoRecuperarSenha();
cy.get('.header-ppe2 > .btn').click()
cy.wait(16000)
})
\ No newline at end of file
/* global Given, Then, When */
//import { Given, When, Then } from "cypress-cucumber-preprocessor/steps";
const {
When,
Given,
Then
} = require("cypress-cucumber-preprocessor/steps");
import LoginPage from 'C:/Users/leloe/OneDrive/Documentos/PPE2BDD/ppe2bdd/cypress/support/pageobjects/LoginPage'
const loginPage = new LoginPage
Given("acesso o site CWI", () => {
loginPage.acessarSite();
})
When("acesso a pagina de login", () => {
loginPage.clicarBotaoPaginaLogin();
})
Then("devo visualizar botao de recuperar senha esquecida", () => {
loginPage.visualizarBotaoRecuperarSenha();
})
\ No newline at end of file
/// <reference types="cypress" />
// ***********************************************************
// This example plugins/index.js can be used to load plugins
//
// You can change the location of this file or turn off loading
// the plugins file with the 'pluginsFile' configuration option.
//
// You can read more here:
// https://on.cypress.io/plugins-guide
// ***********************************************************
const cucumber = require("cypress-cucumber-preprocessor").default; // eslint-disable-line
// This function is called when a project is opened or re-opened (e.g. due to
// the project's config changing)
/**
* @type {Cypress.PluginConfig}
*/
module.exports = (on, config) => {
// `on` is used to hook into various events Cypress emits
// `config` is the resolved Cypress config
}
module.exports = (on) => {
on("file:preprocessor", cucumber());
};
\ No newline at end of file
class LoginElements {
botaoLogin = () => { return '.main-header-login-content .title' }
botaoRecuperarSenha = () => { return '.forgot' }
}
export default LoginElements;
\ No newline at end of file
/// <reference types="Cypress" />
import LoginElements from '../elements/LoginElements'
const loginElements = new LoginElements
const url = Cypress.config("baseUrl")
class LoginPage {
// Acessa o site que será testado
acessarSite() {
cy.visit(url)
}
// Clica no botão que acessa a página de login do site
clicarBotaoPaginaLogin() {
cy.get(loginElements.botaoLogin()).click()
}
// Verifica se o botão tem o texto "Esqueceu sua senha?"
visualizarBotaoRecuperarSenha() {
cy.get(loginElements.botaoRecuperarSenha()).should('contain', 'Esqueceu sua senha?')
}
}
export default LoginPage;
\ No newline at end of file
This diff is collapsed.
......@@ -5,7 +5,12 @@
"main": "index.js",
"scripts": {
"cypress:open": "cypress open",
"cypress:run": "cypress run"
"cypress:run": "cypress run",
"test:chrome": "cypress run --browser chrome --no-exit"
},
"cypress-cucumber-preprocessor": {
"step_definitions": "cypress/integration/steps",
"nonGlobalStepDefinitions": false
},
"repository": {
"type": "git",
......@@ -14,6 +19,35 @@
"author": "joseribeio@tecgraf.puc-rio.br",
"license": "ISC",
"dependencies": {
"cypress": "^6.4.0"
"@cypress/browserify-preprocessor": "^3.0.1",
"chai": "^4.2.0",
"chokidar": "2.1.8",
"cosmiconfig": "^4.0.0",
"cucumber": "^4.2.1",
"cucumber-expressions": "^6.0.1",
"cucumber-tag-expressions": "^1.1.1",
"debug": "^3.0.1",
"gherkin": "^5.1.0",
"glob": "^7.1.2",
"js-string-escape": "^1.0.1",
"minimist": "^1.2.5",
"through": "^2.3.8"
},
"devDependencies": {
"commitizen": "^4.2.1",
"cypress": "^5.1.0",
"cypress-cucumber-preprocessor": "^4.0.1",
"cz-conventional-changelog": "^3.3.0",
"eslint": "^7.9.0",
"eslint-config-airbnb-base": "^14.2.0",
"eslint-config-prettier": "6.12.0",
"eslint-plugin-cypress": "^2.11.1",
"eslint-plugin-import": "^2.22.0",
"eslint-plugin-prettier": "^3.1.4",
"husky": "^4.3.0",
"jest": "^26.4.2",
"lint-staged": "^10.3.0",
"prettier": "2.1.2",
"semantic-release": "^17.1.1"
}
}
// reexporting here for backward compability
const {
Given,
When,
Then,
And,
But,
defineParameterType,
} = require("./lib/resolveStepDefinition");
// eslint-disable-next-line no-console
console.warn(
"DEPRECATION WARNING! Please change your imports from cypress-cucumber-preprocessor/resolveStepDefinition to cypress-cucumber-preprocessor/steps"
);
module.exports = {
Given,
When,
Then,
And,
But,
defineParameterType,
};
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment