Skip to content

Commit

Permalink
Adds Dusk and Gitpod
Browse files Browse the repository at this point in the history
  • Loading branch information
ijpatricio committed Apr 3, 2023
1 parent 13fbdc2 commit 2717274
Show file tree
Hide file tree
Showing 13 changed files with 376 additions and 1 deletion.
8 changes: 8 additions & 0 deletions .coolify-logo
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
_____ _ _ __
/ ____| | (_)/ _|
| | ___ ___ | |_| |_ _ _
| | / _ \ / _ \| | | _| | | |
| |___| (_) | (_) | | | | | |_| |
\_____\___/ \___/|_|_|_| \__, |
__/ |
|___/
45 changes: 45 additions & 0 deletions .gitpod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
tasks:
- name: Setup Sail environment and Composer dependencies
# Fix because of https://github.com/gitpod-io/gitpod/issues/16614
before: sudo curl -o /usr/local/bin/docker-compose -fsSL https://github.com/docker/compose/releases/download/v2.16.0/docker-compose-linux-$(uname -m)
init: |
cp .env.example .env &&
sed -i "s#APP_URL=http://localhost#APP_URL=$(gp url 80)#g" .env
sed -i "s#GITPOD_VITE_URL=#GITPOD_VITE_URL=$(gp url 5173)#g" .env
composer install --ignore-platform-reqs
./vendor/bin/sail up -d
./vendor/bin/sail php artisan key:generate
./vendor/bin/sail php artisan storage:link
cat .coolify-logo
gp sync-done sail-is-ready
- name: Install Node dependencies and run Vite
command: |
echo "Waiting for Sail environment to boot up."
gp sync-await sail-is-ready
./vendor/bin/sail npm install
./vendor/bin/sail npm run dev
ports:
- port: 3306
onOpen: ignore
name: MySQL Database Port
- port: 5173
onOpen: ignore
visibility: public
name: Node Server for Vite

# Configure vscode
vscode:
extensions:
- bmewburn.vscode-intelephense-client
- eamodio.gitlens
- ikappas.composer
- ms-azuretools.vscode-docker
- ecmel.vscode-html-css
- MehediDracula.php-namespace-resolver
- wmaurer.change-case
- Equinusocio.vsc-community-material-theme
- EditorConfig.EditorConfig
- streetsidesoftware.code-spell-checker
- rangav.vscode-thunder-client
1 change: 1 addition & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"require-dev": {
"fakerphp/faker": "^1.9.1",
"laravel/dusk": "^7.7",
"laravel/pint": "^1.0",
"laravel/sail": "^1.18",
"mockery/mockery": "^1.4.4",
Expand Down
141 changes: 140 additions & 1 deletion composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,10 @@ x-testing-host: &testing-host-base

services:
php:
hostname: coolify.test
image: "coolify:${TAG:-4}"
extra_hosts:
- 'host.docker.internal:host-gateway'
build:
context: ./docker/dev
dockerfile: Dockerfile
Expand All @@ -34,6 +37,8 @@ services:
depends_on:
postgres:
condition: service_healthy
selenium:
condition: service_started
postgres:
image: postgres:15-alpine
ports:
Expand All @@ -57,6 +62,14 @@ services:
]
retries: 5
timeout: 10s
selenium:
image: seleniarm/standalone-chromium
extra_hosts:
- 'host.docker.internal:host-gateway'
volumes:
- '/dev/shm:/dev/shm'
networks:
- coolify
testing-host:
<<: *testing-host-base
container_name: coolify-testing-host
Expand Down
15 changes: 15 additions & 0 deletions phpunit.dusk.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit backupGlobals="false"
beStrictAboutTestsThatDoNotTestAnything="false"
colors="true"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
cacheDirectory=".phpunit.cache"
backupStaticProperties="false">
<testsuites>
<testsuite name="Browser Test Suite">
<directory suffix="Test.php">./tests/Browser</directory>
</testsuite>
</testsuites>
</phpunit>
21 changes: 21 additions & 0 deletions tests/Browser/ExampleTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Tests\Browser;

use Illuminate\Foundation\Testing\DatabaseMigrations;
use Laravel\Dusk\Browser;
use Tests\DuskTestCase;

class ExampleTest extends DuskTestCase
{
/**
* A basic browser test example.
*/
public function testBasicExample(): void
{
$this->browse(function (Browser $browser) {
$browser->visit('/')
->assertSee('Laravel');
});
}
}
36 changes: 36 additions & 0 deletions tests/Browser/Pages/HomePage.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
<?php

namespace Tests\Browser\Pages;

use Laravel\Dusk\Browser;

class HomePage extends Page
{
/**
* Get the URL for the page.
*/
public function url(): string
{
return '/';
}

/**
* Assert that the browser is on the page.
*/
public function assert(Browser $browser): void
{
//
}

/**
* Get the element shortcuts for the page.
*
* @return array<string, string>
*/
public function elements(): array
{
return [
'@element' => '#selector',
];
}
}
20 changes: 20 additions & 0 deletions tests/Browser/Pages/Page.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Tests\Browser\Pages;

use Laravel\Dusk\Page as BasePage;

abstract class Page extends BasePage
{
/**
* Get the global element shortcuts for the site.
*
* @return array<string, string>
*/
public static function siteElements(): array
{
return [
'@element' => '#selector',
];
}
}
2 changes: 2 additions & 0 deletions tests/Browser/console/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions tests/Browser/screenshots/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
2 changes: 2 additions & 0 deletions tests/Browser/source/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
Loading

0 comments on commit 2717274

Please sign in to comment.