$I->writePost('', ''); $I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl); \PostFormPage::of($I)->hasErrors(); $I->writePost('What a title', ''); $I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl); \PostFormPage::of($I)->hasErrors(); $I->writePost('What a title', 'whatapost'); $I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl); \PostFormPage::of($I)->hasErrors(); $I->writePost('', 'whatapostapost'); $I->seeCurrentUrlEquals(\PostFormPage::$newPostUrl); \PostFormPage::of($I)->hasErrors(); $I->writePost('What a title', '*whatapostapost*'); $I->dontSeeInCurrentUrl(\PostFormPage::$newPostUrl); \PostFormPage::of($I)->hasNoErrors(); $I->seeCurrentUrlEquals(\PostPage::route('what-a-title')); $I->see('whatapostapost', 'article em'); $I->seeInTitle('What a title'); $I->seeLink('link.edit'); $I->click('link.edit'); $id = $I->grabFromCurrentUrl('~(\\d+)~'); $I->amOnPage(\BlogFeedPage::$url); $I->see('What a title', '.sidebar'); $I->editPost($id, ''); \PostFormPage::of($I)->hasErrors(); $I->editPost($id, 'Another title', ''); \PostFormPage::of($I)->hasErrors(); $I->editPost($id, 'Another title'); \PostFormPage::of($I)->hasNoErrors(); $I->amOnPage(\BlogFeedPage::$url); $I->see('Another title', '.sidebar');
// categories $I->amOnPage(\BlogFeedPage::$url); $category = \BlogFeedPage::of($I)->getSidebarCategoryTitle(1); $otherCategory = \BlogFeedPage::of($I)->getSidebarCategoryTitle(2); $I->click($category, '.sidebar'); $I->seeCurrentUrlMatches(\CategoryFeedPage::$urlRegexp); $I->seeInTitle($category); $I->see($category, \CategoryFeedPage::$pageHeaderSelector); $I->see($category, \CategoryFeedPage::$postCategoryLinkSelector); $I->dontSee($otherCategory, 'article'); /* $I->amOnPage(\CategoryFeedPage::route('category-1', 2)); $I->see('heading.httpError [errorCode:404]'); $I->dontSeeElement('article'); */ // authors $I->amOnPage(\BlogFeedPage::$url); $firstPostTitle = $I->grabTextFrom(\BlogFeedPage::$postTitleSelector); $authorName = $I->grabTextFrom(\BlogFeedPage::$postUserLinkSelector); $I->click(\AuthorFeedPage::$postUserLinkSelector, 'article'); $I->seeCurrentUrlMatches(\AuthorFeedPage::$urlRegexp); $I->seeInTitle($authorName); $I->seeInTitle('pageTitle.user.index'); $I->see($authorName, \AuthorFeedPage::$pageHeaderSelector); $I->see($firstPostTitle, 'article'); $I->click($firstPostTitle); $I->seeInTitle($firstPostTitle); $I->see($firstPostTitle, \PostPage::$postTitleSelector); $I->amOnPage(\PostPage::route('slug-that-doesnt-exist-in-fixtures')); $I->seeHttpErrorPage(404); $I->dontSeeElement('article');