mirror of
https://github.com/xuthus83/pigallery2.git
synced 2024-11-03 21:04:03 +08:00
Fix sharing e2e tests #744
This commit is contained in:
parent
9265638c5c
commit
4d7e7fe161
@ -1,5 +1,5 @@
|
||||
describe('Share', () => {
|
||||
it('Open password protected sharing', () => {
|
||||
beforeEach(() => {
|
||||
cy.viewport(1200, 600);
|
||||
cy.visit('/');
|
||||
cy.get('.card-body');
|
||||
@ -10,10 +10,11 @@ describe('Share', () => {
|
||||
cy.get('#password').type('admin');
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
url: '/pgapi/gallery/content/',
|
||||
}).as('getContent');
|
||||
cy.get('.col-sm-12 > .btn').click();
|
||||
|
||||
});
|
||||
it('Open password protected sharing', () => {
|
||||
cy.wait('@getContent');
|
||||
|
||||
cy.get('button#shareButton').click();
|
||||
@ -27,6 +28,11 @@ describe('Share', () => {
|
||||
cy.get('button.btn-close').click();
|
||||
cy.get('button#button-frame-menu').click();
|
||||
cy.get('#dropdown-frame-menu ng-icon[name="ionLogOutOutline"]').click({scrollBehavior: false});
|
||||
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
}).as('getSharedContent');
|
||||
cy.visit(link);
|
||||
cy.get('input#password').type('secret');
|
||||
cy.get('button#button-share-login').click();
|
||||
@ -34,28 +40,15 @@ describe('Share', () => {
|
||||
|
||||
cy.get('.mb-0 > :nth-child(1) > .nav-link').contains('Gallery');
|
||||
|
||||
cy.wait('@getContent').then((interception) => {
|
||||
cy.wait('@getSharedContent').then((interception) => {
|
||||
assert.isNotNull(interception.response.body, '1st API call has data');
|
||||
assert.isNull(interception.response.body?.error, '1st API call has data');
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
it('Open password protected sharing with logged in user', () => {
|
||||
cy.viewport(1200, 600);
|
||||
cy.visit('/');
|
||||
cy.get('.card-body');
|
||||
cy.get('.col-sm-12').contains('Login');
|
||||
/* ==== Generated with Cypress Studio ==== */
|
||||
cy.get('#username').type('admin');
|
||||
cy.get('#password').clear();
|
||||
cy.get('#password').type('admin');
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
}).as('getContent');
|
||||
cy.get('.col-sm-12 > .btn').click();
|
||||
|
||||
cy.wait('@getContent');
|
||||
|
||||
cy.get('button#shareButton').click();
|
||||
@ -66,13 +59,19 @@ describe('Share', () => {
|
||||
cy.get('input#shareLink')
|
||||
.invoke('val')
|
||||
.then((link: string) => {
|
||||
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
}).as('getSharedContent');
|
||||
cy.visit(link);
|
||||
|
||||
|
||||
cy.get('.mb-0 > :nth-child(1) > .nav-link').contains('Gallery');
|
||||
|
||||
cy.wait('@getContent').then((interception) => {
|
||||
cy.wait('@getSharedContent').then((interception) => {
|
||||
assert.isNotNull(interception.response.body, '1st API call has data');
|
||||
assert.isNull(interception.response.body?.error, '1st API call has data');
|
||||
});
|
||||
});
|
||||
|
||||
@ -80,20 +79,6 @@ describe('Share', () => {
|
||||
|
||||
|
||||
it('Open no password sharing', () => {
|
||||
cy.viewport(1200, 600);
|
||||
cy.visit('/');
|
||||
cy.get('.card-body');
|
||||
cy.get('.col-sm-12').contains('Login');
|
||||
/* ==== Generated with Cypress Studio ==== */
|
||||
cy.get('#username').type('admin');
|
||||
cy.get('#password').clear();
|
||||
cy.get('#password').type('admin');
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
}).as('getContent');
|
||||
cy.get('.col-sm-12 > .btn').click();
|
||||
|
||||
cy.wait('@getContent');
|
||||
|
||||
cy.get('button#shareButton').click();
|
||||
@ -106,13 +91,20 @@ describe('Share', () => {
|
||||
cy.get('button.btn-close').click();
|
||||
cy.get('button#button-frame-menu').click();
|
||||
cy.get('#dropdown-frame-menu ng-icon[name="ionLogOutOutline"]').click({scrollBehavior: false});
|
||||
|
||||
|
||||
cy.intercept({
|
||||
method: 'Get',
|
||||
url: '/pgapi/gallery/content/*',
|
||||
}).as('getSharedContent');
|
||||
cy.visit(link);
|
||||
|
||||
|
||||
cy.get('.mb-0 > :nth-child(1) > .nav-link').contains('Gallery');
|
||||
|
||||
cy.wait('@getContent').then((interception) => {
|
||||
cy.wait('@getSharedContent').then((interception) => {
|
||||
assert.isNotNull(interception.response.body, '1st API call has data');
|
||||
assert.isNull(interception.response.body?.error, '1st API call has data');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user