Last active
August 29, 2015 13:56
-
-
Save alanwillms/9209427 to your computer and use it in GitHub Desktop.
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
<?php | |
use tests\CustomWebGuy; | |
$I = new CustomWebGuy($scenario); | |
$I->amOnPage('/'); | |
$I->wantTo('ensure that discussions works'); | |
Phactory::subject(['name' => 'Off-topic']); | |
// Empty list | |
$I->expectTo('see the empty list of discussions'); | |
$I->click('Fórum'); | |
$I->dontSee('Nova discussão'); | |
// Create | |
$I->expectTo('create a new discussion'); | |
$I->amSignedInAs('registered'); | |
$I->click('Fórum'); | |
$I->click('Nova discussão'); | |
$I->dontSee('Fechada?'); | |
$I->fillField('Título', 'Chicken or egg?'); | |
$I->selectOption('Assunto', 'Off-topic'); | |
$I->fillField('Comentário', 'What was born first, the chicken or the egg?'); | |
$I->click('Cadastrar'); | |
$I->wait(1000); | |
$I->seeInHeader('Chicken or egg?'); | |
$I->see('What was born first, the chicken or the egg?'); | |
// Read as guest | |
$I->expectTo('see my new discussion as guest'); | |
$I->amNotSignedIn(); | |
$I->click('Fórum'); | |
$I->see('Chicken or egg?'); | |
// Only admins can update/delete | |
$I->expectTo('not be able to edit or delete a discussion'); | |
$I->amSignedInAs('registered'); | |
$I->click('Fórum'); | |
$I->click('Chicken or egg?'); | |
$I->dontSee('Atualizar discussão'); | |
$I->dontSee('Excluir discussão'); | |
// Admin can update | |
$I->expectTo('be able to edit a discussion as owner'); | |
$I->amNotSignedIn(); | |
$I->amSignedInAs('owner'); | |
$I->click('Fórum'); | |
$I->click('Chicken or egg?'); | |
$I->click('Atualizar discussão'); | |
$I->checkOption('Fechada?'); | |
$I->fillField('Título', 'Chicken or huevos?'); | |
$I->click('Salvar'); | |
$I->wait(1000); | |
$I->dontSee('Chicken or egg?'); | |
$I->see('Chicken or huevos?'); | |
$I->see('Discussão encerrada pelo administrador.'); | |
// Admin can delete | |
$I->expectTo('be able to delete a discussion as owner'); | |
$I->amSignedInAs('owner'); | |
$I->click('Fórum'); | |
$I->click('Chicken or huevos?'); | |
$I->click('Excluir discussão'); | |
$I->acceptPopup(); | |
$I->wait(1000); | |
$I->click('Fórum'); | |
$I->dontSee('Chicken or egg?'); | |
$I->dontSee('Chicken or huevos?'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment