2019-12-07 16:58:52 +05:30
|
|
|
/// <reference types="cypress" />
|
|
|
|
|
2018-11-10 14:33:47 +05:30
|
|
|
describe('/dev/applications - user', () => {
|
2019-11-27 14:33:32 +05:30
|
|
|
before(() => {
|
|
|
|
cy.login({ account: 'default' }).then(({ user }) => {
|
|
|
|
cy.visit('/dev/applications');
|
|
|
|
|
|
|
|
// remove all previousely added apps
|
2019-12-07 16:58:52 +05:30
|
|
|
cy.window().then(async (/** @type {any} */ { oauthApi }) => {
|
2019-11-27 14:33:32 +05:30
|
|
|
const apps = await oauthApi.getAppsByUser(user.id);
|
|
|
|
|
|
|
|
await Promise.all(apps.map(app => oauthApi.delete(app.clientId)));
|
|
|
|
});
|
2018-11-10 14:33:47 +05:30
|
|
|
});
|
2019-11-27 14:33:32 +05:30
|
|
|
});
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
// TODO: test the first screen is without any list rendered
|
|
|
|
// TODO: test validation
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
it('should add website app', () => {
|
|
|
|
cy.visit('/dev/applications');
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[data-e2e="noApps"]').should('exist');
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[data-e2e="newApp"]').click();
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.url().should('include', '/dev/applications/new');
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[value="application"]').check({ force: true });
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[name="name"]').type('The Foo');
|
|
|
|
cy.get('[name="description"]').type('The Foo Description');
|
|
|
|
cy.get('[name="websiteUrl"]').type('https://ely.by');
|
|
|
|
cy.get('[name="redirectUri"]').type('https://ely.by/the/redirect/uri');
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[type="submit"]').click();
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.url().should('include', '/dev/applications#the-foo');
|
2018-11-10 14:33:47 +05:30
|
|
|
|
2019-11-27 14:33:32 +05:30
|
|
|
cy.get('[data-e2e-app-name="The Foo"]').should('exist');
|
|
|
|
});
|
2018-11-10 14:33:47 +05:30
|
|
|
});
|