accounts-frontend/tests-e2e/cypress/integration/dev/user.test.ts

43 lines
1.2 KiB
TypeScript
Raw Normal View History

2019-12-07 16:58:52 +05:30
/// <reference types="cypress" />
describe('/dev/applications - user', () => {
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 }) => {
const apps = await oauthApi.getAppsByUser(user.id);
await Promise.all(apps.map(app => oauthApi.delete(app.clientId)));
});
});
});
// TODO: test the first screen is without any list rendered
// TODO: test validation
it('should add website app', () => {
cy.visit('/dev/applications');
cy.get('[data-e2e="noApps"]').should('exist');
cy.get('[data-e2e="newApp"]').click();
cy.url().should('include', '/dev/applications/new');
cy.get('[value="application"]').check({ force: true });
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');
cy.get('[type="submit"]').click();
cy.url().should('include', '/dev/applications#the-foo');
cy.get('[data-e2e-app-name="The Foo"]').should('exist');
});
});