From 99eed0955f727330c84b7801c0dcc69711395e25 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Thu, 14 Jan 2021 00:16:41 +0100 Subject: [PATCH 1/2] Add test for purchasing a product --- tests/Browser/BuyProductTest.php | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 tests/Browser/BuyProductTest.php diff --git a/tests/Browser/BuyProductTest.php b/tests/Browser/BuyProductTest.php new file mode 100644 index 00000000..4ddbac47 --- /dev/null +++ b/tests/Browser/BuyProductTest.php @@ -0,0 +1,23 @@ +browse(function (Browser $browser) { + $browser->visit('/') + ->assertSee('Laravel'); + }); + } +} From 6dc92df33600bb2721f4ec081de794af5ec9a335 Mon Sep 17 00:00:00 2001 From: w3bdesign <45217974+w3bdesign@users.noreply.github.com> Date: Thu, 14 Jan 2021 01:09:10 +0100 Subject: [PATCH 2/2] Setup CircleCI --- .circleci/config.yml | 50 ++++++++++++++++++++++++++++++++ tests/Browser/BuyProductTest.php | 4 +-- tests/Browser/ExampleTest.php | 4 +-- tests/DuskTestCase.php | 2 +- 4 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 .circleci/config.yml diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 00000000..42149790 --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,50 @@ +# PHP CircleCI 2.0 configuration file +# +# Check https://circleci.com/docs/2.0/language-php/ for more details +# +version: 2 +jobs: + build: + docker: + # Specify the version you desire here + - image: circleci/php:7.4-node-browsers + + steps: + - checkout + + - run: + name: "Prepare Environment" + command: | + sudo apt update + sudo docker-php-ext-install zip + + - run: + name: "Create Environment file" + command: | + mv .env.testing .env + + # Download and cache dependencies + - restore_cache: + keys: + # "composer.lock" can be used if it is committed to the repo + - v1-dependencies-{{ checksum "composer.json" }} + # fallback to using the latest cache if no exact match is found + - v1-dependencies- + + - run: + name: "Install Dependencies" + command: composer install -n --prefer-dist + + - save_cache: + key: v1-dependencies-{{ checksum "composer.json" }} + paths: + - ./vendor + + - run: + name: "Generate App key" + command: php artisan key:generate + + # run tests with phpunit + - run: + name: "Run Unit Tests" + command: ./vendor/bin/phpunit tests/Unit \ No newline at end of file diff --git a/tests/Browser/BuyProductTest.php b/tests/Browser/BuyProductTest.php index 4ddbac47..d78cd877 100644 --- a/tests/Browser/BuyProductTest.php +++ b/tests/Browser/BuyProductTest.php @@ -16,8 +16,8 @@ class BuyProductTest extends DuskTestCase public function testExample() { $this->browse(function (Browser $browser) { - $browser->visit('/') - ->assertSee('Laravel'); + $browser->visit('http://127.0.0.1:8000') + ->assertSee('Vue'); }); } } diff --git a/tests/Browser/ExampleTest.php b/tests/Browser/ExampleTest.php index 9d8968b2..154b802b 100644 --- a/tests/Browser/ExampleTest.php +++ b/tests/Browser/ExampleTest.php @@ -16,8 +16,8 @@ class ExampleTest extends DuskTestCase public function testBasicExample() { $this->browse(function (Browser $browser) { - $browser->visit('/') - ->assertSee('Laravel'); + $browser->visit('http://127.0.0.1:8000') + ->assertSee('Vue'); }); } } diff --git a/tests/DuskTestCase.php b/tests/DuskTestCase.php index b4e9a6ca..bd003434 100644 --- a/tests/DuskTestCase.php +++ b/tests/DuskTestCase.php @@ -33,7 +33,7 @@ protected function driver() { $options = (new ChromeOptions)->addArguments([ '--disable-gpu', - '--headless', + // '--headless', '--window-size=1920,1080', ]);