parent
6afde20b96
commit
5e75daa732
@ -0,0 +1,44 @@
|
||||
import { onBeforeLoad } from './browser-language';
|
||||
|
||||
beforeEach(() => {
|
||||
cy.clearLocalStorage();
|
||||
cy.checkoutSession();
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
cy.dropSession();
|
||||
});
|
||||
|
||||
describe('Events', () => {
|
||||
it('Shows my current events', () => {
|
||||
const EVENT = { title: 'My first event'};
|
||||
|
||||
cy.loginUser();
|
||||
cy.visit('/events/me', { onBeforeLoad });
|
||||
cy.contains('.message.is-danger', 'No events found');
|
||||
cy.contains('.navbar-item', 'Create').click();
|
||||
|
||||
cy.url().should('include', 'create');
|
||||
cy.get('.field').first().find('input').type(EVENT.title);
|
||||
cy.get('.field').eq(1).find('input').type('my tag, holo{enter}');
|
||||
cy.get('.field').eq(2).find('.datepicker .dropdown-trigger').click();
|
||||
|
||||
cy.get('.field').eq(3).find('.pagination-list .control').first().find('.select select').select('September');
|
||||
cy.get('.field').eq(3).find('.pagination-list .control').last().find('.select select').select('2021');
|
||||
cy.wait(1000);
|
||||
cy.get('.field').eq(3).contains('.datepicker-cell', '15').click();
|
||||
|
||||
cy.contains('.button.is-primary', 'Create my event').click();
|
||||
cy.url().should('include', '/events/');
|
||||
cy.contains('.title', EVENT.title);
|
||||
cy.contains('.title-and-informations span small', 'You\'re the only one going to this event');
|
||||
cy.contains('.date-and-privacy', 'On Wednesday, September 15, 2021 from');
|
||||
cy.contains('.visibility .tag', 'Public event');
|
||||
|
||||
cy.contains('.navbar-item', 'My events').click();
|
||||
cy.contains('.title', EVENT.title);
|
||||
cy.contains('.content.column', 'You\'re organizing this event');
|
||||
cy.contains('.title-wrapper .date-component .datetime-container .month', 'Sep');
|
||||
cy.contains('.title-wrapper .date-component .datetime-container .day', '15');
|
||||
});
|
||||
});
|
@ -0,0 +1,57 @@
|
||||
defmodule EndToEndSeed do
|
||||
alias Mobilizon.Users
|
||||
|
||||
def delete_user(email) do
|
||||
with {:ok, user} <- Users.get_user_by_email(email) do
|
||||
Users.delete_user(user)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
alias Mobilizon.Users
|
||||
alias Mobilizon.Users.User
|
||||
alias Mobilizon.Actors
|
||||
alias Mobilizon.Actors.Actor
|
||||
|
||||
if Application.get_env(:mobilizon, :env) != :e2e do
|
||||
exit(:shutdown)
|
||||
end
|
||||
|
||||
# An user that has just been registered
|
||||
test_user_unconfirmed = %{email: "unconfirmed@email.com", password: "some password"}
|
||||
|
||||
# An user that has registered and has confirmed their account, but no attached identity
|
||||
test_user_confirmed = %{email: "confirmed@email.com", password: "some password"}
|
||||
|
||||
# An user that has registered and has confirmed their account, with a profile
|
||||
test_user = %{email: "user@email.com", password: "some password"}
|
||||
test_actor = %{preferred_username: "test_user", name: "I'm a test user", domain: nil}
|
||||
|
||||
EndToEndSeed.delete_user(test_user_unconfirmed.email)
|
||||
EndToEndSeed.delete_user(test_user_confirmed.email)
|
||||
EndToEndSeed.delete_user(test_user.email)
|
||||
|
||||
{:ok, %User{} = _user_unconfirmed} = Users.register(test_user_unconfirmed)
|
||||
|
||||
{:ok, %User{} = user_confirmed} = Users.register(test_user_confirmed)
|
||||
|
||||
Users.update_user(user_confirmed, %{
|
||||
"confirmed_at" => Timex.shift(user_confirmed.confirmation_sent_at, hours: -3),
|
||||
"confirmation_sent_at" => nil,
|
||||
"confirmation_token" => nil
|
||||
})
|
||||
|
||||
{:ok, %User{} = user} = Users.register(test_user)
|
||||
|
||||
Users.update_user(user, %{
|
||||
"confirmed_at" => Timex.shift(user.confirmation_sent_at, hours: -3),
|
||||
"confirmation_sent_at" => nil,
|
||||
"confirmation_token" => nil
|
||||
})
|
||||
|
||||
{:ok, %Actor{}} =
|
||||
Actors.new_person(%{
|
||||
user_id: user.id,
|
||||
preferred_username: test_actor.preferred_username,
|
||||
name: test_actor.name
|
||||
})
|
Loading…
Reference in new issue