How do I run a PHPUnit Selenium test without having a new browser window run for each function?

前端 未结 5 1863
逝去的感伤
逝去的感伤 2021-01-13 05:06

I am trying to run a selenium test case using PHPUnit. And the first thing I do is trying the login function, this works perfect but then I want to run a function to check i

5条回答
  •  没有蜡笔的小新
    2021-01-13 05:32

    make assetrions in one function because this is functional test. i am new to phpunit and selenium too, but I successfully test all in one like this:

    public function testAuth(){  
    
    $this->open('register.php&XDEBUG_SESSION_START=PHPSTORM');
    $this->assertTextPresent('Register');
    $this->type('name=email', "...");
    $this->type('name=firstname', "...");
    $this->type('name=lastname', "...");       
    $this->type('name=password', "...");
    $this->type('name=verifyPassword', "...");
    $this->click("reg-butt");
    $this->waitForPageToLoad("5000");
    $this->assertTextPresent('Profile');
    $this->open('logout.php');
    $this->assertTextPresent('text from redirect page');
    $this->open('login.php');
    .....
    
    }
    

提交回复
热议问题