<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('perform actions and see result');
$I->amOnUrl('http://localhost/~hab/test/web/app_dev.php/');
$I->see('Hello World!');
//$I->fillField('username','hamza');
//$I->click('submit');
//$I->makeScreenshot($scenario->current('name').'_screenshot.png');
//$I->seeCurrentUrlEquals('/~hab/test/web/app_dev.php/testform');
//$I->seeInCurrentUrl('/testform');
示例#2
0
<?php

/**
 * @var Codeception\Scenario $scenario
 */
$I = new AcceptanceTester($scenario);
$I->wantTo('make sure that every page in the sitemap');
$I->sendGET('/sitemap');
$I->seeResponseIsXml();
$urls = $I->parseSitemap($I->grabResponse());
foreach ($urls as $url) {
    $I->amOnUrl($url);
    $I->seeResponseCodeIs(200);
}
示例#3
0
$I->see('Dashboard - Code School', 'title');
$I->wantTo('get codeschool courses page');
$I->amOnPage('paths');
$I->wantTo('get database course detail');
$I->amOnPage('paths/database');
//$aLinkText[] = $I->grabMultiple('a','.course-title-link');
//$x[] = $I->seeElement('a', ['class' => 'course-title-link']);
//$x[] = $I->grabAttributeFrom('.course-title-link', 'a');
$basePath = 'https://www.codeschool.com/';
$videos = '/videos';
$texts = $I->grabMultiple('a.course-title-link');
$hrefs = $I->grabMultiple('a.course-title-link', 'href');
//Download HD Quality
foreach ($hrefs as $link) {
    $desiredLink = $link . $videos;
    $I->amOnPage($desiredLink);
    $videoHrefs = $I->grabMultiple('a.js-level-open', 'href');
    foreach ($videoHrefs as $video) {
        $I->wantTo('get real video paths');
        $I->amOnUrl($basePath . $link . $videos . $video);
        $realVideoLink = $I->grabMultiple('iframe.hidden-iframe', 'src');
        dd($realVideoLink);
    }
}
function dd($val)
{
    echo '<pre>';
    print_r($val);
    die;
}
//https://www.codeschool.com/courses/try-sql
 public function systeminfo_セキュリティ管理SSL(\AcceptanceTester $I)
 {
     $I->wantTo('EA0804-UC01-T04 セキュリティ管理 - SSL強制');
     $testConfig = Fixtures::get('test_config');
     $I->amOnUrl('http://' . $testConfig['hostname'] . '/');
     $I->assertRegExp('/^http:\\/\\//', $I->executeJS('return location.href'), 'httpsにリダイレクトされない');
     $config = Fixtures::get('config');
     $I->amOnUrl('https://' . $testConfig['hostname'] . '/' . $config['admin_route'] . '/setting/system/security');
     $I->checkOption(['id' => 'admin_security_force_ssl']);
     $I->click('#aside_column div div div div div button');
     // httpでアクセスしたらhttpsにリダイレクトされる
     $I->amOnUrl('http://' . $testConfig['hostname'] . '/');
     $I->assertRegExp('/^https:\\/\\//', $I->executeJS('return location.href'), 'httpsにリダイレクトされる');
     // 後続テストのために戻しておく
     $I->amOnUrl('https://' . $testConfig['hostname'] . '/' . $config['admin_route'] . '/setting/system/security');
     $I->uncheckOption(['id' => 'admin_security_force_ssl']);
     $I->click('#aside_column div div div div div button');
 }
示例#5
0
<?php

$I = new AcceptanceTester($scenario);
$I->wantTo('home page is available');
// $I->amOnPage('/');
// $I->see('Welcome'/*, 'h2'*/);
$I->amOnUrl('http://codeception.com');
$I->see('Modern PHP testing for everyone.');