scratch-www/test/integration/homepage-rows.test.js

57 lines
1.9 KiB
JavaScript
Raw Normal View History

// these tests do not sign in as a user
const SeleniumHelper = require('./selenium-helpers.js');
const {
clickXpath,
findByXpath,
buildDriver
} = new SeleniumHelper();
const rootUrl = process.env.ROOT_URL || 'https://scratch.ly';
2021-12-03 09:14:25 -05:00
jest.setTimeout(60000);
let driver;
describe('www-integration project rows', () => {
beforeAll(async () => {
driver = await buildDriver('www-integration project rows');
// driver.get(rootUrl);
});
beforeEach(async () => {
await driver.get(rootUrl);
});
afterAll(() => driver.quit());
test('Featured Projects row title', async () => {
const projects = await findByXpath('//div[@class="box"]/div[@class="box-header"]/h4');
const projectsText = await projects.getText();
expect(projectsText).toEqual('Featured Projects');
});
test('Featured Project link', async () => {
await clickXpath('//div[@class="box"][descendant::text()="Featured Projects"]' +
'//div[contains(@class, "thumbnail")][1]/a[@class="thumbnail-image"]');
const guiPlayer = await findByXpath('//div[@class="guiPlayer"]');
const guiPlayerDisplayed = await guiPlayer.isDisplayed();
expect(guiPlayerDisplayed).toBe(true);
});
test('Featured Studios row title', async () => {
const studios = await findByXpath('//div[@class="box"][2]/div[@class="box-header"]/h4');
const studiosText = await studios.getText();
expect(studiosText).toEqual('Featured Studios');
});
test('Featured Studios link', async () => {
await clickXpath('//div[@class="box"][descendant::text()="Featured Studios"]' +
'//div[contains(@class, "thumbnail")][1]/a[@class="thumbnail-image"]');
const studioInfo = await findByXpath('//div[contains(@class, "studio-info")]');
const studioInfoDisplayed = await studioInfo.isDisplayed();
expect(studioInfoDisplayed).toBe(true);
});
});