Skip to content

Commit

Permalink
nightwatchjs#289 Bug Fixed
Browse files Browse the repository at this point in the history
@garg3133 Review Requested.

I have been investigating to find any hard-coded redirect but there are none and entire docs have been updated with `/guide`.

Afterwards, I found that there is if-else logic running for "See Also" section at, `nightwatch-docs/src/includes/api-method.ejs`

In that, the line, `<li><code><a href="<%- appSettings.baseUrl.replace(/\/$/, '') -%>/api/<%- link.split('.').join('/') %>.html"><%= link %></a></code></li>` generates link accordingly.

Now, after many workarounds, I cannot seem to budge the extra two dots that, `appSettings.baseUrl.replace(/\$/,'')` is appending after ".org" domain.

I tried:
[-] Slicing after replace with (0,-2), but instead of removing double dots, it gives out: https://nightwatchjs.o../<other-parts-of-url>
[-] Writing new logic: Gives out same result

I found that, replace() method is creating the problems. Simply removing it, works. Additionally, I added "/" in the BASE_URL in postdoc config.

Do tell me if this is not right, or should I seek another way to solve the problem?
  • Loading branch information
ParmarKrishna committed Mar 26, 2024
1 parent 178074e commit 4315a7e
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
3 changes: 1 addition & 2 deletions postdoc.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import {sep, join, basename, resolve, extname} from 'node:path';

const {
NIGHTWATCH_VERSION = '3.5.0',
BASE_URL = 'https://nightwatchjs.org',
BASE_URL = 'https://nightwatchjs.org/',
MD_DOCS_FOLDER = './docs',
API_DOCS_FOLDER = resolve('../nightwatch/lib/api'),
EXAMPLES_FOLDER = 'node_modules/nightwatch-examples/tests'
Expand All @@ -16,7 +16,6 @@ export default {

]
},

session: {
enable_prefetch: false,
disable_spa: false
Expand Down
2 changes: 1 addition & 1 deletion src/includes/api-method.ejs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ npx nightwatch <%- method.exampleLink %></code></pre>
<% if (link.startsWith('http')) { %>
<li><code><a href="<%- link %>"><%= link %></a></code></li>
<% } else { %>
<li><code><a href="<%- appSettings.baseUrl.replace(/\/$/, '') -%>/api/<%- link.split('.').join('/') %>.html"><%= link %></a></code></li>
<li><code><a href="<%- appSettings.baseUrl -%>/api/<%- link.split('.').join('/') %>.html"><%= link %></a></code></li>
<% } %>
<% } %>
</ul>
Expand Down

0 comments on commit 4315a7e

Please sign in to comment.