-
-
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.
initial e2e is working, testing add/delete QSO is working
- Loading branch information
Showing
11 changed files
with
2,141 additions
and
2 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,33 @@ | ||
name: End-to-end tests | ||
on: [pull_request] | ||
jobs: | ||
cypress-run: | ||
runs-on: ubuntu-latest | ||
services: | ||
mysql: | ||
image: mysql:5.7 | ||
env: | ||
MYSQL_ROOT_PASSWORD: cloudlogpassword | ||
ports: | ||
- 3306:3306 | ||
options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Setup PHP | ||
uses: shivammathur/setup-php@v2 | ||
with: | ||
php-version: '7.4' | ||
extensions: mbstring, mysql | ||
coverage: xdebug | ||
- name: Validate composer.json and composer.lock | ||
run: composer validate | ||
- name: Install dependencies | ||
run: composer install --prefer-dist --no-progress --no-suggest | ||
- name: Start Apache | ||
run: sudo service apache2 start | ||
- name: Run Cypress tests | ||
uses: cypress-io/github-action@v2 | ||
with: | ||
start: npm start | ||
wait-on: 'http://localhost' |
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
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,22 @@ | ||
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"); | ||
}); | ||
}); |
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,47 @@ | ||
describe("Post QSO Input Form", () => { | ||
beforeEach(() => { | ||
cy.login(); | ||
}); | ||
|
||
it("Submits a QSO", () => { | ||
cy.visit("index.php/qso?manual=1"); | ||
|
||
cy.get('select[name="mode"]').select("USB"); | ||
cy.get('select[name="band"]').select("20m"); | ||
cy.get('#qso_input input[name="callsign"]').first().type("KS3CKC"); | ||
|
||
// Submit the QSO | ||
cy.get("#qso_input").submit(); | ||
|
||
// Check if the QSO was added to the log | ||
cy.visit("index.php/dashboard"); | ||
|
||
cy.get("table > tbody > tr:first").within(() => { | ||
cy.get("td").eq(2).should("contain", "KS3CKC"); | ||
cy.get("td").eq(3).should("contain", "USB"); | ||
cy.get("td").eq(6).should("contain", "20m"); | ||
}); | ||
}); | ||
|
||
it("Delete a QSO", () => { | ||
cy.visit("index.php/dashboard"); | ||
|
||
// Click the link in the first row of the table to open the modal | ||
cy.get("table > tbody > tr:first").within(() => { | ||
cy.get("a").first().click(); | ||
}); | ||
|
||
// Click the "Edit QSO" button | ||
cy.get("a").contains("Edit QSO").should("be.visible").click(); | ||
|
||
// Click the delete button | ||
cy.get("a") | ||
.contains("Delete QSO") | ||
.scrollIntoView() | ||
.should("be.visible") | ||
.click(); | ||
|
||
// Click the confirm delete button | ||
cy.get("button").contains("OK").should("be.visible").click(); | ||
}); | ||
}); |
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 @@ | ||
Cypress.Commands.add("login", () => { | ||
const username = "m0abc"; | ||
const password = "demo"; | ||
cy.visit("/index.php/user/login"); | ||
cy.get('input[name="user_name"]').type(username); | ||
cy.get('input[name="user_password"]').type(password); | ||
cy.get('button[type="submit"]').click(); | ||
}); |
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,20 @@ | ||
// *********************************************************** | ||
// This example support/e2e.js is processed and | ||
// loaded automatically before your test files. | ||
// | ||
// This is a great place to put global configuration and | ||
// behavior that modifies Cypress. | ||
// | ||
// You can change the location of this file or turn off | ||
// automatically serving support files with the | ||
// 'supportFile' configuration option. | ||
// | ||
// You can read more here: | ||
// https://on.cypress.io/configuration | ||
// *********************************************************** | ||
|
||
// Import commands.js using ES2015 syntax: | ||
import './commands' | ||
|
||
// Alternatively you can use CommonJS syntax: | ||
// require('./commands') |
Oops, something went wrong.