-
-
Notifications
You must be signed in to change notification settings - Fork 190
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
2,744 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
MYSQL_ROOT_PASSWORD=rootpassword | ||
MYSQL_DATABASE=cloudlog | ||
MYSQL_USER=cloudlog | ||
MYSQL_PASSWORD=cloudlogpassword | ||
MYSQL_HOST=db | ||
MYSQL_PORT=3306 | ||
BASE_LOCATOR=IO91WM | ||
WEBSITE_URL=http://localhost | ||
DIRECTORY=/var/www/html |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
name: Cypress Tests | ||
on: [pull_request] | ||
jobs: | ||
cypress-e2e-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Cache Cypress | ||
uses: actions/cache@v2 | ||
with: | ||
path: ~/.cache/Cypress | ||
key: cypress-${{ hashFiles('package-lock.json') }} | ||
restore-keys: | | ||
cypress- | ||
- name: Install Cypress | ||
run: npm install cypress | ||
|
||
- name: Cache .env | ||
uses: actions/cache@v2 | ||
with: | ||
path: .env | ||
key: .env-${{ hashFiles('.env.sample') }} | ||
restore-keys: | | ||
.env- | ||
- name: Setup .env | ||
run: | | ||
if [ ! -f .env ]; then | ||
cp .env.sample .env | ||
fi | ||
- name: Build Docker services | ||
run: docker-compose up -d | ||
|
||
- name: Wait for services to start | ||
run: sleep 5 | ||
|
||
- name: Populate dxcc_entities table | ||
run: curl "http://localhost/index.php/update/dxcc" | ||
|
||
- name: Run Cypress tests | ||
run: npx cypress run |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# Use the official image for PHP and Apache | ||
FROM php:7.4-apache | ||
|
||
# Set the working directory to /var/www/html | ||
WORKDIR /var/www/html | ||
|
||
# Install system dependencies, including git and libxml2 | ||
RUN apt-get update && apt-get install -y \ | ||
libcurl4-openssl-dev \ | ||
libxml2-dev \ | ||
libzip-dev \ | ||
zlib1g-dev \ | ||
libpng-dev \ | ||
libonig-dev \ | ||
default-mysql-client \ | ||
curl \ | ||
&& apt-get clean \ | ||
&& rm -rf /var/lib/apt/lists/* \ | ||
&& docker-php-ext-install pdo_mysql \ | ||
&& docker-php-ext-install mysqli \ | ||
&& docker-php-ext-install gd \ | ||
&& docker-php-ext-install mbstring \ | ||
&& docker-php-ext-install zip \ | ||
&& docker-php-ext-install xml \ | ||
&& a2enmod rewrite | ||
|
||
# Expose port 80 | ||
EXPOSE 80 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# Dockerfile-db | ||
FROM mariadb:latest | ||
|
||
# Add the install.sql file to the docker image | ||
ADD install/assets/install.sql /docker-entrypoint-initdb.d | ||
|
||
# Expose port 3306 | ||
EXPOSE 3306 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,5 +12,4 @@ public function down() | |
{ | ||
// Will not go back to insecure connections | ||
} | ||
} | ||
?> | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -191,4 +191,4 @@ | |
<?php } ?> | ||
|
||
</div> | ||
</div> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
const { defineConfig } = require("cypress"); | ||
|
||
module.exports = defineConfig({ | ||
projectId: 'gm8wco', | ||
e2e: { | ||
baseUrl: "http://localhost/", | ||
setupNodeEvents(on, config) { | ||
// implement node event listeners here | ||
}, | ||
}, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
describe("Login Test", () => { | ||
it("Should log in successfully", () => { | ||
// Define the username and password | ||
const username = "m0abc"; | ||
const password = "demo"; | ||
|
||
// Visit the login page | ||
cy.visit("/index.php/user/login"); | ||
|
||
// Type the username and password into the input fields | ||
cy.get('input[name="user_name"]').type(username); | ||
cy.get('input[name="user_password"]').type(password); | ||
|
||
// Click the login button | ||
cy.get('button[type="submit"]').click(); | ||
|
||
// Check if the login was successful | ||
// This could be checking/ for a URL change, looking for a log out button, etc. | ||
cy.url().should("include", "/dashboard"); | ||
cy.contains("Logout"); | ||
}); | ||
|
||
it("Should display an error message on failed login", () => { | ||
// Define the username and password | ||
const username = "m0abc"; | ||
const password = "wrongpassword"; | ||
|
||
// Visit the login page | ||
cy.visit("/index.php/user/login"); | ||
|
||
// Type the username and password into the input fields | ||
cy.get('input[name="user_name"]').type(username); | ||
cy.get('input[name="user_password"]').type(password); | ||
|
||
// Click the login button | ||
cy.get('button[type="submit"]').click(); | ||
|
||
// Check if the login was successful | ||
// This could be checking/ for a URL change, looking for a log out button, etc. | ||
cy.url().should("include", "/login"); | ||
|
||
cy.get("body") | ||
.contains("Incorrect username or password!") | ||
.should("be.visible") | ||
.and("have.class", "alert-danger"); | ||
}); | ||
|
||
it("Should display an error message on empty fields", () => { | ||
// Visit the login page | ||
cy.visit("/index.php/user/login"); | ||
|
||
// Click the login button | ||
cy.get('button[type="submit"]').click(); | ||
|
||
// Check if the login was successful | ||
// This could be checking/ for a URL change, looking for a log out button, etc. | ||
cy.url().should("include", "/login"); | ||
|
||
cy.get("body") | ||
.contains(`The "Username" field is required.`) | ||
.should("be.visible") | ||
.parent() | ||
.and("have.class", "alert-danger"); | ||
|
||
cy.get("body") | ||
.contains(`The "Password" field is required.`) | ||
.should("be.visible") | ||
.parent() | ||
.and("have.class", "alert-danger"); | ||
}); | ||
|
||
it("Should display and open the forgot password page", () => { | ||
// Visit the login page | ||
cy.visit("/index.php/user/login"); | ||
|
||
// Click the "Forgot Password?" link | ||
cy.get("a") | ||
.contains("Forgot your password?") | ||
.should("be.visible") | ||
.click(); | ||
|
||
// Check if the correct page has been loaded by checking the URL | ||
cy.url().should("include", "/forgot_password"); | ||
}); | ||
}); |
Oops, something went wrong.