Skip to content
Snippets Groups Projects
Commit b739493c authored by Ray Schamp's avatar Ray Schamp Committed by Paul Kaplan
Browse files

Test that the expected project URI is requested

parent 90228ad8
No related branches found
No related tags found
No related merge requests found
......@@ -44,6 +44,9 @@ class SeleniumHelper {
args.push('--headless');
}
chromeCapabilities.set('chromeOptions', {args});
chromeCapabilities.setLoggingPrefs({
performance: 'ALL'
});
this.driver = new webdriver.Builder()
.forBrowser('chrome')
.withCapabilities(chromeCapabilities)
......
......@@ -35,6 +35,14 @@ describe('player example', () => {
await clickXpath('//img[@title="Stop"]');
const logs = await getLogs();
await expect(logs).toEqual([]);
const projectRequests = await driver.manage().logs()
.get('performance')
.then(pLogs => pLogs.map(log => JSON.parse(log.message).message)
.filter(m => m.method === 'Network.requestWillBeSent')
.map(m => m.params.request.url)
.filter(url => url === 'https://projects.scratch.mit.edu/internalapi/project/96708228/get/')
);
await expect(projectRequests).toEqual(['https://projects.scratch.mit.edu/internalapi/project/96708228/get/']);
});
});
......@@ -58,6 +66,14 @@ describe('blocks example', () => {
await clickXpath('//img[@title="Stop"]');
const logs = await getLogs();
await expect(logs).toEqual([]);
const projectRequests = await driver.manage().logs()
.get('performance')
.then(pLogs => pLogs.map(log => JSON.parse(log.message).message)
.filter(m => m.method === 'Network.requestWillBeSent')
.map(m => m.params.request.url)
.filter(url => url === 'https://projects.scratch.mit.edu/internalapi/project/96708228/get/')
);
await expect(projectRequests).toEqual(['https://projects.scratch.mit.edu/internalapi/project/96708228/get/']);
});
test('Change categories', async () => {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment