kopia lustrzana https://github.com/magicbug/Cloudlog
initial e2e is working, testing add/delete QSO is working
rodzic
36f05bdef3
commit
66017f3b65
|
@ -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'
|
|
@ -13,6 +13,8 @@
|
|||
/assets/qslcard/*
|
||||
/assets/sstvimages/*
|
||||
/assets/js/sections/custom.js
|
||||
/cypress/screenshots
|
||||
/node_modules
|
||||
.idea/*
|
||||
.DS_Store
|
||||
sync.sh
|
||||
|
|
|
@ -153,7 +153,7 @@
|
|||
<?php } ?>
|
||||
|
||||
</div>
|
||||
<a class="dropdown-item" href="javascript:qso_delete(<?php echo $row->COL_PRIMARY_KEY; ?>, '<?php echo $row->COL_CALL; ?>')"><i class="fas fa-trash-alt"></i> <?php echo lang('general_delete_qso'); ?></a>
|
||||
<a class="dropdown-item" id="qso_delete" href="javascript:qso_delete(<?php echo $row->COL_PRIMARY_KEY; ?>, '<?php echo $row->COL_CALL; ?>')"><i class="fas fa-trash-alt"></i> <?php echo lang('general_delete_qso'); ?></a>
|
||||
</div>
|
||||
</td>
|
||||
<?php } ?>
|
||||
|
|
|
@ -422,7 +422,7 @@
|
|||
|
||||
<?php if(($this->config->item('use_auth') && ($this->session->userdata('user_type') >= 2)) || $this->config->item('use_auth') === FALSE) { ?>
|
||||
<br>
|
||||
<div style="display: inline-block;"><p class="editButton"><a class="btn btn-primary" href="<?php echo site_url('qso/edit'); ?>/<?php echo $row->COL_PRIMARY_KEY; ?>" href="javascript:;"><i class="fas fa-edit"></i> <?php echo lang('qso_btn_edit_qso'); ?></a></p></div>
|
||||
<div style="display: inline-block;"><p class="editButton"><a class="btn btn-primary" href="javascript:qso_edit(<?php echo $row->COL_PRIMARY_KEY; ?>)"><i class="fas fa-edit"></i> <?php echo lang('qso_btn_edit_qso'); ?></a></p></div>
|
||||
<div style="display: inline-block;"><form method="POST" action="<?php echo site_url('search'); ?>"><input type="hidden" value="<?php echo strtoupper($row->COL_CALL); ?>" name="callsign"><button class="btn btn-primary" type="submit"><i class="fas fa-eye"></i> <?php echo lang('general_more_qso'); ?></button></form></div>
|
||||
<?php } ?>
|
||||
|
||||
|
|
|
@ -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
|
||||
},
|
||||
},
|
||||
});
|
|
@ -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");
|
||||
});
|
||||
});
|
|
@ -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();
|
||||
});
|
||||
});
|
|
@ -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();
|
||||
});
|
|
@ -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')
|
Plik diff jest za duży
Load Diff
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"name": "cloudlog",
|
||||
"version": "1.0.0",
|
||||
"description": "> Important: Only accepting PRs on the \"dev\" branch.",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
"test": "echo \"Error: no test specified\" && exit 1"
|
||||
},
|
||||
"keywords": [],
|
||||
"author": "",
|
||||
"license": "ISC",
|
||||
"devDependencies": {
|
||||
"cypress": "^13.7.2"
|
||||
}
|
||||
}
|
Ładowanie…
Reference in New Issue