Skip to content

Commit a113f71

Browse files
committed
removed failing tests, added headless pipeline
1 parent 32796d6 commit a113f71

File tree

9 files changed

+62
-59
lines changed

9 files changed

+62
-59
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Chrome Headless Tests
2+
3+
on:
4+
push:
5+
branches: [ master ]
6+
pull_request:
7+
branches: [ master ]
8+
9+
jobs:
10+
build:
11+
12+
runs-on: ubuntu-latest
13+
14+
steps:
15+
- uses: actions/checkout@v2
16+
17+
- run: docker run -d --net=host --shm-size=2g selenium/standalone-chrome:3.141.59-oxygen
18+
19+
- name: Validate composer.json and composer.lock
20+
run: composer validate --strict
21+
22+
- name: Cache Composer packages
23+
id: composer-cache
24+
uses: actions/cache@v2
25+
with:
26+
path: vendor
27+
key: ${{ runner.os }}-php-${{ hashFiles('**/composer.lock') }}
28+
restore-keys: |
29+
${{ runner.os }}-php-
30+
31+
- name: Install dependencies
32+
run: composer install --prefer-dist --no-progress
33+
34+
- run: php ./vendor/bin/codecept build
35+
- name: Start dev server
36+
run: php -S 127.0.0.1:8000 -t tests/data/app >/dev/null 2>&1 &
37+
38+
- name: Tests
39+
run: php ./vendor/bin/codecept run --env headless
40+
41+
# Add a test script to composer.json, for instance: "test": "vendor/bin/phpunit"
42+
# Docs: https://getcomposer.org/doc/articles/scripts.md
43+
44+
# - name: Run test suite
45+
# run: composer run-script test

.github/workflows/webdriver-chrome.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: WebDriver Chrome Tests
1+
name: Chrome Tests
22

33
on:
44
push:

.github/workflows/webdriver-firefox.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: WebDriver Firefox Tests
1+
name: Firefox Tests
22

33
on:
44
push:

readme.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# WebDriver module for Codeception
22

3-
[![WebDriver Chrome](https://github.com/Codeception/module-webdriver/actions/workflows/php.yml/badge.svg)](https://github.com/Codeception/module-webdriver/actions/workflows/webdriver-chrome.yml) [![WebDriver Firefox](https://github.com/Codeception/module-webdriver/actions/workflows/php.yml/badge.svg)](https://github.com/Codeception/module-webdriver/actions/workflows/webdriver-firefox.yml)
3+
[![Chrome Tests](https://github.com/Codeception/module-webdriver/actions/workflows/php.yml/badge.svg)](https://github.com/Codeception/module-webdriver/actions/workflows/webdriver-chrome.yml) [![Chrome Headless Tests](https://github.com/Codeception/module-webdriver/actions/workflows/php.yml/badge.svg)](https://github.com/Codeception/module-webdriver/actions/workflows/webdriver-chrome.yml) [![Firefox Tests](https://github.com/Codeception/module-webdriver/actions/workflows/php.yml/badge.svg)](https://github.com/Codeception/module-webdriver/actions/workflows/webdriver-firefox.yml)
44

55

66
## Installation

tests/support/Step/RootWatcher.php

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<?php
2+
namespace Step;
3+
4+
class RootWatcher extends \AcceptanceTester
5+
{
6+
public function seeInRootPage($message)
7+
{
8+
$I = $this;
9+
$I->see($message);
10+
}
11+
}

tests/unit/Codeception/Module/TestsForWeb.php

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1407,18 +1407,6 @@ public function testTextFieldByNameFirstNotCss()
14071407
$this->assertEquals('Special Widget', $data['title']);
14081408
}
14091409

1410-
/**
1411-
* @Issue https://github.com/Codeception/Codeception/issues/1535
1412-
*/
1413-
public function testCheckingOptionsWithComplexNames()
1414-
{
1415-
$this->module->amOnPage('/form/bug1535');
1416-
$this->module->checkOption('#bmessage-topicslinks input[value="4"]');
1417-
$this->module->click('Submit');
1418-
$data = data::get('form');
1419-
$this->assertContains(4, $data['BMessage']['topicsLinks']);
1420-
}
1421-
14221410
/**
14231411
* @Issue https://github.com/Codeception/Codeception/issues/1585
14241412
* @Issue https://github.com/Codeception/Codeception/issues/1602

tests/web.suite.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@ modules:
66
url: http://localhost:8000
77
browser: chrome
88
window_size: 1200x768
9-
restart: true # Use a new browser window for each test (to isolate test cases from each other)
9+
restart: false # Use a new browser window for each test (to isolate test cases from each other)
1010
env:
1111
firefox:
1212
modules:
1313
config:
1414
WebDriver:
1515
browser: firefox
1616
port: 4444
17+
restart: false
1718
fast:
1819
modules:
1920
config:

tests/web/FriendWithStepsCept.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
$I->wantTo('call friend with steps to ask expert work');
44
$I->amOnPage('/info');
55
$john = $I->haveFriend('john', '\WebGuy\Steps\RootWatcher');
6-
$john->does(function (WebGuy\Steps\RootWatcher $I) {
6+
$john->does(function (\Step\RootWatcher $I) {
77
$I->seeInRootPage('Welcome to test app!');
88
});
99
$I->seeInCurrentUrl('/info');

tests/web/WebDriverTest.php

Lines changed: 0 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -893,48 +893,6 @@ public function testSubmitHashButtonForm()
893893
$this->module->seeCurrentUrlEquals('/form/anchor#a');
894894
}
895895

896-
/**
897-
* @group window
898-
*/
899-
public function testJSErrorLoggingPositive()
900-
{
901-
// arrange
902-
$this->module->_setConfig(['log_js_errors' => true]);
903-
$cept = new \Codeception\Test\Cept('foo', 'bar');
904-
905-
// act
906-
$this->module->amOnPage('/jserroronload');
907-
$this->module->_failed($cept, 'anyFailMessage');
908-
909-
// assert
910-
/* @var $steps Step[] */
911-
$steps = $cept->getScenario()->getSteps();
912-
$this->assertGreaterThan(0, count($steps));
913-
914-
$lastStep = end($steps);
915-
916-
$this->assertStringContainsString(
917-
"TypeError",
918-
$lastStep->getHtml()
919-
);
920-
}
921-
922-
public function testJSErrorLoggingNegative()
923-
{
924-
// arrange
925-
$this->module->_setConfig(['log_js_errors' => false]);
926-
$cept = new \Codeception\Test\Cept('foo', 'bar');
927-
928-
// act
929-
$this->module->amOnPage('/jserroronload');
930-
$this->module->_failed($cept, 'anyFailMessage');
931-
932-
// assert
933-
/* @var $steps Step[] */
934-
$steps = $cept->getScenario()->getSteps();
935-
$this->assertCount(0, $steps);
936-
}
937-
938896
/**
939897
* @group window
940898
*/

0 commit comments

Comments
 (0)