-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- refactored test code
- Loading branch information
Showing
10 changed files
with
258 additions
and
73 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
const ReloadablePage = require('./ReloadablePage'); | ||
class AdminToolsPage extends ReloadablePage { | ||
|
||
url = browser.options.testConfig.baseUrl + "/admin/tools"; | ||
|
||
async open() { | ||
await browser.url(this.url); | ||
} | ||
async at () { | ||
let title = await browser.getTitle(); | ||
return /Tools | Admin/i.test(title); | ||
} | ||
|
||
get reindexButton () { return $('#btnReindexAll'); } | ||
get clearMetaDataCacheButton () { return $("#btnClearMetadataCache"); } | ||
|
||
async clearMetadata() { | ||
await this.clearMetaDataCacheButton.click(); | ||
} | ||
|
||
async reindex() { | ||
await browser.url(this.url) | ||
await this.reindexButton.click(); | ||
await this.hasBeenReloaded(); | ||
} | ||
|
||
async clearCache() { | ||
await this.clearMetadata(); | ||
} | ||
} | ||
|
||
module.exports = new AdminToolsPage(); |
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,37 @@ | ||
const StubbedCasSpec = require('./StubbedCasSpec.js') | ||
class PwaAppPage extends StubbedCasSpec { | ||
url = browser.options.testConfig.pwaUrl; | ||
|
||
get getStarted() { | ||
return $('#getStarted'); | ||
} | ||
|
||
async open() { | ||
await browser.url(this.url); | ||
} | ||
|
||
async at() { | ||
return /BioCollect PWA/i.test(await browser.getTitle()); | ||
} | ||
|
||
|
||
async saveToken() { | ||
await browser.execute(function () { | ||
return localStorage | ||
}); | ||
} | ||
|
||
async start() { | ||
await this.getStarted.click(); | ||
} | ||
|
||
async serviceWorkerReady() { | ||
return await browser.execute( async () => { | ||
return await navigator.serviceWorker.ready | ||
.then(() => {console.log("installed!"); return true}) | ||
.catch(() => {console.log("not installed!"); return false}); | ||
}); | ||
} | ||
} | ||
|
||
module.exports = new PwaAppPage(); |
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,45 @@ | ||
const StubbedCasSpec = require('./StubbedCasSpec.js') | ||
class ReloadablePage extends StubbedCasSpec { | ||
|
||
atCheckTime = 0 | ||
|
||
/** | ||
* Extends the standard at check to set a javascript variable that can later be | ||
* checked to detect a pageload. | ||
*/ | ||
async verifyAt() { | ||
let result = await this.at(); | ||
if (result) { | ||
await this.saveAtCheckTime() | ||
} | ||
return result | ||
} | ||
|
||
async saveAtCheckTime() { | ||
this.atCheckTime = Date.now().toString() | ||
let self = this; | ||
await browser.execute(() => { | ||
window.atCheckTime = self.atCheckTime; | ||
}); | ||
} | ||
|
||
async getAtCheckTime() { | ||
return await browser.execute(() => { | ||
return window.atCheckTime; | ||
}); | ||
} | ||
|
||
|
||
/** Returns true if the page has been reloaded since the most recent "at" check */ | ||
async hasBeenReloaded() { | ||
return browser.waitUntil(async() => { | ||
return ! await this.getAtCheckTime(); | ||
}, | ||
{ | ||
timeout: browser.options.testConfig.waitforTimeout, | ||
timeoutMsg: "Page did not reload after reindexing" | ||
}); | ||
} | ||
} | ||
|
||
module.exports = ReloadablePage; |
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
Oops, something went wrong.