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/class plan #542

Draft
wants to merge 31 commits into
base: dev
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
1165db7
tests/correction methods, implementing tests class
evellynreis Nov 8, 2023
d8004d2
Merge branch 'tests/add-classrom' of https://github.com/ipti/br.tag i…
evellynreis Nov 8, 2023
b85b7e3
tests/implementing remove classroom
evellynreis Nov 8, 2023
83ade18
Merge branch 'dev' into tests/add-classrom
evellynreis Nov 8, 2023
e772430
tests/ finalization tests in add classroom
evellynreis Nov 9, 2023
7f86096
tests/correction tests manage stage
evellynreis Nov 9, 2023
cc7b4d9
tests/ correction sonar lint, problem segurity
evellynreis Nov 10, 2023
ac85db2
Merge branch 'dev' into tests/edit-classroom
evellynreis Nov 10, 2023
dce54ab
tests/ implementing case tests edit classroom
evellynreis Nov 13, 2023
de69179
tests/ add case tests editClassroomInPerson
evellynreis Nov 13, 2023
4e32c32
Merge branch 'dev' into tests/edit-classroom
evellynreis Nov 13, 2023
b182923
tests/ correction according to sonarlint
evellynreis Nov 13, 2023
2ebfa43
tests/improvements
evellynreis Nov 13, 2023
b6f747e
tests/ initialization tests for create class plan
evellynreis Nov 14, 2023
8cfc2cc
tests/ implementing case tests for class plan, in the scenario too im…
evellynreis Nov 17, 2023
de32d73
tests/ convert password after the test
evellynreis Nov 21, 2023
d589c54
tests/ implementing tests calendar
evellynreis Nov 21, 2023
edbecda
Merge branch 'dev' into tests/class-plan
evellynreis Nov 21, 2023
d912517
tests/ implementing calendar
evellynreis Nov 22, 2023
85d51f0
Merge branch 'tests/class-plan' of https://github.com/ipti/br.tag int…
evellynreis Nov 22, 2023
814c29c
Merge branch 'dev' into tests/class-plan
evellynreis Nov 22, 2023
16f4201
tests/ add config db of clear and add dump testdb
evellynreis Nov 24, 2023
4834e8d
tests/ update dump, and implementing tests cest
evellynreis Nov 27, 2023
dba5742
Merge branch 'dev' into tests/class-plan
evellynreis Nov 27, 2023
37c8d42
tests/update teste->see in class tests
evellynreis Nov 27, 2023
46ce11a
tests/finish tests classplan
evellynreis Nov 28, 2023
c86ff6f
tests/edit sleep class plan
evellynreis Nov 30, 2023
1864774
tests/ correction tag utils, instance localhost
evellynreis Nov 30, 2023
5ea5fb5
tests/sonar lint add .github/workflows/sonarcloud-analysis.yml of exc…
evellynreis Dec 1, 2023
9592000
tests/correction exclusion
evellynreis Dec 1, 2023
5b7104f
tests/ correction return of method title calendar
evellynreis Dec 1, 2023
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
2 changes: 2 additions & 0 deletions .github/workflows/sonarcloud-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@ jobs:
-Dsonar.organization=ipti
-Dsonar.scm.provider=git
-Dsonar.exclusions=themes/default/js/amcharts/**
-Dsonar.exclusions=tests/_data/dump-tag.sql
-Dsonar.cpd.exclusions=themes/default/js/amcharts/**
-Dsonar.cpd.exclusions=tests/_data/dump-tag.sql
# Comma-separated paths to directories containing main source files.
#-Dsonar.sources= # optional, default is project base directory
# When you need the analysis to take place in a directory other than the one from which it was launched
Expand Down
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)
4,765 changes: 4,765 additions & 0 deletions tests/_data/dump-tag.sql

Large diffs are not rendered by default.

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
12 changes: 10 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,12 @@ modules:
window_size: 1280x960
capabilities:
chromeOptions:
args: ["--disable-gpu"]

args: ["--disable-gpu", "--headless"]
- Db:
dsn: 'mysql:host=localhost;dbname=demo.tag.ong.br;charset=utf8mb4;user=root;password=root'
user: 'root'
password: 'root'
dump: 'tests/_data/dump-tag.sql'
populate: true
cleanup: true
populator: false
62 changes: 62 additions & 0 deletions tests/acceptance/CalendarCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
<?php
require_once __DIR__ . '\\ClassroomCest.php';
class CalendarCest
{
public function _before(AcceptanceTester $tester)
{
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

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

// tests

/**
* Adicionar calendário contemplando a etapa da turma selecionada.
* Preencher inicio e fim de ano letivo.
* @author Evellyn Jade de Cerqueira Reis- <ti.jade@ipti.org.br>
*/
public function addCalendarVinculadClass(AcceptanceTester $teste)
{
$builder = new CalendarBuilder();
$dataBuilder = $builder->buildCompleted();

$robots = new CalendarRobots($teste);
$robots->pageCalendar();
sleep(2);
$robots->btnNewCalendar();
sleep(2);
$robots->title($dataBuilder['title']);
$robots->stage($dataBuilder['stage_in_classroom']);
$robots->btnSave();
sleep(4);

//Preencher inicio do ano letivo.
$robots->searchTitleCalendar($dataBuilder['title']);
sleep(2);
$robots->clickStartYearSchooling();
sleep(2);
$robots->event($dataBuilder['event_start_name']);
$robots->typeEvent($dataBuilder['event_start']);
$robots->btnSaveEvent();
sleep(2);
$robots->confirmSave();
sleep(4);

//Preencher final do ano letivo.
$robots->clickEndYearSchooling();
sleep(2);
$robots->event($dataBuilder['event_end_name']);
$robots->typeEvent($dataBuilder['event_end']);
$robots->btnSaveEvent();
sleep(4);
$robots->confirmSave();
sleep(4);
}
}
54 changes: 40 additions & 14 deletions tests/acceptance/ChangePasswordCest.php
Original file line number Diff line number Diff line change
@@ -1,35 +1,61 @@
<?php

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

class ChangePasswordCest
{

public function _before(AcceptanceTester $tester)
{
$user = "admin";
$secret = "p@s4ipti";
$this->startTransaction($tester);

$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);
}

// tests
public function sucess(AcceptanceTester $teste)
public function _after(AcceptanceTester $tester)
{
$teste->amOnPage('?r=admin/editPassword&id=1');
$this->rollbackTransaction($tester);
}

// Teste
public function success(AcceptanceTester $tester)
{
$tester->amOnPage('?r=admin/editPassword&id=1');

$newSecret = "novaSenha@2023";

$teste->fillField("#Users_password", $newSecret);
$teste->fillField("#Confirm", $newSecret);
$tester->fillField("#Users_password", $newSecret);
$tester->fillField("#Confirm", $newSecret);

$tester->click("#save button");
sleep(5);
$tester->canSeeInCurrentUrl('admin/index');
}

private function startTransaction(AcceptanceTester $tester)
{
$tester->comment("Iniciando transação...");
}

private function rollbackTransaction(AcceptanceTester $tester)
{
$tester->comment("Revertendo transação...");

$tester->amOnPage('?r=admin/editPassword&id=1');

$builder = new LoginBuilder();
$login = $builder->buildCompleted();

$tester->fillField("#Users_password", $login['secret']);
$tester->fillField("#Confirm", $login['secret']);

$teste->click("#save button");
$tester->click("#save button");
sleep(5);
$teste->canSeeInCurrentUrl('admin/index');
$tester->canSeeInCurrentUrl('admin/index');
}
}
37 changes: 37 additions & 0 deletions tests/acceptance/ClassContentsCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php

require_once __DIR__ . '\\ClassroomCest.php';
class ClassContentsCest
{
public function _before(AcceptanceTester $tester)
{
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

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

// tests
public function register(AcceptanceTester $teste)
{
$builder = new ClassContentsBuilder();
$dataClassContents = $builder->buildCompleted();

$robots = new ClassContentsRobots($teste);
$robots->page();
sleep(5);
$robots->classroom($dataClassContents['classroom']);
sleep(2);
$robots->month($dataClassContents['month']);
sleep(2);
$robots->btnSave();
sleep(2);

$robots->updateSucess();
}
}
45 changes: 45 additions & 0 deletions tests/acceptance/ClassPlanCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php

require_once __DIR__ . '\\MatrixCest.php';
class ClassPlanCest
{
public function _before(AcceptanceTester $tester)
{
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

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

// tests
public function createPlan(AcceptanceTester $teste)
{
sleep(5);
$matrix = new MatrixCest();
$addMatrix = $matrix->addMatrix($teste);

sleep(5);
$builder = new ClassPlanBuilder();
$classPlan = $builder->buildCompleted();
$robots = new ClassPlanRobots($teste);
$robots->pageCreate();

$robots->name($classPlan['name']);
$robots->stage($addMatrix['stages']);
sleep(5);
$robots->component($addMatrix['disciplines']);

$robots->btn2Class();
$robots->btnSave();
sleep(5);

$robots->saveSucess();

return $classPlan;
}
}
44 changes: 44 additions & 0 deletions tests/acceptance/ClassPlanEditCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
<?php
require_once __DIR__ . '\\ClassPlanCest.php';
class ClassPlanEditCest
{
public function _before(AcceptanceTester $tester)
{
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

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

// tests
public function edit(AcceptanceTester $teste)
{
$addClassPlan = new ClassPlanCest();
$dataClassPlan = $addClassPlan->createPlan($teste);
sleep(5);

$builder = new ClassPlanBuilder();
$classPlan = $builder->buildCompleted();
$robots = new ClassPlanRobots($teste);
$robots->pageClassPlan();

$search = $dataClassPlan['name'];

$robots->search($search);
sleep(5);
$robots->classPlan($search);

$robots->name($classPlan['name']);

$robots->btn2Class();
$robots->btnSave();
sleep(5);

$robots->saveSucess();
}
}
56 changes: 56 additions & 0 deletions tests/acceptance/ClassPlanRemoveCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?php

require_once __DIR__ . '\\ClassPlanCest.php';

class ClassPlanRemoveCest
{
public function _before(AcceptanceTester $tester)
{
$builder = new LoginBuilder();
$login = $builder->buildCompleted();

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

// tests
public function sucess(AcceptanceTester $teste)
{
$create = new ClassPlanCest();
$classPlan = $create->createPlan($teste);

$robots = new ClassPlanRobots($teste);
$robots->pageClassPlan();

$search = $classPlan['name'];
$robots->search($search);
sleep(2);
$robots->btnRemove();
$teste->acceptPopup();
sleep(5);

$robots->removeSucess();
}

public function error(AcceptanceTester $teste)
{
$builder = new ClassPlanBuilder();
$dataBuilder = $builder->buildCompleted();

$robots = new ClassPlanRobots($teste);
$robots->pageClassPlan();

$search = $dataBuilder['search_remove'];
$robots->search($search);
sleep(2);
$robots->btnRemove();
$teste->acceptPopup();
sleep(2);

$robots->removeErro();
}
}
Loading
Loading