Bläddra i källkod

Refactored codeception/BasePage.

Qiang Xue 12 år sedan
förälder
incheckning
0acc59170f

+ 2 - 2
tests/_pages/AboutPage.php

@@ -6,5 +6,5 @@ use yii\codeception\BasePage;
 
 class AboutPage extends BasePage
 {
-	public static $URL = '?r=site/about';
-}
+	public $route = 'site/about';
+}

+ 1 - 1
tests/_pages/ContactPage.php

@@ -6,7 +6,7 @@ use yii\codeception\BasePage;
 
 class ContactPage extends BasePage
 {
-	public static $URL = '?r=site/contact';
+	public $route = 'site/contact';
 
 	/**
 	 * contact form name text field locator

+ 1 - 1
tests/_pages/LoginPage.php

@@ -6,7 +6,7 @@ use yii\codeception\BasePage;
 
 class LoginPage extends BasePage
 {
-	public static $URL = '?r=site/login';
+	public $route = 'site/login';
 
 	/**
 	 * login form username text field locator

+ 1 - 1
tests/acceptance/AboutCept.php

@@ -4,5 +4,5 @@ use tests\_pages\AboutPage;
 
 $I = new WebGuy($scenario);
 $I->wantTo('ensure that about works');
-$I->amOnPage(AboutPage::$URL);
+AboutPage::openBy($I);
 $I->see('About', 'h1');

+ 2 - 2
tests/acceptance/ContactCept.php

@@ -4,9 +4,9 @@ use tests\_pages\ContactPage;
 
 $I = new WebGuy($scenario);
 $I->wantTo('ensure that contact works');
-$contactPage = ContactPage::of($I);
 
-$I->amOnPage(ContactPage::$URL);
+$contactPage = ContactPage::openBy($I);
+
 $I->see('Contact', 'h1');
 
 $I->amGoingTo('submit contact form with no data');

+ 2 - 2
tests/acceptance/LoginCept.php

@@ -4,9 +4,9 @@ use tests\_pages\LoginPage;
 
 $I = new WebGuy($scenario);
 $I->wantTo('ensure that login works');
-$loginPage = LoginPage::of($I);
 
-$I->amOnPage(LoginPage::$URL);
+$loginPage = LoginPage::openBy($I);
+
 $I->see('Login', 'h1');
 
 $I->amGoingTo('try to login with empty credentials');

+ 1 - 1
tests/functional/AboutCept.php

@@ -4,5 +4,5 @@ use tests\_pages\AboutPage;
 
 $I = new TestGuy($scenario);
 $I->wantTo('ensure that about works');
-$I->amOnPage(AboutPage::$URL);
+AboutPage::openBy($I);
 $I->see('About', 'h1');

+ 2 - 2
tests/functional/ContactCept.php

@@ -4,9 +4,9 @@ use tests\functional\_pages\ContactPage;
 
 $I = new TestGuy($scenario);
 $I->wantTo('ensure that contact works');
-$contactPage = ContactPage::of($I);
 
-$I->amOnPage(ContactPage::$URL);
+$contactPage = ContactPage::openBy($I);
+
 $I->see('Contact', 'h1');
 
 $I->amGoingTo('submit contact form with no data');

+ 2 - 2
tests/functional/LoginCept.php

@@ -4,9 +4,9 @@ use tests\functional\_pages\LoginPage;
 
 $I = new TestGuy($scenario);
 $I->wantTo('ensure that login works');
-$loginPage = LoginPage::of($I);
 
-$I->amOnPage(LoginPage::$URL);
+$loginPage = LoginPage::openBy($I);
+
 $I->see('Login', 'h1');
 
 $I->amGoingTo('try to login with empty credentials');