Skip to content

Commit

Permalink
Merge pull request #23 from eluhr/feature/redirects-test
Browse files Browse the repository at this point in the history
Enhanced redirects test
  • Loading branch information
schmunk42 authored Sep 26, 2019
2 parents 7ead609 + ac09cf5 commit b61d272
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 48 deletions.
28 changes: 0 additions & 28 deletions tests/codeception/e2e/extensions/RedirectsBackendCept.php

This file was deleted.

75 changes: 75 additions & 0 deletions tests/codeception/e2e/extensions/RedirectsCest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?php

namespace extensions;


use E2eTester;

/**
* @package extensions
* @author Elias Luhr <[email protected]>
*
* @group mandatory
*/
class RedirectsCest
{

private $_test_redirect;

public function _before(E2eTester $I)
{
if (empty($this->_test_redirect)) {
$this->_test_redirect = dechex(time());
}
}

/**
* @param E2eTester $I
*
* @throws \Exception
*/
public function backend(E2eTester $I)
{
$I->wantTo("ensure that 'redirects' module works");

$I->amGoingTo('try to login with correct credentials');
$I->login('master', 'master1');

$I->amOnPage('/redirects');
$I->click('New');

$I->waitForElementVisible('.redirect-form', 10);
$I->selectOption('Redirect[type]', 'Path redirect');
$I->fillField('Redirect[from_path]', '/' . $this->_test_redirect);
$I->fillField('Redirect[to_path]', '/site/index');
$I->selectOption('#redirect-status_code input', 301);
$I->click('Create');

$I->waitForElementNotVisible('.redirect-form');
$I->see($this->_test_redirect, 'table');

$I->makeScreenshot('redirect-create');

}

/**
* @param E2eTester $I
*
* @throws \Exception
*/
public function frontend(E2eTester $I)
{
$I->wantTo("ensure that 'redirects' module works");

$I->amGoingTo('try to login with correct credentials');

$I->login('preview', 'preview1');
$I->amGoingTo('test the redirect');
$I->amOnPage('/' . $this->_test_redirect);
$I->seeInCurrentUrl('/site/index');
$I->waitForElementVisible('.site-index');

$I->makeScreenshot('after-redirect');

}
}
20 changes: 0 additions & 20 deletions tests/codeception/e2e/extensions/RedirectsFrontendCept.php

This file was deleted.

0 comments on commit b61d272

Please sign in to comment.