chore(tests): clean up browser tests by splitting out federation UI tests

This commit is contained in:
Gabe Kangas 2024-11-15 18:39:15 -08:00
parent 8fa2546bef
commit 56d52c283c
11 changed files with 86 additions and 46 deletions

View file

@ -4,6 +4,7 @@ const { lighthouse, prepareAudit } = require('@cypress-audit/lighthouse');
module.exports = defineConfig({
projectId: 'wwi3xe',
e2e: {
supportFile: 'cypress/support/e2e.js',
setupNodeEvents(on, config) {
on('before:browser:launch', (browser = {}, launchOptions) => {
prepareAudit(launchOptions);

View file

@ -0,0 +1,34 @@
// describe('Lighthouse Metrics', () => {
// beforeEach(() => {
// cy.visit('http://localhost:8080');
// });
// it('Capture Metrics', () => {
// cy.lighthouse({
// accessibility: 97,
// 'best-practices': 90,
// seo: 90,
// performance: 0, // Once the performance issues are fixed revert this 90,
// });
// });
// });
import fetchData from '../../support/fetchData.js';
// Alternatively you can use CommonJS syntax:
// require('./commands')
console.log('------------- support/e2e.js');
// Put Owncast in a state where it's ready to be tested.
// Set server URL
fetchData('http://localhost:8080/api/admin/config/serverurl', {
method: 'POST',
data: { value: 'https://testing.biz' },
});
// Enable Fediverse features.
fetchData('http://localhost:8080/api/admin/config/federation/enable', {
method: 'POST',
data: { value: true },
});

View file

@ -1,14 +0,0 @@
// describe('Lighthouse Metrics', () => {
// beforeEach(() => {
// cy.visit('http://localhost:8080');
// });
// it('Capture Metrics', () => {
// cy.lighthouse({
// accessibility: 97,
// 'best-practices': 90,
// seo: 90,
// performance: 0, // Once the performance issues are fixed revert this 90,
// });
// });
// });

View file

@ -6,13 +6,6 @@ describe(`Basic tests`, () => {
cy.visit('http://localhost:8080/');
});
// Offline banner
it('Has correct offline banner values', () => {
cy.contains(
'This stream is offline. You can be notified the next time New Owncast Server goes live or follow streamer@testing.biz on the Fediverse.'
).should('exist');
});
// Verify the tags show up
it('Has correct tags visible', () => {
cy.contains('#owncast').should('exist');
@ -31,10 +24,6 @@ describe(`Basic tests`, () => {
// cy.get('.ant-modal-close').click();
// });
it('Can change to Followers tab', () => {
cy.contains('Followers').click();
});
// Verify content header values
it('Has correct content header values', () => {
cy.get('.header-title').should('have.text', 'New Owncast Server');

View file

@ -15,7 +15,6 @@ const identifiers = [
'#offline-banner', // The entire offline banner component
'#custom-page-content', // The entire custom page content component
'#notify-button', // The notify button
'#follow-button', // The follow button
];
filterTests(['desktop'], () => {
@ -31,13 +30,6 @@ filterTests(['desktop'], () => {
});
});
// Followers
const followersCollection = '#followers-collection';
it(`Has identifier: ${followersCollection}`, () => {
cy.contains('Followers').click();
cy.get(followersCollection).should('be.visible');
});
// Modal
const modalContainer = '#modal-container';
it(`Has identifier ${modalContainer}`, () => {

View file

@ -1,5 +1,5 @@
import { setup } from '../../support/setup.js';
import filterTests from '../../support/filterTests';
import filterTests from '../../support/filterTests.js';
setup();

View file

@ -0,0 +1,44 @@
// TODO: Fire API call to enable federation and set domain, and stream username.
import fetchData from '../../support/fetchData.js';
describe('Fediverse tests', () => {
// Enable Fediverse features.
before(() => {
fetchData('http://localhost:8080/api/admin/config/serverurl', {
method: 'POST',
data: { value: 'https://testing.biz' },
});
fetchData('http://localhost:8080/api/admin/config/federation/enable', {
method: 'POST',
data: { value: true },
});
});
it('Can visit the page', () => {
cy.visit('http://localhost:8080/');
cy.reload(true);
});
// Offline banner
it('Has correct offline banner values', () => {
cy.contains(
'This stream is offline. You can be notified the next time New Owncast Server goes live or follow streamer@testing.biz on the Fediverse.'
).should('exist');
});
// Followers
const followersCollection = '#followers-collection';
it(`Has identifier: ${followersCollection}`, () => {
cy.contains('Followers').click();
cy.get(followersCollection).should('be.visible');
});
it(`Has identifier: #follow-button`, () => {
cy.get('#follow-button').should('exist');
});
it('Can change to Followers tab', () => {
cy.contains('Followers').click();
});
});

View file

@ -20,16 +20,10 @@ import fetchData from './fetchData.js';
// Alternatively you can use CommonJS syntax:
// require('./commands')
// Put Owncast in a state where it's ready to be tested.
// Set server URL
fetchData('http://localhost:8080/api/admin/config/serverurl', {
method: 'POST',
data: { value: 'https://testing.biz' },
});
// Enable Fediverse features.
fetchData('http://localhost:8080/api/admin/config/federation/enable', {
method: 'POST',
data: { value: true },
before(() => {
// Set server URL
fetchData('http://localhost:8080/api/admin/config/serverurl', {
method: 'POST',
data: { value: 'https://testing.biz' },
});
});