Skip to content

Take control over your live stream video by running it yourself. Streaming + chat out of the box.

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

Gabe Kangasf3edad089495
diff --git a/test/automated/browser/cypress.config.js b/test/automated/browser/cypress.config.js
index 91a67ffbfa..fe9c6abf97 100644
--- a/test/automated/browser/cypress.config.js
+++ b/test/automated/browser/cypress.config.js
@@ -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);
diff --git a/test/automated/browser/cypress/e2e/offline/00-offline_performance.cy.js b/test/automated/browser/cypress/e2e/offline/00-offline_performance.cy.js
new file mode 100644
index 0000000000..1ebd971eaf
--- /dev/null
+++ b/test/automated/browser/cypress/e2e/offline/00-offline_performance.cy.js
@@ -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 },
+});
diff --git a/test/automated/browser/cypress/e2e/offline/00_offline_performance.cy.js b/test/automated/browser/cypress/e2e/offline/00_offline_performance.cy.js
deleted file mode 100644
index 8fbe465e4c..0000000000
--- a/test/automated/browser/cypress/e2e/offline/00_offline_performance.cy.js
+++ /dev/null
@@ -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,
-// });
-// });
-// });
diff --git a/test/automated/browser/cypress/e2e/offline/01_offline_basic.cy.js b/test/automated/browser/cypress/e2e/offline/01-offline_basic.cy.js
similarity index 75%
rename from test/automated/browser/cypress/e2e/offline/01_offline_basic.cy.js
rename to test/automated/browser/cypress/e2e/offline/01-offline_basic.cy.js
index dc69b8a962..2f0e20fc14 100644
--- a/test/automated/browser/cypress/e2e/offline/01_offline_basic.cy.js
+++ b/test/automated/browser/cypress/e2e/offline/01-offline_basic.cy.js
@@ -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 [email protected] 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');
diff --git a/test/automated/browser/cypress/e2e/offline/02_offline_video_embed.cy.js b/test/automated/browser/cypress/e2e/offline/02-offline_video_embed.cy.js
similarity index 100%
rename from test/automated/browser/cypress/e2e/offline/02_offline_video_embed.cy.js
rename to test/automated/browser/cypress/e2e/offline/02-offline_video_embed.cy.js
diff --git a/test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js b/test/automated/browser/cypress/e2e/offline/03-offline_readwrite_chat_embed.cy.js
similarity index 100%
rename from test/automated/browser/cypress/e2e/offline/03_offline_readwrite_chat_embed.cy.js
rename to test/automated/browser/cypress/e2e/offline/03-offline_readwrite_chat_embed.cy.js
diff --git a/test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js b/test/automated/browser/cypress/e2e/offline/04-offline_readonly_chat_embed.cy.js
similarity index 100%
rename from test/automated/browser/cypress/e2e/offline/04_offline_readonly_chat_embed.cy.js
rename to test/automated/browser/cypress/e2e/offline/04-offline_readonly_chat_embed.cy.js
diff --git a/test/automated/browser/cypress/e2e/offline/05_offline_identifier_check.cy.js b/test/automated/browser/cypress/e2e/offline/05-offline_identifier_check.cy.js
similarity index 83%
rename from test/automated/browser/cypress/e2e/offline/05_offline_identifier_check.cy.js
rename to test/automated/browser/cypress/e2e/offline/05-offline_identifier_check.cy.js
index e1987ec1b3..ad2a86e879 100644
--- a/test/automated/browser/cypress/e2e/offline/05_offline_identifier_check.cy.js
+++ b/test/automated/browser/cypress/e2e/offline/05-offline_identifier_check.cy.js
@@ -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}`, () => {
diff --git a/test/automated/browser/cypress/e2e/offline/06_offline_mobile.cy.js b/test/automated/browser/cypress/e2e/offline/06-offline_mobile.cy.js
similarity index 85%
rename from test/automated/browser/cypress/e2e/offline/06_offline_mobile.cy.js
rename to test/automated/browser/cypress/e2e/offline/06-offline_mobile.cy.js
index 6ef309b81d..6859251e96 100644
--- a/test/automated/browser/cypress/e2e/offline/06_offline_mobile.cy.js
+++ b/test/automated/browser/cypress/e2e/offline/06-offline_mobile.cy.js
@@ -1,5 +1,5 @@
import { setup } from '../../support/setup.js';
-import filterTests from '../../support/filterTests';
+import filterTests from '../../support/filterTests.js';
setup();
diff --git a/test/automated/browser/cypress/e2e/offline/07-offline_enabled_fediverse.cy.js b/test/automated/browser/cypress/e2e/offline/07-offline_enabled_fediverse.cy.js
new file mode 100644
index 0000000000..4c310aeb36
--- /dev/null
+++ b/test/automated/browser/cypress/e2e/offline/07-offline_enabled_fediverse.cy.js
@@ -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 [email protected] 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();
+ });
+});
diff --git a/test/automated/browser/cypress/support/e2e.js b/test/automated/browser/cypress/support/e2e.js
index bbad3483f3..1b47aa493d 100644
--- a/test/automated/browser/cypress/support/e2e.js
+++ b/test/automated/browser/cypress/support/e2e.js
@@ -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' },
+ });
});