mirror of
https://github.com/scratchfoundation/scratch-www.git
synced 2025-02-17 08:31:23 -05:00
add studios page integration tests
This commit is contained in:
parent
bf91904a33
commit
e485cf29de
1 changed files with 57 additions and 0 deletions
57
test/integration/studios-page.test.js
Normal file
57
test/integration/studios-page.test.js
Normal file
|
@ -0,0 +1,57 @@
|
|||
import SeleniumHelper from './selenium-helpers.js';
|
||||
|
||||
const {
|
||||
findByXpath,
|
||||
clickXpath,
|
||||
buildDriver
|
||||
} = new SeleniumHelper();
|
||||
|
||||
let remote = process.env.SMOKE_REMOTE || false;
|
||||
let rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
|
||||
let studioId = process.env.TEST_STUDIO_ID || 10004360;
|
||||
let studioUrl = rootUrl + '/studios/' + studioId;
|
||||
|
||||
if (remote){
|
||||
jest.setTimeout(60000);
|
||||
} else {
|
||||
jest.setTimeout(20000);
|
||||
}
|
||||
|
||||
let driver;
|
||||
|
||||
describe('studio page while signed out', () => {
|
||||
beforeAll(async () => {
|
||||
// expect(projectUrl).toBe(defined);
|
||||
driver = await buildDriver('www-integration studio-page signed out');
|
||||
await driver.get(rootUrl);
|
||||
});
|
||||
|
||||
beforeEach(async () => {
|
||||
await driver.get(studioUrl);
|
||||
let studioNav = await findByXpath('//div[@class="studio-tabs"]');
|
||||
await studioNav.isDisplayed();
|
||||
});
|
||||
|
||||
afterAll(async () => await driver.quit());
|
||||
|
||||
test('land on projects tab', async () => {
|
||||
await driver.get(studioUrl);
|
||||
let projectGrid = await findByXpath('//div[@class="studio-projects-grid"]');
|
||||
let projectGridDisplayed = await projectGrid.isDisplayed();
|
||||
await expect(projectGridDisplayed).toBe(true);
|
||||
});
|
||||
|
||||
test('studio title', async () => {
|
||||
let studioTitle = await findByXpath('//div[@class="studio-title"]');
|
||||
let titleText = await studioTitle.getText();
|
||||
await expect(titleText).toEqual('studio for automated testing');
|
||||
});
|
||||
|
||||
test('studio description', async () => {
|
||||
let xpath = '//div[contains(@class, "studio-description")]';
|
||||
let studioDescription = await findByXpath(xpath);
|
||||
let descriptionText = await studioDescription.getText();
|
||||
await expect(descriptionText).toEqual('a description');
|
||||
});
|
||||
|
||||
});
|
Loading…
Reference in a new issue