Skip to content

Commit f7c5a7b

Browse files
authored
Merge pull request #15 from GetAutomaApp/10-allow-host-machine-to-run-tests-as-well
ISSUE-10 - Allow host machine to run tests
2 parents 5ca9592 + 652dd62 commit f7c5a7b

File tree

5 files changed

+13
-16
lines changed

5 files changed

+13
-16
lines changed

.github/workflows/main.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,6 @@
11
name: Docker Image CI
22

33
on:
4-
push:
5-
branches:
6-
- "*"
74
pull_request:
85
branches:
96
- "develop"

README.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,15 @@ docker-compose up -d // Run httpd and chromedriver
3333
docker-compose run test // Run Tests in Docker
3434
```
3535
36+
# Testing on Host Machine
37+
```bash
38+
docker compose up selenium httpd -d
39+
```
40+
2. Run tests via test runner / `swift test`
41+
3642
3743
# Example
38-
### Start snd Stop
44+
### Start and Stop
3945
4046
```Swift
4147
let chromeOption = ChromeOptions(

Tests/SwiftWebDriverIntegrationTests/ChromeDriver/ChromeDriverIntegrationTestsBase.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ protocol ChromeDriverIntegrationTests {
1717
}
1818

1919
class ChromeDriverTest: ChromeDriverIntegrationTests {
20-
let baseUrl: String = "http://httpd"
20+
let baseUrl: String = "http://localhost"
2121
var testPageURL: URL {
2222
.init(string: "\(baseUrl)/\(page)")!
2323
}
@@ -26,7 +26,7 @@ class ChromeDriverTest: ChromeDriverIntegrationTests {
2626
var driver: WebDriver<ChromeDriver>
2727

2828
init() async throws {
29-
let driverURL = URL(string: "http://selenium:4444")!
29+
let driverURL = URL(string: "http://localhost:4444")!
3030
let chromeOptions = ChromeOptions(args: [
3131
Args(.disableDevShmUsage),
3232
Args(.noSandbox),

Tests/SwiftWebDriverIntegrationTests/ChromeDriver/DevTools/ChromeDriverJavascriptIntegrationTests.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class ChromeDriverJavascriptIntegrationTests: ChromeDriverTest {
2323
("sessionStorage.setItem('session', 'active'); return sessionStorage.getItem('session')", "active"),
2424
("let arr = [1, 2, 3]; arr.push(4); return arr.join(',')", "1,2,3,4"),
2525
("let obj = { name: 'Alice', age: 25 }; obj.age = 26; return `${obj.age}`", "26"),
26-
("document.body.innerHTML = '<p>Hello, World!</p>; return document.innerHTML", "Hello, World!"),
26+
("document.body.innerHTML = '<p>Hello, World!</p>'; return document.body.innerText", "Hello, World!"),
2727
]) func executeJavascript(input: (String, String)) async throws {
2828
do {
2929
try await driver.navigateTo(url: testPageURL)

docker-compose.yml

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,15 @@ version: '3'
22
services:
33
httpd:
44
image: httpd
5-
networks:
6-
- net1
5+
network_mode: host
76
volumes:
87
- ./TestAssets:/usr/local/apache2/htdocs/
98
ports:
109
- "80:80"
1110

1211
selenium:
1312
image: selenium/standalone-chrome:4.2.1-20220531
14-
networks:
15-
- net1
13+
network_mode: host
1614
ports:
1715
- 4444:4444
1816
- 7900:7900
@@ -25,8 +23,7 @@ services:
2523
volumes:
2624
- .:/SwiftWebDriver
2725
working_dir: /SwiftWebDriver
28-
networks:
29-
- net1
26+
network_mode: host
3027
environment:
3128
SELENIUM_URL: http://localhost:4444
3229
tty: true
@@ -45,6 +42,3 @@ services:
4542
shell:
4643
<<: *SwiftWebDriver
4744
entrypoint: /bin/bash
48-
49-
networks:
50-
net1:

0 commit comments

Comments
 (0)