-
Notifications
You must be signed in to change notification settings - Fork 675
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added relative urls for Role constructor (#8018)
## Purpose Can't specify relative login page URLs in the Role constructor ## Approach Role's url check has been moved to before initialization function. If configuration file or cli command include parameter "baseUrl", user can use relative urls in Role constructor. ## References [issues 8012](#8012)
- Loading branch information
1 parent
31b97c1
commit 4897fbc
Showing
8 changed files
with
70 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
test/functional/fixtures/api/es-next/roles/testcafe-fixtures/role-with-baseurl-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { Role, ClientFunction } from 'testcafe'; | ||
|
||
fixture `Roles with absolute/relative "loginUrl"`; | ||
|
||
const getLocation = ClientFunction(() => document.location.toString()); | ||
|
||
const roleAbs = Role('http://localhost:3000/fixtures/api/es-next/roles/pages/index.html', async t => { | ||
await t.expect(getLocation()).eql('http://localhost:3000/fixtures/api/es-next/roles/pages/index.html'); | ||
}, { preserveUrl: true }); | ||
|
||
const roleRel = Role('./fixtures/api/es-next/roles/pages/index.html', async t => { | ||
await t.expect(getLocation()).eql('http://localhost:3000/fixtures/api/es-next/roles/pages/index.html'); | ||
}, { preserveUrl: true }); | ||
|
||
test('Should throw error in role initializer without baseUrl and with relative path Role', async t => { | ||
await t.useRole(roleRel); | ||
}); | ||
|
||
test('Use role with relative path and baseUrl', async t => { | ||
await t.useRole(roleRel); | ||
}); | ||
|
||
test('Use role with absolute path and baseUrl', async t => { | ||
await t.useRole(roleAbs); | ||
}); |