Testing Laravel Layered Applications Using the Behat / Mink and Behat Laravel Extensions

I am creating a multi-tenant SaaS application that I am trying to write using Behat using Mink and Behat Laravel Extension

When you register for an account, you get your own subdomain on the site {account}.tenancy.dev

My file behat.ymllooks like this:

default:
    extensions:
        Laracasts\Behat:
            # env_path: .env.behat
        Behat\MinkExtension:
            default_session: laravel
            base_url: http://tenancy.dev
            laravel: ~

I am having problems with the bat, because when I try to check my registration flow, I get a 404 error check that the new subdomain is available, all data is saved correctly, the process is manually checked and the subdomains are routed.

, Behat Behat/Mink SaaS?

Homestead.

+4
3

FeatureContext.php:

$this->setMinkParameter('base_url', $url);

url , :

/**
 * @Given I visit the url :url
 */
public function visitDomain($url)
{
    $this->setMinkParameter('base_url', $url);
    $this->visit('/');
}

:

Scenario: Test Multi Tenancy
  Given I have a business "mttest"
  When I visit the url "http://mttest.example.com"
  Then I should see "mttest"

, , , , , .

0

base_url: http://tenancy.dev URL- URL- (IE "/home).

, , base_url, , , URL , " http://test.tenancy.dev/fully/qualified".

base_url, , URL-, .

When I create an account named foo And GET "http://foo.tenancy.dev/ping" Then I get a 200 response code When I GET "/home" Then the response contains "Sign Up"

, base_url , .

0

xip.io, , /etc/hosts CI, .

To redirect {account}.tenancy.devto your local web server, you can use account.tenancy.dev.127.0.0.1.xip.ioone that resolves to 127.0.0.1.

0
source

Source: https://habr.com/ru/post/1584503/


All Articles