Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP] Enable goto to URLs matching 'about:<*>' #2376

Merged
merged 5 commits into from
Apr 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/taiko.js
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ module.exports.goto = async (
options = { navigationTimeout: defaultConfig.navigationTimeout },
) => {
validate();
if (!/:\/\//i.test(url)) {
if (!/^about:|:\/\//i.test(url)) {
url = 'http://' + url;
}
if (options.headers) {
Expand Down
14 changes: 14 additions & 0 deletions test/unit-tests/goto.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,20 @@ describe(test_name, () => {
expect(actualUrl).to.equal(expectedUrl);
});

it('should not add protocol http:// if url is "about:*"', async () => {
let aboutBlank = 'about:randomString';
let expectedUrl = aboutBlank;
await taiko.goto(aboutBlank);
expect(actualUrl).to.equal(expectedUrl);
});

it('should add protocol http:// for url with port specified', async () => {
let urlWithPort = 'localhost:8080';
let expectedUrl = 'http://' + urlWithPort;
await taiko.goto(urlWithPort);
expect(actualUrl).to.equal(expectedUrl);
});

it('should configure provided headers for the domain', async () => {
let options = {
headers: { Authorization: 'Basic cG9zdG1hbjpwYXNzd29y2A==' },
Expand Down