mirror of
https://github.com/AppFlowy-IO/AppFlowy-Web.git
synced 2025-12-02 12:27:54 +08:00
chore: fix test
This commit is contained in:
@@ -1,10 +1,10 @@
|
|||||||
|
import { AuthTestUtils } from '../../support/auth-utils';
|
||||||
import {
|
import {
|
||||||
AddPageSelectors,
|
AddPageSelectors,
|
||||||
DatabaseGridSelectors,
|
|
||||||
CheckboxSelectors,
|
CheckboxSelectors,
|
||||||
|
DatabaseGridSelectors,
|
||||||
waitForReactUpdate
|
waitForReactUpdate
|
||||||
} from '../../support/selectors';
|
} from '../../support/selectors';
|
||||||
import { AuthTestUtils } from '../../support/auth-utils';
|
|
||||||
import { generateRandomEmail } from '../../support/test-config';
|
import { generateRandomEmail } from '../../support/test-config';
|
||||||
|
|
||||||
describe('Checkbox Column Type', () => {
|
describe('Checkbox Column Type', () => {
|
||||||
@@ -69,6 +69,7 @@ describe('Checkbox Column Type', () => {
|
|||||||
cy.log('[STEP 10] No checkbox cells found, cell interaction test completed');
|
cy.log('[STEP 10] No checkbox cells found, cell interaction test completed');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
});
|
||||||
|
|
||||||
cy.log('[STEP 12] Test completed successfully');
|
cy.log('[STEP 12] Test completed successfully');
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
import { AuthTestUtils } from '../../support/auth-utils';
|
import { AuthTestUtils } from '../../support/auth-utils';
|
||||||
import { TestTool } from '../../support/page-utils';
|
import { TestTool } from '../../support/page-utils';
|
||||||
import { PageSelectors, ModalSelectors, SidebarSelectors, TrashSelectors, waitForReactUpdate } from '../../support/selectors';
|
import { ModalSelectors, PageSelectors, SidebarSelectors, TrashSelectors, waitForReactUpdate } from '../../support/selectors';
|
||||||
import { generateRandomEmail, logAppFlowyEnvironment } from '../../support/test-config';
|
import { generateRandomEmail, logAppFlowyEnvironment } from '../../support/test-config';
|
||||||
import { testLog } from '../../support/test-helpers';
|
import { testLog } from '../../support/test-helpers';
|
||||||
|
|
||||||
@@ -241,13 +241,20 @@ describe('Delete Page, Verify in Trash, and Restore Tests', () => {
|
|||||||
// Step 9: Verify the page is removed from trash
|
// Step 9: Verify the page is removed from trash
|
||||||
testLog.info('=== Step 9: Verifying page is removed from trash ===');
|
testLog.info('=== Step 9: Verifying page is removed from trash ===');
|
||||||
|
|
||||||
|
// Wait a bit for the UI to update after restore
|
||||||
|
cy.wait(2000);
|
||||||
|
|
||||||
// Check if trash is now empty or doesn't contain our page
|
// Check if trash is now empty or doesn't contain our page
|
||||||
TrashSelectors.rows().then($rows => {
|
// Use a more defensive approach - check if rows exist first
|
||||||
const rowsExist = $rows.length > 0;
|
cy.get('body').then($body => {
|
||||||
|
// Check if trash table rows exist
|
||||||
|
const rowsExist = $body.find('[data-testid="trash-table-row"]').length > 0;
|
||||||
|
|
||||||
if (!rowsExist) {
|
if (!rowsExist) {
|
||||||
testLog.info('✓ Trash is now empty - page successfully removed from trash');
|
testLog.info('✓ Trash is now empty - page successfully removed from trash');
|
||||||
} else {
|
} else {
|
||||||
|
// Rows still exist, check if our page is among them
|
||||||
|
TrashSelectors.rows().then($rows => {
|
||||||
let pageStillInTrash = false;
|
let pageStillInTrash = false;
|
||||||
|
|
||||||
$rows.each((index, row) => {
|
$rows.each((index, row) => {
|
||||||
@@ -262,6 +269,7 @@ describe('Delete Page, Verify in Trash, and Restore Tests', () => {
|
|||||||
} else {
|
} else {
|
||||||
testLog.info(`✓ Page "${restoredPageName}" successfully removed from trash`);
|
testLog.info(`✓ Page "${restoredPageName}" successfully removed from trash`);
|
||||||
}
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -15,12 +15,26 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
testEmail = generateRandomEmail();
|
testEmail = generateRandomEmail();
|
||||||
|
|
||||||
|
// Handle uncaught exceptions
|
||||||
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found') ||
|
||||||
|
err.message.includes('Failed to execute \'writeText\' on \'Clipboard\': Document is not focused') ||
|
||||||
|
err.name === 'NotAllowedError') {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
it('publish page, copy URL, open in browser, unpublish, and verify inaccessible', () => {
|
it('publish page, copy URL, open in browser, unpublish, and verify inaccessible', () => {
|
||||||
// Handle uncaught exceptions during workspace creation
|
// Handle uncaught exceptions during workspace creation
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -71,7 +85,7 @@ describe('Publish Page Test', () => {
|
|||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
|
|
||||||
// Verify that the page is now published by checking for published UI elements
|
// Verify that the page is now published by checking for published UI elements
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
testLog.info('Page published successfully, URL elements visible');
|
testLog.info('Page published successfully, URL elements visible');
|
||||||
|
|
||||||
// 6. Get the published URL by constructing it from UI elements
|
// 6. Get the published URL by constructing it from UI elements
|
||||||
@@ -79,8 +93,8 @@ describe('Publish Page Test', () => {
|
|||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
|
|
||||||
// Get namespace and publish name from the UI
|
// Get namespace and publish name from the UI
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible').invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().should('be.visible').invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).should('be.visible').invoke('val').then((publishName) => {
|
ShareSelectors.publishNameInput().should('be.visible').invoke('val').then((publishName) => {
|
||||||
const namespaceText = namespace.trim();
|
const namespaceText = namespace.trim();
|
||||||
const publishNameText = String(publishName).trim();
|
const publishNameText = String(publishName).trim();
|
||||||
const publishedUrl = `${origin}/${namespaceText}/${publishNameText}`;
|
const publishedUrl = `${origin}/${namespaceText}/${publishNameText}`;
|
||||||
@@ -91,7 +105,7 @@ describe('Publish Page Test', () => {
|
|||||||
// Located in a div with class "p-1 text-text-primary" next to the URL container
|
// Located in a div with class "p-1 text-text-primary" next to the URL container
|
||||||
ShareSelectors.sharePopover().within(() => {
|
ShareSelectors.sharePopover().within(() => {
|
||||||
// Find the parent container that holds both URL inputs and copy button
|
// Find the parent container that holds both URL inputs and copy button
|
||||||
cy.get(ShareSelectors.publishNameInput())
|
ShareSelectors.publishNameInput()
|
||||||
.closest('div.flex.w-full.items-center.overflow-hidden')
|
.closest('div.flex.w-full.items-center.overflow-hidden')
|
||||||
.find('div.p-1.text-text-primary')
|
.find('div.p-1.text-text-primary')
|
||||||
.should('be.visible')
|
.should('be.visible')
|
||||||
@@ -236,7 +250,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('publish page and use Visit Site button to open URL', () => {
|
it('publish page and use Visit Site button to open URL', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -263,13 +279,13 @@ describe('Publish Page Test', () => {
|
|||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
|
|
||||||
// Verify published
|
// Verify published
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
|
|
||||||
// Get the published URL
|
// Get the published URL
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible').invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().should('be.visible').invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).should('be.visible').invoke('val').then((publishName) => {
|
ShareSelectors.publishNameInput().should('be.visible').invoke('val').then((publishName) => {
|
||||||
const publishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
const publishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
||||||
testLog.info(`Published URL: ${publishedUrl}`);
|
testLog.info(`Published URL: ${publishedUrl}`);
|
||||||
|
|
||||||
@@ -291,7 +307,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('publish page, edit publish name, and verify new URL works', () => {
|
it('publish page, edit publish name, and verify new URL works', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -315,20 +333,20 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
|
|
||||||
// Get original URL
|
// Get original URL
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
cy.get(ShareSelectors.publishNamespace()).invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((originalName) => {
|
ShareSelectors.publishNameInput().invoke('val').then((originalName) => {
|
||||||
const namespaceText = namespace.trim();
|
const namespaceText = namespace.trim();
|
||||||
const originalNameText = String(originalName).trim();
|
const originalNameText = String(originalName).trim();
|
||||||
testLog.info(`Original publish name: ${originalNameText}`);
|
testLog.info(`Original publish name: ${originalNameText}`);
|
||||||
|
|
||||||
// Edit the publish name directly in the input
|
// Edit the publish name directly in the input
|
||||||
const newPublishName = `custom-name-${Date.now()}`;
|
const newPublishName = `custom-name-${Date.now()}`;
|
||||||
cy.get(ShareSelectors.publishNameInput())
|
ShareSelectors.publishNameInput()
|
||||||
.clear()
|
.clear()
|
||||||
.type(newPublishName)
|
.type(newPublishName)
|
||||||
.blur();
|
.blur();
|
||||||
@@ -352,7 +370,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('publish, modify content, republish, and verify content changes', () => {
|
it('publish, modify content, republish, and verify content changes', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -397,14 +417,14 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
testLog.info('✓ First publish successful');
|
testLog.info('✓ First publish successful');
|
||||||
|
|
||||||
// Get published URL
|
// Get published URL
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
cy.get(ShareSelectors.publishNamespace()).invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((publishName) => {
|
ShareSelectors.publishNameInput().invoke('val').then((publishName) => {
|
||||||
const publishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
const publishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
||||||
testLog.info(`Published URL: ${publishedUrl}`);
|
testLog.info(`Published URL: ${publishedUrl}`);
|
||||||
|
|
||||||
@@ -458,7 +478,7 @@ describe('Publish Page Test', () => {
|
|||||||
// Republish with updated content
|
// Republish with updated content
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
testLog.info('✓ Republished successfully');
|
testLog.info('✓ Republished successfully');
|
||||||
|
|
||||||
// Verify updated content is published
|
// Verify updated content is published
|
||||||
@@ -477,7 +497,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('test publish name validation - invalid characters', () => {
|
it('test publish name validation - invalid characters', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -501,14 +523,14 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
|
|
||||||
// Try to set invalid publish name with spaces
|
// Try to set invalid publish name with spaces
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((originalName) => {
|
ShareSelectors.publishNameInput().invoke('val').then((originalName) => {
|
||||||
testLog.info(`Original name: ${originalName}`);
|
testLog.info(`Original name: ${originalName}`);
|
||||||
|
|
||||||
// Try to set name with space (should be rejected)
|
// Try to set name with space (should be rejected)
|
||||||
cy.get(ShareSelectors.publishNameInput())
|
ShareSelectors.publishNameInput()
|
||||||
.clear()
|
.clear()
|
||||||
.type('invalid name with spaces')
|
.type('invalid name with spaces')
|
||||||
.blur();
|
.blur();
|
||||||
@@ -519,7 +541,7 @@ describe('Publish Page Test', () => {
|
|||||||
cy.get('body').then(($body) => {
|
cy.get('body').then(($body) => {
|
||||||
const bodyText = $body.text();
|
const bodyText = $body.text();
|
||||||
// The name should either revert or show an error
|
// The name should either revert or show an error
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((currentName) => {
|
ShareSelectors.publishNameInput().invoke('val').then((currentName) => {
|
||||||
// Name should not contain spaces (validation should prevent it)
|
// Name should not contain spaces (validation should prevent it)
|
||||||
if (String(currentName).includes(' ')) {
|
if (String(currentName).includes(' ')) {
|
||||||
testLog.info('⚠ Warning: Invalid characters were not rejected');
|
testLog.info('⚠ Warning: Invalid characters were not rejected');
|
||||||
@@ -534,7 +556,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('test publish settings - toggle comments and duplicate switches', () => {
|
it('test publish settings - toggle comments and duplicate switches', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -558,7 +582,7 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
|
|
||||||
// Test comments switch - find by looking for Switch components in the published panel
|
// Test comments switch - find by looking for Switch components in the published panel
|
||||||
ShareSelectors.sharePopover().within(() => {
|
ShareSelectors.sharePopover().within(() => {
|
||||||
@@ -566,7 +590,7 @@ describe('Publish Page Test', () => {
|
|||||||
// Look for the container divs that have the text labels
|
// Look for the container divs that have the text labels
|
||||||
cy.get('div.flex.items-center.justify-between').contains(/comments|comment/i).parent().within(() => {
|
cy.get('div.flex.items-center.justify-between').contains(/comments|comment/i).parent().within(() => {
|
||||||
cy.get('input[type="checkbox"]').then(($checkbox) => {
|
cy.get('input[type="checkbox"]').then(($checkbox) => {
|
||||||
const initialCommentsState = $checkbox.is(':checked');
|
const initialCommentsState = ($checkbox[0] as HTMLInputElement).checked;
|
||||||
testLog.info(`Initial comments state: ${initialCommentsState}`);
|
testLog.info(`Initial comments state: ${initialCommentsState}`);
|
||||||
|
|
||||||
// Toggle comments by clicking the switch
|
// Toggle comments by clicking the switch
|
||||||
@@ -574,7 +598,7 @@ describe('Publish Page Test', () => {
|
|||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
|
|
||||||
cy.get('input[type="checkbox"]').then(($checkboxAfter) => {
|
cy.get('input[type="checkbox"]').then(($checkboxAfter) => {
|
||||||
const newCommentsState = $checkboxAfter.is(':checked');
|
const newCommentsState = ($checkboxAfter[0] as HTMLInputElement).checked;
|
||||||
testLog.info(`Comments state after toggle: ${newCommentsState}`);
|
testLog.info(`Comments state after toggle: ${newCommentsState}`);
|
||||||
expect(newCommentsState).to.not.equal(initialCommentsState);
|
expect(newCommentsState).to.not.equal(initialCommentsState);
|
||||||
testLog.info('✓ Comments switch toggled successfully');
|
testLog.info('✓ Comments switch toggled successfully');
|
||||||
@@ -585,7 +609,7 @@ describe('Publish Page Test', () => {
|
|||||||
// Test duplicate switch
|
// Test duplicate switch
|
||||||
cy.get('div.flex.items-center.justify-between').contains(/duplicate|template/i).parent().within(() => {
|
cy.get('div.flex.items-center.justify-between').contains(/duplicate|template/i).parent().within(() => {
|
||||||
cy.get('input[type="checkbox"]').then(($checkbox) => {
|
cy.get('input[type="checkbox"]').then(($checkbox) => {
|
||||||
const initialDuplicateState = $checkbox.is(':checked');
|
const initialDuplicateState = ($checkbox[0] as HTMLInputElement).checked;
|
||||||
testLog.info(`Initial duplicate state: ${initialDuplicateState}`);
|
testLog.info(`Initial duplicate state: ${initialDuplicateState}`);
|
||||||
|
|
||||||
// Toggle duplicate
|
// Toggle duplicate
|
||||||
@@ -593,7 +617,7 @@ describe('Publish Page Test', () => {
|
|||||||
cy.wait(2000);
|
cy.wait(2000);
|
||||||
|
|
||||||
cy.get('input[type="checkbox"]').then(($checkboxAfter) => {
|
cy.get('input[type="checkbox"]').then(($checkboxAfter) => {
|
||||||
const newDuplicateState = $checkboxAfter.is(':checked');
|
const newDuplicateState = ($checkboxAfter[0] as HTMLInputElement).checked;
|
||||||
testLog.info(`Duplicate state after toggle: ${newDuplicateState}`);
|
testLog.info(`Duplicate state after toggle: ${newDuplicateState}`);
|
||||||
expect(newDuplicateState).to.not.equal(initialDuplicateState);
|
expect(newDuplicateState).to.not.equal(initialDuplicateState);
|
||||||
testLog.info('✓ Duplicate switch toggled successfully');
|
testLog.info('✓ Duplicate switch toggled successfully');
|
||||||
@@ -606,7 +630,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('publish page multiple times - verify URL remains consistent', () => {
|
it('publish page multiple times - verify URL remains consistent', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -632,13 +658,13 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
ShareSelectors.publishConfirmButton().should('be.visible').click({ force: true });
|
||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
|
|
||||||
// Get first URL
|
// Get first URL
|
||||||
cy.window().then((win) => {
|
cy.window().then((win) => {
|
||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
cy.get(ShareSelectors.publishNamespace()).invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((publishName) => {
|
ShareSelectors.publishNameInput().invoke('val').then((publishName) => {
|
||||||
firstPublishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
firstPublishedUrl = `${origin}/${namespace.trim()}/${String(publishName).trim()}`;
|
||||||
testLog.info(`First published URL: ${firstPublishedUrl}`);
|
testLog.info(`First published URL: ${firstPublishedUrl}`);
|
||||||
|
|
||||||
@@ -651,9 +677,9 @@ describe('Publish Page Test', () => {
|
|||||||
cy.contains('Publish').should('exist').click({ force: true });
|
cy.contains('Publish').should('exist').click({ force: true });
|
||||||
cy.wait(1000);
|
cy.wait(1000);
|
||||||
|
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
cy.get(ShareSelectors.publishNamespace()).invoke('text').then((namespace2) => {
|
ShareSelectors.publishNamespace().invoke('text').then((namespace2) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).invoke('val').then((publishName2) => {
|
ShareSelectors.publishNameInput().invoke('val').then((publishName2) => {
|
||||||
const secondPublishedUrl = `${origin}/${namespace2.trim()}/${String(publishName2).trim()}`;
|
const secondPublishedUrl = `${origin}/${namespace2.trim()}/${String(publishName2).trim()}`;
|
||||||
testLog.info(`Second check URL: ${secondPublishedUrl}`);
|
testLog.info(`Second check URL: ${secondPublishedUrl}`);
|
||||||
|
|
||||||
@@ -669,7 +695,9 @@ describe('Publish Page Test', () => {
|
|||||||
|
|
||||||
it('publish database (To-dos) and visit published link', () => {
|
it('publish database (To-dos) and visit published link', () => {
|
||||||
cy.on('uncaught:exception', (err: Error) => {
|
cy.on('uncaught:exception', (err: Error) => {
|
||||||
if (err.message.includes('No workspace or service found')) {
|
if (err.message.includes('No workspace or service found') ||
|
||||||
|
err.message.includes('createThemeNoVars_default is not a function') ||
|
||||||
|
err.message.includes('View not found')) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
@@ -750,7 +778,7 @@ describe('Publish Page Test', () => {
|
|||||||
cy.wait(5000);
|
cy.wait(5000);
|
||||||
|
|
||||||
// Verify that the database is now published by checking for published UI elements
|
// Verify that the database is now published by checking for published UI elements
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible', { timeout: 10000 });
|
ShareSelectors.publishNamespace().should('be.visible', { timeout: 10000 });
|
||||||
testLog.info('Database published successfully, URL elements visible');
|
testLog.info('Database published successfully, URL elements visible');
|
||||||
|
|
||||||
// Get the published URL
|
// Get the published URL
|
||||||
@@ -758,8 +786,8 @@ describe('Publish Page Test', () => {
|
|||||||
const origin = win.location.origin;
|
const origin = win.location.origin;
|
||||||
|
|
||||||
// Get namespace and publish name from the UI
|
// Get namespace and publish name from the UI
|
||||||
cy.get(ShareSelectors.publishNamespace()).should('be.visible').invoke('text').then((namespace) => {
|
ShareSelectors.publishNamespace().should('be.visible').invoke('text').then((namespace) => {
|
||||||
cy.get(ShareSelectors.publishNameInput()).should('be.visible').invoke('val').then((publishName) => {
|
ShareSelectors.publishNameInput().should('be.visible').invoke('val').then((publishName) => {
|
||||||
const namespaceText = namespace.trim();
|
const namespaceText = namespace.trim();
|
||||||
const publishNameText = String(publishName).trim();
|
const publishNameText = String(publishName).trim();
|
||||||
const publishedUrl = `${origin}/${namespaceText}/${publishNameText}`;
|
const publishedUrl = `${origin}/${namespaceText}/${publishNameText}`;
|
||||||
|
|||||||
Reference in New Issue
Block a user