diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 657e7d31a..a4c1fab0c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,8 +24,8 @@ jobs: with: fetch-depth: 0 - - name: Start up Fuseki - run: cd tests; ./init_fuseki.sh + - name: Start up containers + run: cd tests; ./init_containers.sh - name: Cache Composer dependencies uses: actions/cache@v3 diff --git a/cypress.config.js b/cypress.config.js index 42ea2a54f..45fe3fdfb 100644 --- a/cypress.config.js +++ b/cypress.config.js @@ -4,7 +4,7 @@ module.exports = defineConfig({ projectRoot: "tests", e2e: { // You also can run like this: npx cypress run --config "baseUrl=http://localhost/Skosmos" - baseUrl: 'http://localhost/Skosmos', + baseUrl: 'http://localhost:9090/', setupNodeEvents(on, config) { on('task', { log(message) { diff --git a/tests/GlobalConfigTest.php b/tests/GlobalConfigTest.php index 40be899fb..364cbdd00 100644 --- a/tests/GlobalConfigTest.php +++ b/tests/GlobalConfigTest.php @@ -10,6 +10,8 @@ class GlobalConfigTest extends PHPUnit\Framework\TestCase private $config; /** @var GlobalConfig */ private $configWithDefaults; + /** @var GlobalConfig */ + private $configWithBaseHref; protected function setUp(): void { @@ -17,6 +19,7 @@ protected function setUp(): void $this->assertNotNull($this->config->getCache()); $this->assertNotNull($this->config->getGraph()); $this->configWithDefaults = new GlobalConfig('/../../tests/testconfig-fordefaults.ttl'); + $this->configWithBaseHref = new GlobalConfig('/../../tests/testconfig-basehref.ttl'); } // --- tests for values that are overriding default values @@ -53,7 +56,7 @@ public function testGetServiceName() public function testGetBaseHref() { - $this->assertEquals("http://tests.localhost/Skosmos/", $this->config->getBaseHref()); + $this->assertEquals("http://tests.localhost/Skosmos/", $this->configWithBaseHref->getBaseHref()); } public function testGetLanguages() diff --git a/tests/RestControllerTest.php b/tests/RestControllerTest.php index b6a2bb87a..1ac3aab46 100644 --- a/tests/RestControllerTest.php +++ b/tests/RestControllerTest.php @@ -918,7 +918,7 @@ public function testVocabularyStatistics() }, "count": "void:entities", "@language": "en", - "@base": "http://tests.localhost/Skosmos/rest/v1/test/" + "@base": "http://:/rest/v1/test/" }, "uri": "", "id": "test", diff --git a/tests/cypress/template/error.cy.js b/tests/cypress/template/error.cy.js index 2eb603f90..ea4b9dfc2 100644 --- a/tests/cypress/template/error.cy.js +++ b/tests/cypress/template/error.cy.js @@ -5,6 +5,6 @@ describe('Error page', () => { // go to a non-existing page cy.visit('/404', {failOnStatusCode: false}) // check that the page contains 404 error code - cy.get('.alert h3').invoke('text').should('contain', '404 Error') + cy.get('.alert span').invoke('text').should('contain', '404 Error') }) }) diff --git a/tests/docker-compose.yml b/tests/docker-compose.yml new file mode 100644 index 000000000..d753d35c7 --- /dev/null +++ b/tests/docker-compose.yml @@ -0,0 +1,19 @@ +version: '3.7' + +services: + fuseki: + extends: + file: ../dockerfiles/docker-compose.yml + service: fuseki + fuseki-cache: + extends: + file: ../dockerfiles/docker-compose.yml + service: fuseki-cache + skosmos: + extends: + file: ../dockerfiles/docker-compose.yml + service: skosmos + volumes: + - type: bind + source: testconfig.ttl + target: /var/www/html/config.ttl diff --git a/tests/init_fuseki.sh b/tests/init_containers.sh similarity index 97% rename from tests/init_fuseki.sh rename to tests/init_containers.sh index a8c697b6d..15c364f27 100755 --- a/tests/init_fuseki.sh +++ b/tests/init_containers.sh @@ -1,7 +1,6 @@ #!/bin/bash # Build and start up containers (skosmos, skosmos-cache, fuseki) -cd ../dockerfiles docker compose up -d --build echo "Waiting for Fuseki to get ready" diff --git a/tests/testconfig-basehref.ttl b/tests/testconfig-basehref.ttl new file mode 100644 index 000000000..54be47c5a --- /dev/null +++ b/tests/testconfig-basehref.ttl @@ -0,0 +1,52 @@ +@prefix void: . +@prefix rdf: . +@prefix rdfs: . +@prefix owl: . +@prefix xsd: . +@prefix dc: . +@prefix foaf: . +@prefix wv: . +@prefix sd: . +@prefix skos: . +@prefix skosmos: . +@prefix isothes: . +@prefix mdrtype: . +@prefix : . + +# Skosmos main configuration + +:config a skosmos:Configuration ; + # customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy. + skosmos:baseHref "http://tests.localhost/Skosmos/" ; + skosmos:templateCache "/tmp/skosmos-template-cache-tests" . + +:test a skosmos:Vocabulary, void:Dataset ; + dc:title "Test ontology"@en ; + dc:subject :cat_science ; + dc:type mdrtype:ONTOLOGY ; + void:dataDump ; + void:sparqlEndpoint ; + void:uriSpace "http://www.skosmos.skos/test/"; + skos:prefLabel "Test ontology"@en ; + skosmos:arrayClass isothes:ThesaurusArray ; + skosmos:defaultLanguage "en"; + skosmos:feedbackRecipient "developer@vocabulary.org"; + skosmos:groupClass skos:Collection; + skosmos:language "en"; + skosmos:showTopConcepts "true"; + skosmos:shortName "Test short", + "Testi lyhyt"@fi; + skosmos:sparqlGraph . + +:cat_science a skos:Concept ; + skos:topConceptOf :categories ; + skos:inScheme :categories ; + skos:prefLabel "Luonnontieteet ja lääketiede"@fi, + "Naturvetenskap och medicin"@sv, + "Science and medicine"@en . + +mdrtype:THESAURUS a skos:Concept ; + skos:prefLabel "Тезаурус"@bg, "Tezaurus"@cs, "Tesaurus"@da, "Thesaurus"@de, "Θησαυρός"@el, "Thesaurus"@en, "Tesaurus"@et, "Tesaurus"@fi, "Thésaurus"@fr, "Pojmovnik"@hr, "Tezaurusz"@hu, "Tesauro"@it, "Tēzaurs"@lv, "Tezauras"@lt, "Teżawru"@mt, "Thesaurus"@nl, "Tesaurus"@no, "Tezaurus"@pl, "Tesauro"@pt, "Tezaur"@ro, "Synonymický slovník"@sk, "Tezaver"@sl, "Tesauro"@es, "Tesaurus"@sv . + +mdrtype:ONTOLOGY a skos:Concept ; + skos:prefLabel "Онтология"@bg, "Ontologie"@cs, "Ontologi"@da, "Ontologie"@de, "Οντολογία"@el, "Ontology"@en, "Ontoloogia"@et, "Ontologia"@fi, "Ontologie"@fr, "Ontologija"@hr, "Ontológia"@hu, "Ontologia"@it, "Ontoloģija"@lv, "Ontologija"@lt, "Ontoloġija"@mt, "Ontologie"@nl, "Ontologi"@no, "Struktura pojęciowa"@pl, "Ontologia"@pt, "Ontologie"@ro, "Ontológia"@sk, "Ontologija"@sl, "Ontología"@es, "Ontologi"@sv . diff --git a/tests/testconfig.ttl b/tests/testconfig.ttl index 5c6ee6c66..58032cf66 100644 --- a/tests/testconfig.ttl +++ b/tests/testconfig.ttl @@ -34,7 +34,7 @@ # customize the service name skosmos:serviceName "Skosmos being tested" ; # customize the base element. Set this if the automatic base url detection doesn't work. For example setups behind a proxy. - skosmos:baseHref "http://tests.localhost/Skosmos/" ; + #skosmos:baseHref "http://localhost/Skosmos/" ; # interface languages available, and the corresponding system locales skosmos:languages ( [ rdfs:label "en" ; rdf:value "en_GB.utf8" ] [ rdfs:label "fi" ; rdf:value "fi_FI.utf8" ]