Compare commits
2 Commits
d1c715ab0c
...
5d0a1401d8
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5d0a1401d8 | ||
|
|
a98a0fcd53 |
6
.gitignore
vendored
6
.gitignore
vendored
@@ -14,7 +14,6 @@ db.sqlite3
|
|||||||
db.sqlite3-journal
|
db.sqlite3-journal
|
||||||
container.db.sqlite3
|
container.db.sqlite3
|
||||||
media
|
media
|
||||||
src/static
|
|
||||||
|
|
||||||
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
|
# If your build process includes running collectstatic, then you probably don't need or want to include staticfiles/
|
||||||
# in your Git repository. Update and uncomment the following line accordingly.
|
# in your Git repository. Update and uncomment the following line accordingly.
|
||||||
@@ -48,6 +47,11 @@ share/python-wheels/
|
|||||||
*.egg
|
*.egg
|
||||||
MANIFEST
|
MANIFEST
|
||||||
|
|
||||||
|
# Static files
|
||||||
|
src/static/*
|
||||||
|
!src/static/tests/
|
||||||
|
!src/static/tests/**
|
||||||
|
|
||||||
# PyInstaller
|
# PyInstaller
|
||||||
# Usually these files are written by a python script from a template
|
# Usually these files are written by a python script from a template
|
||||||
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
# before PyInstaller builds the exe, so as to inject date/other infos into it.
|
||||||
|
|||||||
@@ -140,6 +140,9 @@ USE_TZ = True
|
|||||||
|
|
||||||
STATIC_URL = 'static/'
|
STATIC_URL = 'static/'
|
||||||
STATIC_ROOT = BASE_DIR / 'static'
|
STATIC_ROOT = BASE_DIR / 'static'
|
||||||
|
STATICFILES_DIRS = [
|
||||||
|
BASE_DIR / 'static_src',
|
||||||
|
]
|
||||||
|
|
||||||
LOGGING = {
|
LOGGING = {
|
||||||
"version": 1,
|
"version": 1,
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ from selenium.webdriver.common.keys import Keys
|
|||||||
|
|
||||||
from .container_commands import reset_database
|
from .container_commands import reset_database
|
||||||
|
|
||||||
MAX_WAIT = 5
|
MAX_WAIT = 10
|
||||||
|
|
||||||
|
|
||||||
# Decorator fns
|
# Decorator fns
|
||||||
|
|||||||
13
src/functional_tests/test_jasmine.py
Normal file
13
src/functional_tests/test_jasmine.py
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
from selenium.webdriver.common.by import By
|
||||||
|
from .base import FunctionalTest
|
||||||
|
|
||||||
|
|
||||||
|
class JasmineTest(FunctionalTest):
|
||||||
|
def test_jasmine_specs_pass(self):
|
||||||
|
self.browser.get(self.live_server_url + "/static/tests/SpecRunner.html")
|
||||||
|
|
||||||
|
def check_results():
|
||||||
|
result = self.browser.find_element(By.CSS_SELECTOR, ".jasmine-overall-result")
|
||||||
|
self.assertIn("0 failures", result.text)
|
||||||
|
|
||||||
|
self.wait_for(check_results)
|
||||||
@@ -3,8 +3,6 @@ from selenium.webdriver.common.keys import Keys
|
|||||||
|
|
||||||
from .base import FunctionalTest
|
from .base import FunctionalTest
|
||||||
|
|
||||||
MAX_WAIT = 5
|
|
||||||
|
|
||||||
class NewVisitorTest(FunctionalTest):
|
class NewVisitorTest(FunctionalTest):
|
||||||
# Test methods
|
# Test methods
|
||||||
def test_can_start_a_todo_list(self):
|
def test_can_start_a_todo_list(self):
|
||||||
|
|||||||
21
src/static_src/tests/LICENSE
Normal file
21
src/static_src/tests/LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
Copyright (c) 2008-2019 Pivotal Labs
|
||||||
|
Copyright (c) 2008-2026 The Jasmine developers
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining
|
||||||
|
a copy of this software and associated documentation files (the
|
||||||
|
"Software"), to deal in the Software without restriction, including
|
||||||
|
without limitation the rights to use, copy, modify, merge, publish,
|
||||||
|
distribute, sublicense, and/or sell copies of the Software, and to
|
||||||
|
permit persons to whom the Software is furnished to do so, subject to
|
||||||
|
the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be
|
||||||
|
included in all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||||
|
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
||||||
|
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
||||||
|
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
||||||
|
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
||||||
|
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||||
|
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||||
57
src/static_src/tests/Spec.js
Normal file
57
src/static_src/tests/Spec.js
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
console.log("Spec.js is loading");
|
||||||
|
|
||||||
|
describe("GameArray JavaScript", () => {
|
||||||
|
const inputId= "id_text";
|
||||||
|
const errorClass = "invalid-feedback";
|
||||||
|
const inputSelector = `#${inputId}`;
|
||||||
|
const errorSelector = `.${errorClass}`;
|
||||||
|
let testDiv;
|
||||||
|
let textInput;
|
||||||
|
let errorMsg;
|
||||||
|
|
||||||
|
beforeEach(() => {
|
||||||
|
console.log("beforeEach");
|
||||||
|
testDiv = document.createElement("div");
|
||||||
|
testDiv.innerHTML = `
|
||||||
|
<form>
|
||||||
|
<input
|
||||||
|
id="${inputId}"
|
||||||
|
name="text"
|
||||||
|
class="form-control form-control-lg is-invalid"
|
||||||
|
placeholder="Enter a to-do item"
|
||||||
|
value="Value as submitted"
|
||||||
|
aria-describedby="id_text_feedback"
|
||||||
|
required
|
||||||
|
/>
|
||||||
|
<div id="id_text_feedback" class="${errorClass}">An error message</div>
|
||||||
|
</form>
|
||||||
|
`;
|
||||||
|
document.body.appendChild(testDiv);
|
||||||
|
textInput = document.querySelector(inputSelector);
|
||||||
|
errorMsg = document.querySelector(errorSelector);
|
||||||
|
});
|
||||||
|
|
||||||
|
afterEach(() => {
|
||||||
|
testDiv.remove();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should have a useful html fixture", () => {
|
||||||
|
console.log("in test 1");
|
||||||
|
expect(errorMsg.checkVisibility()).toBe(true);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should hide error message on input", () => {
|
||||||
|
console.log("in test 2");
|
||||||
|
initialize(inputSelector);
|
||||||
|
textInput.dispatchEvent(new InputEvent("input"));
|
||||||
|
|
||||||
|
expect(errorMsg.checkVisibility()).toBe(false);
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should not hide error message before event is fired", () => {
|
||||||
|
console.log("in test 3");
|
||||||
|
initialize(inputSelector);
|
||||||
|
|
||||||
|
expect(errorMsg.checkVisibility()).toBe(true);
|
||||||
|
});
|
||||||
|
});
|
||||||
34
src/static_src/tests/SpecRunner.html
Normal file
34
src/static_src/tests/SpecRunner.html
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||||
|
<meta name="author" content="Disco DeDisco">
|
||||||
|
<meta name="robots" content="noindex, nofollow">
|
||||||
|
|
||||||
|
<!-- Bootstrap CSS -->
|
||||||
|
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap/5.3.8/css/bootstrap.min.css"/>
|
||||||
|
<link rel="stylesheet" href="lib/jasmine-6.0.1/jasmine.css">
|
||||||
|
|
||||||
|
<title>Jasmine Spec Runner</title>
|
||||||
|
<link rel="stylesheet" href="lib/jasmine.css">
|
||||||
|
|
||||||
|
<!-- Jasmine -->
|
||||||
|
<script src="lib/jasmine-6.0.1/jasmine.js"></script>
|
||||||
|
<script src="lib/jasmine-6.0.1/jasmine-html.js"></script>
|
||||||
|
<script src="lib/jasmine-6.0.1/boot0.js"></script>
|
||||||
|
<!-- spec files -->
|
||||||
|
<script src="Spec.js"></script>
|
||||||
|
<!-- src files -->
|
||||||
|
<script src="/static/apps/scripts/dashboard.js"></script>
|
||||||
|
<!-- Jasmine env config (optional) -->
|
||||||
|
<script src="lib/jasmine-6.0.1/boot1.js"></script>
|
||||||
|
|
||||||
|
|
||||||
|
</head>
|
||||||
|
|
||||||
|
<body>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user