mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-14 18:47:15 -07:00
More tests around the requests grid
This commit is contained in:
parent
b6ce223acd
commit
5ef8aff677
11 changed files with 235 additions and 13 deletions
|
@ -1,6 +1,7 @@
|
|||
{
|
||||
"$schema": "https://on.cypress.io/cypress.schema.json",
|
||||
"supportFile": "cypress/support/index.ts",
|
||||
"baseUrl": "http://localhost:3577",
|
||||
"integrationFolder": "cypress/tests",
|
||||
"testFiles": "**/*.spec.ts*",
|
||||
"retries": {
|
||||
|
@ -8,10 +9,11 @@
|
|||
"openMode": 1
|
||||
},
|
||||
"watchForFileChanges": true,
|
||||
"projectId": "o5451s",
|
||||
"viewportWidth": 2560,
|
||||
"viewportHeight": 1440,
|
||||
"chromeWebSecurity": false,
|
||||
"ignoreTestFiles": ["**/snapshots/*"],
|
||||
"screenshotOnRunFailure": false,
|
||||
"video": false,
|
||||
"reporter": "junit",
|
||||
"reporterOptions": {
|
||||
"mochaFile": "results/junit/regression-[hash].xml"
|
||||
|
|
|
@ -32,7 +32,6 @@ Cypress.Commands.add("landingSettings", (enabled) => {
|
|||
})
|
||||
|
||||
Cypress.Commands.add('login', (username, password) => {
|
||||
cy.clearLocalStorage();
|
||||
cy.request({
|
||||
method: 'POST',
|
||||
url: '/api/v1/token',
|
||||
|
@ -88,4 +87,16 @@ Cypress.Commands.add('generateUniqueId', () => {
|
|||
const uniqueSeed = Date.now().toString();
|
||||
const id = Cypress._.uniqueId(uniqueSeed);
|
||||
return id;
|
||||
});
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getByData", (selector, ...args) => {
|
||||
return cy.get(`[data-test=${selector}]`, ...args);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getByData", (selector) => {
|
||||
return cy.get(`[data-test=${selector}]`);
|
||||
});
|
||||
|
||||
Cypress.Commands.add("getByDataLike", (selector) => {
|
||||
return cy.get(`[data-test*=${selector}]`);
|
||||
});
|
169
tests/cypress/tests/details/tv/tvdetails-requests-grid.spec.ts
Normal file
169
tests/cypress/tests/details/tv/tvdetails-requests-grid.spec.ts
Normal file
|
@ -0,0 +1,169 @@
|
|||
describe("TV Requests Grid", function () {
|
||||
beforeEach(() => {
|
||||
cy.login();
|
||||
});
|
||||
|
||||
it("Season not available", () => {
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.getByData("classStatus1").should("not.have.class", "available");
|
||||
cy.getByData("classStatus1").should("not.have.class", "requested");
|
||||
cy.getByData("classStatus1").should("not.have.class", "approved");
|
||||
|
||||
cy.getByData("masterCheckbox1").should("be.visible");
|
||||
cy.getByDataLike("episodeCheckbox1").each((element) => {
|
||||
expect(element.length).to.be.greaterThan(0);
|
||||
});
|
||||
});
|
||||
|
||||
it("Season is requested", () => {
|
||||
cy.intercept("GET", "**/v2/search/Tv/121361", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const requests = body.seasonRequests[0].episodes;
|
||||
requests.forEach((req) => {
|
||||
req.requested = true;
|
||||
req.approved = false;
|
||||
req.requestStatus = "Common.PendingApproval";
|
||||
});
|
||||
body.seasonRequests[0].episodes = requests;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("detailsResponse");
|
||||
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.wait("@detailsResponse");
|
||||
|
||||
cy.getByData("classStatus1").should("not.have.class", "available");
|
||||
cy.getByData("classStatus1").should("have.class", "requested");
|
||||
cy.getByData("classStatus1").should("not.have.class", "approved");
|
||||
|
||||
// checkboxes
|
||||
cy.getByData("masterCheckbox1").should("not.exist");
|
||||
cy.getByDataLike("episodeCheckbox1").should("not.exist");
|
||||
|
||||
cy.getByDataLike("episodeStatus1").each((element) => {
|
||||
expect(element.hasClass("requested")).to.be.true;
|
||||
expect(element.text()).contain('Pending Approval');
|
||||
});
|
||||
});
|
||||
|
||||
it("Season is approved", () => {
|
||||
cy.intercept("GET", "**/v2/search/Tv/121361", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const requests = body.seasonRequests[0].episodes;
|
||||
requests.forEach((req) => {
|
||||
req.approved = true;
|
||||
req.requested = true;
|
||||
req.requestStatus = "Common.Approved";
|
||||
});
|
||||
body.seasonRequests[0].episodes = requests;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("detailsResponse");
|
||||
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.wait("@detailsResponse");
|
||||
|
||||
cy.getByData("classStatus1").should("not.have.class", "available");
|
||||
cy.getByData("classStatus1").should("not.have.class", "requested");
|
||||
cy.getByData("classStatus1").should("have.class", "approved");
|
||||
|
||||
// checkboxes
|
||||
cy.getByData("masterCheckbox1").should("not.exist");
|
||||
cy.getByDataLike("episodeCheckbox1").should("not.exist");
|
||||
|
||||
cy.getByDataLike("episodeStatus1").each((element) => {
|
||||
expect(element.hasClass("approved")).to.be.true;
|
||||
expect(element.text()).contain('Approved');
|
||||
});
|
||||
});
|
||||
|
||||
it("Season is available", () => {
|
||||
cy.intercept("GET", "**/v2/search/Tv/121361", (req) => {
|
||||
req.reply((res) => {
|
||||
const body = res.body;
|
||||
const requests = body.seasonRequests[0].episodes;
|
||||
requests.forEach((req) => {
|
||||
req.available = true;
|
||||
req.requestStatus = "Common.Available";
|
||||
});
|
||||
body.seasonRequests[0].episodes = requests;
|
||||
res.send(body);
|
||||
});
|
||||
}).as("detailsResponse");
|
||||
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.wait("@detailsResponse");
|
||||
|
||||
cy.getByData("classStatus1").should("have.class", "available");
|
||||
cy.getByData("classStatus1").should("not.have.class", "requested");
|
||||
cy.getByData("classStatus1").should("not.have.class", "approved");
|
||||
|
||||
// checkboxes
|
||||
cy.getByData("masterCheckbox1").should("not.exist");
|
||||
cy.getByDataLike("episodeCheckbox1").should("not.exist");
|
||||
|
||||
cy.getByDataLike("episodeStatus1").each((element) => {
|
||||
expect(element.hasClass("available")).to.be.true;
|
||||
expect(element.text()).contain('Available');
|
||||
});
|
||||
});
|
||||
|
||||
it("Request no episodes", () => {
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.get('#addFabBtn').click();
|
||||
cy.get('#requestSelected').click();
|
||||
|
||||
cy.verifyNotification('You need to select some episodes!');
|
||||
});
|
||||
|
||||
it("Request single episodes", () => {
|
||||
cy.visit("/details/tv/121361");
|
||||
const episodeCheckbox = 'episodeCheckbox11';
|
||||
|
||||
cy.getByData(episodeCheckbox).click();
|
||||
cy.get('#addFabBtn').click();
|
||||
cy.get('#requestSelected').click();
|
||||
|
||||
cy.verifyNotification('Request for Game of Thrones has been added successfully');
|
||||
|
||||
cy.getByData('episodeStatus11')
|
||||
.should('contain.text', 'Pending Approval')
|
||||
.should('have.class', 'requested')
|
||||
});
|
||||
|
||||
|
||||
it("Request First Season", () => {
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.get('#addFabBtn').click();
|
||||
cy.get('#requestFirst').click();
|
||||
|
||||
cy.verifyNotification('Request for Game of Thrones has been added successfully');
|
||||
|
||||
cy.getByDataLike('episodeStatus1')
|
||||
.should('contain.text', 'Pending Approval')
|
||||
.should('have.class', 'requested')
|
||||
});
|
||||
|
||||
it.only("Request Latest Season", () => {
|
||||
cy.visit("/details/tv/121361");
|
||||
|
||||
cy.get('#addFabBtn').click();
|
||||
cy.get('#requestLatest').click();
|
||||
|
||||
cy.verifyNotification('Request for Game of Thrones has been added successfully');
|
||||
|
||||
cy.getByData("classStatus8").click();
|
||||
cy.getByData("classStatus8").should("have.class", "requested");
|
||||
cy.getByDataLike('episodeStatus8')
|
||||
.should('contain.text', 'Pending Approval')
|
||||
.should('have.class', 'requested')
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue