2 files added
8 files modified
1 files deleted
| | |
| | | - 7.0 |
| | | - nightly |
| | | |
| | | addons: |
| | | firefox: latest |
| | | chrome: stable |
| | | |
| | | before_script: |
| | | - 'php -S 127.0.0.1:8080 &' |
| | | - 'nvm install stable' |
| | | - 'npm install casperjs' |
| | | - 'npm install nightwatch selenium-server chromedriver geckodriver' |
| | | |
| | | script: |
| | | - 'node_modules/casperjs/bin/casperjs test tests.js' |
| | | - 'node_modules/.bin/nightwatch -e chrome-headless' |
| | | - 'node_modules/.bin/nightwatch -e firefox-headless' |
| | |
| | | * PARSING * |
| | | ***********/ |
| | | |
| | | function normalizeName(string) { |
| | | return string.replace('.', '. ').replace(' ', ' '); |
| | | } |
| | | |
| | | function parseStatus(status) { |
| | | switch(status.status) { |
| | | case 'STOPPING': |
| | |
| | | </div> |
| | | <script src="https://polyfill.io/v3/polyfill.min.js?features=Promise,XMLHttpRequest"></script> |
| | | <script type="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> |
| | | <script type="text/javascript" src="common.js?v8"></script> |
| | | <script type="text/javascript" src="index.js?v7"></script> |
| | | <script type="text/javascript" src="common.js?v9"></script> |
| | | <script type="text/javascript" src="index.js?v8"></script> |
| | | </body> |
| | | </html> |
| | |
| | | + '&mode=departure' |
| | | ).done(function(data) { |
| | | setText(times_stop_type, lang.types['s' + prefix]); |
| | | setText(times_stop_name, data.stopName); |
| | | setText(page_title, lang.page_title_stop_name.replace('$stop', data.stopName)); |
| | | setText(times_stop_name, normalizeName(data.stopName)); |
| | | setText(page_title, lang.page_title_stop_name.replace('$stop', normalizeName(data.stopName))); |
| | | deleteChildren(times_alerts); |
| | | deleteChildren(times_table); |
| | | //deleteChildren(times_lines); |
| | |
| | | <script src="https://polyfill.io/v3/polyfill.min.js?features=Array.prototype.forEach,Array.prototype.includes,Array.prototype.map,Element.prototype.classList,Promise,String.prototype.startsWith,XMLHttpRequest,requestAnimationFrame"></script> |
| | | <script src="https://cdn.jsdelivr.net/gh/openlayers/openlayers.github.io@master/en/v5.3.0/build/ol.js" integrity="sha384-iQkGyyH4ioz3m+maM3s9MX1Oq67mACa4B9Z3ovUv3Sv37LJ96fx3WnZfLoiC3Wfl" crossorigin="anonymous"></script> |
| | | <script tyle="text/javascript" src="lang_pl.js?v8" id="lang_script"></script> |
| | | <script tyle="text/javascript" src="common.js?v8"></script> |
| | | <script tyle="text/javascript" src="map.js?v20"></script> |
| | | <script tyle="text/javascript" src="common.js?v9"></script> |
| | | <script tyle="text/javascript" src="map.js?v21"></script> |
| | | </body> |
| | | </html> |
| | |
| | | |
| | | var vehicle_name_space = vehicle.name.indexOf(' '); |
| | | vehicle.line = vehicle.name.substr(0, vehicle_name_space); |
| | | vehicle.direction = vehicle.name.substr(vehicle_name_space+1); |
| | | vehicle.direction = normalizeName(vehicle.name.substr(vehicle_name_space+1)); |
| | | if(special_directions[vehicle.direction]) { |
| | | vehicle.line = special_directions[vehicle.direction]; |
| | | } |
| | |
| | | for(var i = 0, il = all_departures.length; i < il; i++) { |
| | | tr = document.createElement('tr'); |
| | | addCellWithText(tr, all_departures[i].actualTime || all_departures[i].plannedTime); |
| | | addCellWithText(tr, all_departures[i].stop_seq_num + '. ' + all_departures[i].stop.name); |
| | | addCellWithText(tr, all_departures[i].stop_seq_num + '. ' + normalizeName(all_departures[i].stop.name)); |
| | | |
| | | if(i >= data.old.length) { |
| | | stopsToMark.push('s' + ttss_type + all_departures[i].stop.id); |
| | |
| | | for(var i = 0, il = all_departures.length; i < il; i++) { |
| | | tr = document.createElement('tr'); |
| | | addCellWithText(tr, all_departures[i].patternText); |
| | | dir_cell = addCellWithText(tr, all_departures[i].direction); |
| | | dir_cell = addCellWithText(tr, normalizeName(all_departures[i].direction)); |
| | | vehicle = parseVehicle(all_departures[i].vehicleId); |
| | | dir_cell.appendChild(displayVehicle(vehicle)); |
| | | status = parseStatus(all_departures[i]); |
| | |
| | | var div = document.createElement('div'); |
| | | |
| | | var typeName; |
| | | var name = feature.get('name'); |
| | | var name = normalizeName(feature.get('name')); |
| | | var additional; |
| | | var table = document.createElement('table'); |
| | | var thead = document.createElement('thead'); |
| | |
| | | |
| | | addElementWithText(a, 'span', typeName).className = 'small'; |
| | | a.appendChild(document.createTextNode(' ')); |
| | | addElementWithText(a, 'span', feature.get('name')); |
| | | addElementWithText(a, 'span', normalizeName(feature.get('name'))); |
| | | |
| | | div.appendChild(p); |
| | | } |
New file |
| | |
| | | var seleniumServer = require('selenium-server'); |
| | | var chromedriver = require('chromedriver'); |
| | | var geckodriver = require('geckodriver'); |
| | | |
| | | module.exports = { |
| | | src_folders: ['tests'], |
| | | selenium: { |
| | | start_process: true, |
| | | server_path: seleniumServer.path, |
| | | port: 4444, |
| | | cli_args: { |
| | | 'webdriver.chrome.driver': chromedriver.path, |
| | | 'webdriver.gecko.driver': geckodriver.path, |
| | | }, |
| | | }, |
| | | test_settings: { |
| | | 'chrome': { |
| | | desiredCapabilities: { |
| | | browserName: 'chrome', |
| | | }, |
| | | }, |
| | | 'chrome-headless': { |
| | | desiredCapabilities: { |
| | | browserName: 'chrome', |
| | | chromeOptions: { |
| | | args: [ |
| | | '--headless', |
| | | '--no-sandbox', |
| | | '--disable-gpu', |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | 'firefox': { |
| | | desiredCapabilities: { |
| | | browserName: 'firefox', |
| | | }, |
| | | }, |
| | | 'firefox-headless': { |
| | | desiredCapabilities: { |
| | | browserName: 'firefox', |
| | | 'moz:firefoxOptions': { |
| | | args: [ |
| | | '--headless', |
| | | ], |
| | | }, |
| | | }, |
| | | }, |
| | | }, |
| | | }; |
| | |
| | | |
| | | return array_values($words); |
| | | } |
| | | |
| | | function normalize_name($string) { |
| | | return strtr(strtr($string, ['.' => '. ']), [' ' => ' ']); |
| | | } |
| | | |
| | | function normalize_name_cmp($string) { |
| | | return normalize_name(mb_strtolower($string, 'UTF-8')); |
| | | } |
| | |
| | | |
| | | // Build a structure for the UI |
| | | $stop_list = []; |
| | | $query_lower = mb_strtolower($_GET['query'], 'UTF-8'); |
| | | $query_lower = normalize_name_cmp($_GET['query']); |
| | | foreach($ids as $id) { |
| | | similar_text( |
| | | $letters = similar_text( |
| | | $query_lower, |
| | | mb_strtolower($stops[$id], 'UTF-8'), |
| | | normalize_name_cmp($stops[$id]), |
| | | $percent |
| | | ); |
| | | $percent += $letters * 100; |
| | | // -5 due to UTF-8 |
| | | if(substr($stops[$id], -5) == '(nż)' && !$find_ondemand) { |
| | | $percent /= 2; |
| | | } |
| | | $stop_list[] = [ |
| | | 'id' => $id, |
| | | 'name' => $stops[$id], |
| | | 'name' => normalize_name($stops[$id]), |
| | | 'type' => 'stop', |
| | | 'relevance' => $percent, |
| | | ]; |
New file |
| | |
| | | module.exports = { |
| | | 'Stop name autocompletion': function(browser) { |
| | | browser.url('http://127.0.0.1:8080/'); |
| | | browser.getTitle(function(title) { |
| | | this.assert.ok(title.includes('TTSS')); |
| | | }); |
| | | |
| | | var autocomplete_pairs = [ |
| | | ['baga', 'Teatr Bagatela'], |
| | | ['d g', 'Dworzec Główny'], |
| | | ['świę', 'Plac Wszystkich Świętych'], |
| | | ['św g', 'Św. Gertrudy'], |
| | | ['św.g', 'Św. Gertrudy'], |
| | | ]; |
| | | autocomplete_pairs.forEach(function(value) { |
| | | browser.clearValue('#stop-name'); |
| | | browser.setValue('#stop-name', value[0]); |
| | | browser.pause(200); |
| | | browser.expect.element('#stop-name-autocomplete > option:first-child').to.be.present.before(1000); |
| | | browser.expect.element('#stop-name-autocomplete > option:first-child').text.to.include(value[1]).before(1000); |
| | | }); |
| | | }, |
| | | 'Translation engine': function(browser) { |
| | | browser.url('http://127.0.0.1:8080/#!en'); |
| | | browser.pause(200); |
| | | browser.getTitle(function(title) { |
| | | this.assert.ok(title.includes('departures')); |
| | | }); |
| | | browser.expect.element('[data-translate=header_line]').text.to.include('Line'); |
| | | }, |
| | | }; |