Skip to content

Commit da87155

Browse files
authored
Merge pull request #3775 from Spuds/PWA
PWA App
2 parents f9d3d6a + 6d9ab46 commit da87155

28 files changed

+1506
-87
lines changed

.github/setup-elkarte.sh

+7
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,10 @@ then
3333
composer remove phpunit/phpunit phpunit/phpunit-selenium --dev
3434
composer require phpunit/phpunit:9.3.11 phpunit/phpunit-selenium:9.0.1 --dev --update-with-all-dependencies --ignore-platform-reqs
3535
fi
36+
37+
# Provide a way to return from actions redirectexit & obexit, so we can get results for Unit Test
38+
if [[ "$WEBSERVER" == "none" ]]
39+
then
40+
sudo sed -i '/global $db_show_debug;/a \\n\tif (defined("PHPUNITBOOTSTRAP") && defined("STDIN")){return $setLocation;}' ./sources/Subs.php
41+
sudo sed -i '/call_integration_hook('"'"'integrate_exit'"'"', \[$do_footer\]);/a \\n\tif (defined("PHPUNITBOOTSTRAP") && defined("STDIN")){return;}' ./sources/Subs.php
42+
fi

.github/setup-selenium.sh

+8-52
Original file line numberDiff line numberDiff line change
@@ -6,59 +6,15 @@
66
set -e
77
set -x
88

9-
# Access passed params
10-
DB=$1
11-
PHP_VERSION=$2
12-
13-
# Some vars to make this easy to change
14-
SELENIUM_HUB_URL='http://127.0.0.1:4444'
15-
SELENIUM_JAR=/usr/share/selenium/selenium-server-standalone.jar
16-
SELENIUM_DOWNLOAD_URL=https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
17-
18-
# Location of geckodriver for use as webdriver in xvfb
19-
GECKODRIVER_DOWNLOAD_URL=https://github.com/mozilla/geckodriver/releases/download/v0.29.1/geckodriver-v0.29.1-linux64.tar.gz
20-
GECKODRIVER_TAR=/tmp/geckodriver.tar.gz
21-
22-
# Location of chromedriver for use as webdriver in xvfb
23-
CHROMEDRIVER_ZIP=/tmp/chromedriver_linux64.zip
24-
25-
# Download Selenium
26-
echo "Downloading Selenium"
27-
sudo mkdir -p $(dirname "$SELENIUM_JAR")
28-
sudo wget -nv -O "$SELENIUM_JAR" "$SELENIUM_DOWNLOAD_URL"
29-
30-
# Install Fx or Chrome
31-
echo "Installing Browser"
32-
# sudo apt install firefox -y -qq > /dev/null
33-
# Available Chrome Versions
34-
# https://www.ubuntuupdates.org/package/google_chrome/stable/main/base/google-chrome-stable?id=202706
9+
# Per actions in the tests.yaml file
3510
#
36-
CHROME_VERSION='110.0.5481.100-1' # '91.0.4472.114-1'
37-
38-
wget https://dl.google.com/linux/chrome/deb/pool/main/g/google-chrome-stable/google-chrome-stable_${CHROME_VERSION}_amd64.deb -q
39-
sudo dpkg -i google-chrome-stable_${CHROME_VERSION}_amd64.deb
40-
41-
# Download Chrome Driver
42-
echo "Downloading chromedriver"
43-
CHROME_VERSION=$(google-chrome --version | cut -f 3 -d ' ' | cut -d '.' -f 1) \
44-
&& CHROMEDRIVER_RELEASE=$(curl --location --fail --retry 3 https://chromedriver.storage.googleapis.com/LATEST_RELEASE_${CHROME_VERSION}) \
45-
&& wget -nv -O "$CHROMEDRIVER_ZIP" "https://chromedriver.storage.googleapis.com/$CHROMEDRIVER_RELEASE/chromedriver_linux64.zip" \
46-
&& unzip "$CHROMEDRIVER_ZIP" \
47-
&& rm -rf "$CHROMEDRIVER_ZIP" \
48-
&& sudo mv chromedriver /usr/local/bin/chromedriver \
49-
&& sudo chmod +x /usr/local/bin/chromedriver \
50-
&& chromedriver --version
11+
# Current Versions for Ref
12+
# Selenium 3.141.59 jar
13+
# Chrome 123.0.6312.58
14+
# ChromeDriver 123.0.6312.58
5115

52-
# Download Gecko driver
53-
#echo "Downloading geckodriver"
54-
#wget -nv -O "$GECKODRIVER_TAR" "$GECKODRIVER_DOWNLOAD_URL" \
55-
# && sudo tar -xvf "$GECKODRIVER_TAR" -C "/usr/local/bin/" \
56-
# && sudo chmod +x /usr/local/bin/geckodriver \
57-
# && geckodriver --version
58-
59-
# Start Selenium using default chosen webdriver
60-
export DISPLAY=:99.0
61-
xvfb-run --server-args="-screen 0, 2560x1440x24" java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar "$SELENIUM_JAR" > /tmp/selenium.log &
16+
echo "Ensuring Selenium Started"
17+
SELENIUM_HUB_URL='http://127.0.0.1:4444'
6218
wget --retry-connrefused --tries=120 --waitretry=3 --output-file=/dev/null "$SELENIUM_HUB_URL/wd/hub/status" -O /dev/null
6319

6420
# Test to see if the selenium server really did start
@@ -77,7 +33,7 @@ else
7733
# Copy RemoteCoverage.php back to vendor, this version supports phpunit RawCodeCoverageData
7834
sudo cp ./tests/RemoteCoverage.php ./vendor/phpunit/phpunit-selenium/PHPUnit/Extensions/SeleniumCommon
7935

80-
# This keeps triggering in tests for the 2 second rule
36+
# This keeps triggering in tests for the 2 second rule, lets try to fix that
8137
sudo sed -i -e "s|spamProtection('login');|//spamProtection('login');|g" ./sources/ElkArte/Controller/Auth.php
8238

8339
# Run the phpunit selenium tests

.github/workflows/tests.yaml

+15-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ jobs:
4141
- name: Checkout ElkArte
4242
uses: actions/checkout@v4
4343
with:
44-
repository: Spuds/Elkarte
44+
repository: elkarte/elkarte
4545
fetch-depth: 10
4646
ref: ${{ env.ELKARTE_BRANCH }}
4747
path: elkarte
@@ -78,6 +78,20 @@ jobs:
7878
run: .github/setup-elkarte.sh $DB $PHP_VERSION
7979
working-directory: ./elkarte
8080

81+
- name: Download Selenium
82+
run: |
83+
sudo mkdir -p /usr/share/selenium
84+
wget -nv -O /usr/share/selenium/selenium-server-standalone.jar https://selenium-release.storage.googleapis.com/3.141/selenium-server-standalone-3.141.59.jar
85+
sudo chmod 777 /usr/share/selenium/selenium-server-standalone.jar
86+
87+
- name: Setup ChromeDriver
88+
uses: nanasess/setup-chromedriver@v2
89+
90+
- name: Start ChromeDriver
91+
run: |
92+
export DISPLAY=:99.0
93+
xvfb-run --server-args="-screen 0, 2560x1440x24" java -Dwebdriver.chrome.driver=/usr/local/bin/chromedriver -jar /usr/share/selenium/selenium-server-standalone.jar > /tmp/selenium.log &
94+
8195
- name: Run Unit Tests
8296
env:
8397
DB: ${{ matrix.db }}

elkManifest.php

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/**
4+
* This simply returns the manifest json info as generated by the manifest controller
5+
*
6+
* @package ElkArte Forum
7+
* @copyright ElkArte Forum contributors
8+
* @license BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
9+
*
10+
* @version 2.0 dev
11+
*
12+
*/
13+
14+
global $ssi_guest_access;
15+
16+
// Need to bootstrap to do much
17+
use ElkArte\ManifestMinimus;
18+
19+
require_once(__DIR__ . '/bootstrap.php');
20+
$ssi_guest_access = true;
21+
new Bootstrap(true);
22+
23+
// Our Manifest controller
24+
$controller = new ManifestMinimus();
25+
$controller->create();
26+
27+
// Always exit as successful
28+
exit(0);

0 commit comments

Comments
 (0)