Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tests/add classrom #520

Open
wants to merge 8 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- Adiciona coluna alias na tabela edcenso_stage_vs_modality
ALTER TABLE edcenso_stage_vs_modality ADD alias varchar2(15);
ALTER TABLE edcenso_stage_vs_modality ADD alias varchar(15);

UPDATE `edcenso_stage_vs_modality`
set alias = SUBSTRING(trim(SUBSTRING_INDEX(SUBSTRING_INDEX(name , '-', -1), '-', -1)), 1, 20)
1 change: 1 addition & 0 deletions tests/_support/AcceptanceTester.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ class AcceptanceTester extends \Codeception\Actor
{
use _generated\AcceptanceTesterActions;


/**
* Define custom actions here
*/
Expand Down
4 changes: 2 additions & 2 deletions tests/acceptance.suite.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
# If you need both WebDriver and PHPBrowser tests - create a separate suite.

actor: AcceptanceTester
bootstrap: bootstrap.php
modules:
enabled:
- WebDriver:
Expand All @@ -13,5 +14,4 @@ modules:
window_size: 1280x960
capabilities:
chromeOptions:
args: ["--disable-gpu"]

args: ["--disable-gpu", "--headless"]
10 changes: 4 additions & 6 deletions tests/acceptance/ChangePasswordCest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?php

require_once __DIR__."/../robots/LoginRobots.php";

class ChangePasswordCest
{

public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
}
Expand Down
82 changes: 69 additions & 13 deletions tests/acceptance/ClassroomCest.php
Original file line number Diff line number Diff line change
@@ -1,22 +1,18 @@
<?php

require_once 'vendor/autoload.php';
require_once __DIR__ . "/../robots/LoginRobots.php";
require_once __DIR__ . "/../robots/ClassroomRobots.php";
require_once __DIR__ . "/../builders/ClassroomBuilder.php";
require_once __DIR__ . "/../acceptance/MatrixCest.php";
require_once __DIR__ . "\\MatrixCest.php";

class ClassroomCest
{
public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
}
Expand Down Expand Up @@ -70,6 +66,8 @@ public function addClassroomEAD(AcceptanceTester $teste)

$teste->see('Turma adicionada com sucesso!');
$teste->canSeeInCurrentUrl('?r=classroom/index');

return $dataClassroom;
}

/**
Expand Down Expand Up @@ -99,6 +97,8 @@ public function addClassroomInPerson(AcceptanceTester $teste)

$teste->see('Turma adicionada com sucesso!');
$teste->canSeeInCurrentUrl('?r=classroom/index');

return $dataClassroom;
}

/**
Expand Down Expand Up @@ -137,16 +137,72 @@ public function allFieldsAddClassroomEAD(AcceptanceTester $teste)
sleep(2);
$robots->btnInstructor();
sleep(2);
// $robots->instructorsToClassroom();
// $robots->role();
// $robots->contractType();
// $robots->createNewComponent();
$robots->instructorsToClassroom($dataClassroom['Instructors']);
$robots->disciplines($addMatrix['disciplines']);
$robots->role($dataClassroom['Role']);
$robots->contractType($dataClassroom['ContractType']);
$robots->createNewComponent();
sleep(2);

$robots->btnCriar();
sleep(2);

$teste->see('Turma adicionada com sucesso!');
$teste->canSeeInCurrentUrl('?r=classroom/index');

return $dataClassroom;
}

/**
* Adicionar turma, preenchendo todos os campos.
* Tipo de Mediação Didático-Pedagógica - Presencial
*/
public function allFieldsAddInPerson(AcceptanceTester $teste)
{
sleep(5);
$matrix = new MatrixCest();
$addMatrix = $matrix->addMatrix($teste);

$robots = new ClassroomRobots($teste);
$robots->pageAddClassroom();

$builder = new ClassroomBuilder();
$dataClassroom = $builder->buildCompleted();

// Classroom
$robots->name($dataClassroom['name']);
$robots->stageVsModalaty($addMatrix['stages']);
$robots->typeMediation($dataClassroom['pedagogical_mediation_type_IN_PERSON']);
$robots->modality($dataClassroom['modality']);
$robots->location($dataClassroom['diff_location']);
$robots->educationCourse($dataClassroom['edcenso_professional_education_course_fk']);
$robots->initialTime($dataClassroom['initial_time']);
$robots->finalTime($dataClassroom['final_time']);
$robots->turn($dataClassroom['turn']);
$robots->days();
$robots->typeServiceActivitiesComplementary();
sleep(2);
$robots->activitiesComplementary($dataClassroom['complementary_activity_type_1']);
$robots->activitiesEducation($dataClassroom['aee_braille']);
$robots->btn2Instructors();

// Instructors
sleep(2);
$robots->btnInstructor();
sleep(2);
$robots->instructorsToClassroom($dataClassroom['Instructors']);
$robots->disciplines($addMatrix['disciplines']);
$robots->role($dataClassroom['Role']);
$robots->contractType($dataClassroom['ContractType']);
$robots->createNewComponent();
sleep(2);

$robots->btnCriar();
sleep(2);

$teste->see('Turma adicionada com sucesso!');
$teste->canSeeInCurrentUrl('?r=classroom/index');

return $dataClassroom;
}
}
25 changes: 13 additions & 12 deletions tests/acceptance/ClassroomRemoveCest.php
Original file line number Diff line number Diff line change
@@ -1,20 +1,18 @@
<?php
require_once 'vendor/autoload.php';
require_once __DIR__."/../robots/LoginRobots.php";
require_once __DIR__.'/../robots/ClassroomRobots.php';
require_once __DIR__.'/../builders/ClassroomBuilder.php.php';

require_once __DIR__ . "/../acceptance/ClassroomCest.php";

class ClassroomRemoveCest
{
public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
}
Expand All @@ -23,17 +21,20 @@ public function _before(AcceptanceTester $tester)
public function sucess(AcceptanceTester $teste)
{
sleep(5);
$classroom = new StudentsCest();
$addclassroom = $classroom->addStudentsRapidFieldsRequired($teste);
$classroom = new ClassroomCest();
$addclassroom = $classroom->addClassroomInPerson($teste);
$robots = new ClassroomRobots($teste);
$robots->pageClassroom();

$search = $addclassroom->classroom['name'];
$search = $addclassroom['name'];

$robots->search($search);
sleep(2);
$robots->btnDelete();
$teste->acceptPopup();
$teste->canSeeInCurrentUrl('?r=classroom/index');
}

/**
* Verificar caso de não conseguir excluir a turma.
*/
}
12 changes: 4 additions & 8 deletions tests/acceptance/ExitCest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<?php

require_once __DIR__."/../robots/LoginRobots.php";

class ExitCest
{

public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
}
Expand All @@ -26,5 +23,4 @@ public function exitPage(AcceptanceTester $teste)
sleep(5);
$teste->canSeeInCurrentUrl('site/login');
}

}
11 changes: 4 additions & 7 deletions tests/acceptance/LoginCest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,17 @@
<?php

require_once __DIR__."/../robots/LoginRobots.php";

class LoginCest
{
// tests
public function frontpageWorks(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
$tester->see('Bem vindo ao');
Expand Down Expand Up @@ -46,5 +44,4 @@ public function errorPassword(AcceptanceTester $tester)
sleep(5);
$tester->see('Usuário ou senha incorretos');
}

}
22 changes: 8 additions & 14 deletions tests/acceptance/ManageStagesCest.php
Original file line number Diff line number Diff line change
@@ -1,23 +1,18 @@
<?php

require_once 'vendor/autoload.php';
require_once __DIR__."/../robots/LoginRobots.php";
require_once __DIR__.'/../robots/ManageStagesRobots.php';
require_once __DIR__.'/../builders/ManageStagesBuilder.php';

class ManageStagesCest
{
public function _before(AcceptanceTester $teste)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($teste);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(3);
sleep(2);
}

// tests
Expand All @@ -28,7 +23,7 @@ public function addStageRequired(AcceptanceTester $teste)
$builder = new ManageStagesBuilder();
$targetUrl = '?r=stages/default/index';

$stage= $builder->buildCompleted();
$stage = $builder->buildCompleted();

//stages
$robots->name($stage['name']);
Expand All @@ -47,7 +42,7 @@ public function addStageFilledIn(AcceptanceTester $teste)
$builder = new ManageStagesBuilder();
$targetUrl = '?r=stages/default/index';

$stage= $builder->buildCompleted();
$stage = $builder->buildCompleted();

//stages
$robots->name($stage['name']);
Expand Down Expand Up @@ -85,7 +80,7 @@ public function updateStage(AcceptanceTester $teste)

$robots->btnCriar();

$robots->checkUpdate($newStage['name'],$newStage['stage'],$newStage['alias']);
$robots->checkUpdate($newStage['name'], $newStage['stage'], $newStage['alias']);

$teste->canSeeInCurrentUrl($targetUrl);
}
Expand Down Expand Up @@ -113,5 +108,4 @@ public function deleteStage(AcceptanceTester $teste)
$teste->see('Aluno excluído com sucesso!');
$teste->canSeeInCurrentUrl($targetUrl);
}

}
13 changes: 5 additions & 8 deletions tests/acceptance/MatrixCest.php
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
<?php
require_once 'vendor/autoload.php';
require_once __DIR__ . '/../robots/LoginRobots.php';
require_once __DIR__ . '/../robots/MatrixRobots.php';
require_once __DIR__ . '/../builders/MatrixBuilder.php';

class MatrixCest
{
public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$robots = new LoginRobots($tester);
$robots->pageLogin();
$robots->fieldUser($user);
$robots->fieldPassword($secret);
$robots->fieldUser($login['user']);
$robots->fieldPassword($login['secret']);
$robots->submit();
sleep(2);
}
Expand Down
Loading
Loading