Page MenuHomeSoftware Heritage

D8463.id30506.diff
No OneTemporary

D8463.id30506.diff

diff --git a/cypress/e2e/add-forge-now-request-dashboard.cy.js b/cypress/e2e/add-forge-now-request-dashboard.cy.js
--- a/cypress/e2e/add-forge-now-request-dashboard.cy.js
+++ b/cypress/e2e/add-forge-now-request-dashboard.cy.js
@@ -89,19 +89,16 @@
describe('Test add forge now request dashboard load', function() {
- before(function() {
- // Create an add-forge-request object in the DB
- createDummyRequest(this.Urls);
- });
-
beforeEach(function() {
- const url = this.Urls.add_forge_now_request_dashboard(requestId);
- // request dashboard require admin permissions to view
- cy.adminLogin();
- cy.intercept(`${this.Urls.api_1_add_forge_request_get(requestId)}**`).as('forgeRequestGet');
- cy.visit(url);
- cy.get('.swh-add-forge-now-moderation-item')
- .should('have.class', 'active');
+ createDummyRequest(this.Urls).then(() => {
+ const url = this.Urls.add_forge_now_request_dashboard(requestId);
+ // request dashboard require admin permissions to view
+ cy.adminLogin();
+ cy.intercept(`${this.Urls.api_1_add_forge_request_get(requestId)}**`).as('forgeRequestGet');
+ cy.visit(url);
+ cy.get('.swh-add-forge-now-moderation-item')
+ .should('have.class', 'active');
+ });
});
it('should load add forge request details', function() {
diff --git a/cypress/e2e/add-forge-now-requests-moderation.cy.js b/cypress/e2e/add-forge-now-requests-moderation.cy.js
--- a/cypress/e2e/add-forge-now-requests-moderation.cy.js
+++ b/cypress/e2e/add-forge-now-requests-moderation.cy.js
@@ -7,21 +7,18 @@
const defaultRedirect = '/login/';
-let addForgeModerationUrl;
-let listAddForgeRequestsUrl;
-
function logout() {
cy.contains('a', 'logout')
.click();
}
describe('Test "Add Forge Now" moderation Login/logout', function() {
- before(function() {
- addForgeModerationUrl = this.Urls.add_forge_now_requests_moderation();
+ beforeEach(function() {
+ this.addForgeModerationUrl = this.Urls.add_forge_now_requests_moderation();
});
it('should redirect to default page', function() {
- cy.visit(addForgeModerationUrl)
+ cy.visit(this.addForgeModerationUrl)
.get('input[name="username"]')
.type('admin')
.get('input[name="password"]')
@@ -30,62 +27,62 @@
.submit();
cy.location('pathname')
- .should('be.equal', addForgeModerationUrl);
+ .should('be.equal', this.addForgeModerationUrl);
});
it('should redirect to correct page after login', function() {
- cy.visit(addForgeModerationUrl)
+ cy.visit(this.addForgeModerationUrl)
.location('pathname')
.should('be.equal', defaultRedirect);
cy.adminLogin();
- cy.visit(addForgeModerationUrl)
+ cy.visit(this.addForgeModerationUrl)
.location('pathname')
- .should('be.equal', addForgeModerationUrl);
+ .should('be.equal', this.addForgeModerationUrl);
logout();
});
it('should not display moderation link in sidebar when anonymous', function() {
- cy.visit(addForgeModerationUrl);
- cy.get(`.sidebar a[href="${addForgeModerationUrl}"]`)
+ cy.visit(this.addForgeModerationUrl);
+ cy.get(`.sidebar a[href="${this.addForgeModerationUrl}"]`)
.should('not.exist');
});
it('should not display moderation link when connected as unprivileged user', function() {
cy.userLogin();
- cy.visit(addForgeModerationUrl);
+ cy.visit(this.addForgeModerationUrl);
- cy.get(`.sidebar a[href="${addForgeModerationUrl}"]`)
+ cy.get(`.sidebar a[href="${this.addForgeModerationUrl}"]`)
.should('not.exist');
});
it('should display moderation link in sidebar when connected as privileged user', function() {
cy.addForgeModeratorLogin();
- cy.visit(addForgeModerationUrl);
+ cy.visit(this.addForgeModerationUrl);
- cy.get(`.sidebar a[href="${addForgeModerationUrl}"]`)
+ cy.get(`.sidebar a[href="${this.addForgeModerationUrl}"]`)
.should('exist');
});
it('should display moderation link in sidebar when connected as staff member', function() {
cy.adminLogin();
- cy.visit(addForgeModerationUrl);
+ cy.visit(this.addForgeModerationUrl);
- cy.get(`.sidebar a[href="${addForgeModerationUrl}"]`)
+ cy.get(`.sidebar a[href="${this.addForgeModerationUrl}"]`)
.should('exist');
});
});
describe('Test "Add Forge Now" moderation listing', function() {
- before(function() {
- addForgeModerationUrl = this.Urls.add_forge_now_requests_moderation();
- listAddForgeRequestsUrl = this.Urls.add_forge_request_list_datatables();
+ beforeEach(function() {
+ this.addForgeModerationUrl = this.Urls.add_forge_now_requests_moderation();
+ this.listAddForgeRequestsUrl = this.Urls.add_forge_request_list_datatables();
});
it('should list add-forge-now requests', function() {
- cy.intercept(`${listAddForgeRequestsUrl}**`, {fixture: 'add-forge-now-requests'}).as('listRequests');
+ cy.intercept(`${this.listAddForgeRequestsUrl}**`, {fixture: 'add-forge-now-requests'}).as('listRequests');
let expectedRequests;
cy.readFile('cypress/fixtures/add-forge-now-requests.json').then((result) => {
@@ -93,7 +90,7 @@
});
cy.addForgeModeratorLogin();
- cy.visit(addForgeModerationUrl);
+ cy.visit(this.addForgeModerationUrl);
cy.get('.swh-add-forge-now-moderation-item')
.should('have.class', 'active');
diff --git a/cypress/e2e/admin.cy.js b/cypress/e2e/admin.cy.js
--- a/cypress/e2e/admin.cy.js
+++ b/cypress/e2e/admin.cy.js
@@ -9,20 +9,18 @@
const defaultRedirect = '/';
-let url;
-
function logout() {
cy.contains('a', 'logout')
.click();
}
describe('Test Admin Login/logout', function() {
- before(function() {
- url = this.Urls.login();
+ beforeEach(function() {
+ this.url = this.Urls.login();
});
it('should redirect to default page', function() {
- cy.visit(url)
+ cy.visit(this.url)
.get('input[name="username"]')
.type('admin')
.get('input[name="password"]')
@@ -38,7 +36,7 @@
it('should display admin-origin-save and deposit in sidebar', function() {
cy.adminLogin();
- cy.visit(url);
+ cy.visit(this.url);
cy.get(`.sidebar a[href="${this.Urls.admin_origin_save_requests()}"]`)
.should('be.visible');
@@ -51,7 +49,7 @@
it('should display username on top-right', function() {
cy.adminLogin();
- cy.visit(url);
+ cy.visit(this.url);
cy.get('.swh-position-right')
.should('contain', 'admin');
@@ -64,12 +62,12 @@
expect(win.swh.webapp.isUserLoggedIn()).to.be.false;
});
cy.adminLogin();
- cy.visit(url);
+ cy.visit(this.url);
cy.window().then(win => {
expect(win.swh.webapp.isUserLoggedIn()).to.be.true;
});
logout();
- cy.visit(url);
+ cy.visit(this.url);
cy.window().then(win => {
expect(win.swh.webapp.isUserLoggedIn()).to.be.false;
});

File Metadata

Mime Type
text/plain
Expires
Thu, Jan 30, 2:44 PM (7 h, 38 m ago)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3231143

Event Timeline