如何将我的变量存储在yaml文件中?

I have just started to learn Selenium Testing in Php and I started to test login function in the website. I would like to write standard test which is applicable for any website. That's why I would like to keep my variables in separate YML file.

How can keep my variables in YML file and call my variables from YML file to php? I have tried too many solution but none of them really worked. Thanks in advance for your help.

class OrderCest
{
    public static $URL = '/';
    public static $searchField = '#login--form #email';
    public static $passwordField = '#login--form input[name=password]';
    public static $loginButton = '#login--form button[type=submit]';

    public function checkLogin(AcceptanceTester $I)
    {
        $I->amOnPage($URL);
        $I->fillField(self::$emailField, $email);
        $I->fillField(self::$passwordField, $password);
        $I->click(self::$loginButton);
        sleep(3);
        return $this;
    }

my Codeception configuration is:

actor: AcceptanceTester
modules:
    enabled:
        - \Helper\Acceptance
        - WebDriver:
            url: '/'
            browser: chrome
            host: '787877878'
            window_size: 1920x1080
            port: 9999
            wait: 5
            capabilities:
                unexpectedAlertBehaviour: 'accept'
      setting:
        email: 'testdeneyv@gmail.com'
        pasword: ................
查看全部
drjgk44268
drjgk44268
2019/07/04 13:01
  • php
  • codeception
  • yaml
  • 点赞
  • 收藏
  • 回答
    私信
满意答案
查看全部

1个回复