mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-25 07:25:22 -07:00
tests
This commit is contained in:
parent
4114c2356a
commit
de9cdf2984
5 changed files with 1300 additions and 442 deletions
|
@ -29,7 +29,7 @@ export default defineConfig({
|
||||||
// Add test environment flags
|
// Add test environment flags
|
||||||
isCI: process.env.CI === 'true',
|
isCI: process.env.CI === 'true',
|
||||||
// Add API base URL
|
// Add API base URL
|
||||||
apiBaseUrl: 'http://localhost:5000/api/v1'
|
apiBaseUrl: 'http://localhost:3577/api/v1'
|
||||||
},
|
},
|
||||||
|
|
||||||
// Project configuration
|
// Project configuration
|
||||||
|
@ -66,7 +66,7 @@ export default defineConfig({
|
||||||
},
|
},
|
||||||
|
|
||||||
// Base configuration
|
// Base configuration
|
||||||
baseUrl: 'http://localhost:5000',
|
baseUrl: 'http://localhost:3577',
|
||||||
specPattern: [
|
specPattern: [
|
||||||
'cypress/tests/**/*.spec.ts*',
|
'cypress/tests/**/*.spec.ts*',
|
||||||
'cypress/features/**/*.feature'
|
'cypress/features/**/*.feature'
|
||||||
|
|
|
@ -28,7 +28,7 @@ export abstract class BasePage {
|
||||||
* Scroll to element with smooth behavior
|
* Scroll to element with smooth behavior
|
||||||
*/
|
*/
|
||||||
scrollToElement(selector: string): Cypress.Chainable<any> {
|
scrollToElement(selector: string): Cypress.Chainable<any> {
|
||||||
return cy.get(selector).scrollIntoView({ behavior: 'smooth' });
|
return cy.get(selector).scrollIntoView();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -74,6 +74,7 @@ export abstract class BasePage {
|
||||||
* Log page action for debugging
|
* Log page action for debugging
|
||||||
*/
|
*/
|
||||||
logAction(action: string, details?: any): void {
|
logAction(action: string, details?: any): void {
|
||||||
cy.log(`[${this.constructor.name}] ${action}`, details);
|
// Use console.log instead of cy.log to avoid promise/cy command mixing
|
||||||
|
console.log(`[${this.constructor.name}] ${action}`, details);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,11 +43,11 @@ Cypress.Commands.add('loginWithCreds', (username: string, password: string) => {
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status === 200) {
|
||||||
window.localStorage.setItem('id_token', resp.body.access_token);
|
window.localStorage.setItem('id_token', resp.body.access_token);
|
||||||
cy.log(`Successfully logged in as ${username}`);
|
|
||||||
} else {
|
|
||||||
cy.log(`Login failed for ${username}: ${resp.status}`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Log outside of the promise chain
|
||||||
|
cy.log(`Login attempt for user: ${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enhanced default login
|
// Enhanced default login
|
||||||
|
@ -75,10 +75,7 @@ Cypress.Commands.add('removeLogin', () => {
|
||||||
// Enhanced notification verification with better error handling
|
// Enhanced notification verification with better error handling
|
||||||
Cypress.Commands.add('verifyNotification', (text: string) => {
|
Cypress.Commands.add('verifyNotification', (text: string) => {
|
||||||
cy.contains(text, { timeout: 10000 })
|
cy.contains(text, { timeout: 10000 })
|
||||||
.should('be.visible')
|
.should('be.visible');
|
||||||
.then(() => {
|
|
||||||
cy.log(`Notification "${text}" verified successfully`);
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enhanced user creation with better error handling
|
// Enhanced user creation with better error handling
|
||||||
|
@ -101,12 +98,14 @@ Cypress.Commands.add('createUser', (username: string, password: string, claims:
|
||||||
},
|
},
|
||||||
failOnStatusCode: false
|
failOnStatusCode: false
|
||||||
}).then((resp) => {
|
}).then((resp) => {
|
||||||
if (resp.status === 200) {
|
if (resp.status !== 200) {
|
||||||
cy.log(`User ${username} created successfully`);
|
// Use console.log instead of cy.log inside promise
|
||||||
} else {
|
console.log(`Failed to create user ${username}: ${resp.status}`);
|
||||||
cy.log(`Failed to create user ${username}: ${resp.status}`);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// Log outside of the promise chain
|
||||||
|
cy.log(`Creating user: ${username}`);
|
||||||
});
|
});
|
||||||
|
|
||||||
// Enhanced unique ID generation
|
// Enhanced unique ID generation
|
||||||
|
@ -146,7 +145,7 @@ Cypress.Commands.add('waitForApiResponse', (alias: string, timeout: number = 100
|
||||||
Cypress.Commands.add('clearTestData', () => {
|
Cypress.Commands.add('clearTestData', () => {
|
||||||
cy.clearLocalStorage();
|
cy.clearLocalStorage();
|
||||||
cy.clearCookies();
|
cy.clearCookies();
|
||||||
cy.clearSessionStorage();
|
cy.clearAllSessionStorage();
|
||||||
cy.log('All test data cleared');
|
cy.log('All test data cleared');
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -154,21 +153,12 @@ Cypress.Commands.add('clearTestData', () => {
|
||||||
Cypress.Commands.add('seedTestData', (fixture: string) => {
|
Cypress.Commands.add('seedTestData', (fixture: string) => {
|
||||||
cy.fixture(fixture).then((data) => {
|
cy.fixture(fixture).then((data) => {
|
||||||
// Implementation depends on your seeding strategy
|
// Implementation depends on your seeding strategy
|
||||||
cy.log(`Seeding test data from ${fixture}`);
|
|
||||||
// Example: cy.request('POST', '/api/v1/test/seed', data);
|
// Example: cy.request('POST', '/api/v1/test/seed', data);
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
// Override visit command to add better logging
|
// Log outside of the promise chain
|
||||||
Cypress.Commands.overwrite('visit', (originalFn, url, options) => {
|
cy.log(`Seeding test data from ${fixture}`);
|
||||||
cy.log(`Visiting: ${url}`);
|
|
||||||
return originalFn(url, options);
|
|
||||||
});
|
|
||||||
|
|
||||||
// Override click command to add better logging
|
|
||||||
Cypress.Commands.overwrite('click', (originalFn, subject, options) => {
|
|
||||||
cy.log(`Clicking element: ${subject.selector || 'unknown'}`);
|
|
||||||
return originalFn(subject, options);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -67,7 +67,7 @@ describe("TV Details Buttons", () => {
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
it.only("Issues Enabled", () => {
|
it("Issues Enabled", () => {
|
||||||
cy.intercept("GET", "**/Settings/issuesenabled", 'true').as('issuesEnabled');
|
cy.intercept("GET", "**/Settings/issuesenabled", 'true').as('issuesEnabled');
|
||||||
|
|
||||||
cy.visit("/details/tv/1399");
|
cy.visit("/details/tv/1399");
|
||||||
|
|
1691
tests/yarn.lock
1691
tests/yarn.lock
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue