Signed-off-by: Thomas Citharel <tcit@tcit.fr>
This commit is contained in:
Thomas Citharel 2019-11-18 13:26:08 +01:00
parent d1a9f06619
commit 163b361aba
No known key found for this signature in database
GPG Key ID: A061B9DDE0CA0773
12 changed files with 43 additions and 12 deletions

View File

@ -20,5 +20,9 @@ config :mobilizon, MobilizonWeb.Endpoint,
]
config :mobilizon, sql_sandbox: true
config :mobilizon, Oban, queues: false, prune: :disabled
config :mobilizon, Oban,
queues: false,
prune: :disabled
config :mobilizon, Mobilizon.Storage.Repo, pool: Ecto.Adapters.SQL.Sandbox

View File

@ -1,5 +1,5 @@
// https://docs.cypress.io/api/introduction/api.html
import { onBeforeLoad } from './browser-language';
import { onBeforeLoad } from '../support/browser-language';
describe('Homepage', () => {
it('Checks the footer', () => {

View File

@ -1,4 +1,4 @@
import { onBeforeLoad } from './browser-language';
import { onBeforeLoad } from '../support/browser-language';
beforeEach(() => {
cy.clearLocalStorage();
@ -29,6 +29,7 @@ describe('Events', () => {
cy.get('.field').eq(3).contains('.datepicker-cell', '15').click();
cy.contains('.button.is-primary', 'Create my event').click();
cy.drainQueues();
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');
@ -41,4 +42,4 @@ describe('Events', () => {
cy.contains('.title-wrapper .date-component .datetime-container .month', 'Sep');
cy.contains('.title-wrapper .date-component .datetime-container .day', '15');
});
});
});

View File

@ -1,4 +1,4 @@
import { onBeforeLoad } from './browser-language';
import { onBeforeLoad } from '../support/browser-language';
beforeEach(() => {
cy.clearLocalStorage();

View File

@ -1,4 +1,4 @@
import { onBeforeLoad } from './browser-language';
import { onBeforeLoad } from '../support/browser-language';
beforeEach(() => {
cy.checkoutSession();
@ -35,9 +35,16 @@ describe('Registration', () => {
cy.get('input[type=email]').type('user2register@email.com');
cy.get('input[type=password]').type('userPassword');
cy.get('form').contains('button.button.is-primary', 'Register').click();
console.log('click on register');
cy.wait(1500);
console.log('waited a little');
cy.drainQueues();
console.log('drained queues');
cy.url().should('include', '/register/profile');
console.log('url is ok');
cy.wait(1000);
console.log('finished waiting');
cy.get('form .field').first().contains('label', 'Username').parent().find('input').type('tester');
cy.get('form .field').eq(2).contains('label', 'Displayed name').parent().find('input').type('tester account');
cy.get('form .field').eq(3).contains('label', 'Description').parent().find('textarea').type('This is a test account');
@ -68,4 +75,4 @@ describe('Registration', () => {
cy.get('.navbar-link span.icon i').should('have.class', 'mdi-account-circle');
cy.contains('article.message.is-info', 'Welcome to Mobilizon, tester account!');
});
});
});

View File

@ -116,7 +116,15 @@ Cypress.Commands.add('dropSession', () => {
}
);
Cypress.Commands.add('drainQueues', async () => {
console.log('Drain queues');
const response = await fetch('/drain_queue', {
cache: 'no-store',
});
const responseText = await response.text();
//console.log(responseText);
});
const increaseFetches = () => {
const count = Cypress.env('fetchCount') || 0;
@ -179,10 +187,10 @@ const increaseFetches = () => {
})
}
})
})
});
Cypress.Commands.add(
'getInDocument',
{ prevSubject: 'document' },
(document, selector) => Cypress.$(selector, document)
)
);

View File

@ -179,9 +179,9 @@ defmodule Mobilizon.Events.Event do
defp put_tags(%Changeset{} = changeset, _), do: changeset
# We need a changeset instead of a raw struct because of slug which is generated in changeset
defp process_tag(%{id: _id} = tag), do: tag
# defp process_tag(%{id: _id} = tag), do: tag
# We need a changeset instead of a raw struct because of slug which is generated in changeset
defp process_tag(tag) do
Tag.changeset(%Tag{}, tag)
end

View File

@ -123,6 +123,7 @@ defmodule MobilizonWeb.Router do
if Mix.env() in [:dev, :e2e] do
# If using Phoenix
forward("/sent_emails", Bamboo.SentEmailViewerPlug)
get("/drain_queue", MobilizonWeb.E2EController, :drain_queue)
end
scope "/", MobilizonWeb do

View File

@ -44,6 +44,7 @@ defmodule Mobilizon.Mixfile do
# Specifies which paths to compile per environment.
defp elixirc_paths(:test), do: ["lib", "test/support"]
defp elixirc_paths(:dev), do: ["lib", "test/support/factory.ex"]
defp elixirc_paths(:e2e), do: ["lib", "test/support/E2EController.ex"]
defp elixirc_paths(_), do: ["lib"]
# Specifies your project dependencies.

View File

@ -88,7 +88,7 @@
"oban": {:hex, :oban, "0.10.1", "c2ca0a413fb66b21dd58c7cb67fd80b01e9d79a0fbb28573f110057e7fdc3807", [:mix], [{:ecto_sql, "~> 3.1", [hex: :ecto_sql, repo: "hexpm", optional: false]}, {:jason, "~> 1.1", [hex: :jason, repo: "hexpm", optional: false]}, {:postgrex, "~> 0.14", [hex: :postgrex, repo: "hexpm", optional: false]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
"parse_trans": {:hex, :parse_trans, "3.3.0", "09765507a3c7590a784615cfd421d101aec25098d50b89d7aa1d66646bc571c1", [:rebar3], [], "hexpm"},
"phoenix": {:hex, :phoenix, "1.4.10", "619e4a545505f562cd294df52294372d012823f4fd9d34a6657a8b242898c255", [:mix], [{:jason, "~> 1.0", [hex: :jason, repo: "hexpm", optional: true]}, {:phoenix_pubsub, "~> 1.1", [hex: :phoenix_pubsub, repo: "hexpm", optional: false]}, {:plug, "~> 1.8.1 or ~> 1.9", [hex: :plug, repo: "hexpm", optional: false]}, {:plug_cowboy, "~> 1.0 or ~> 2.0", [hex: :plug_cowboy, repo: "hexpm", optional: true]}, {:telemetry, "~> 0.4", [hex: :telemetry, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.0.0", "c43117a136e7399ea04ecaac73f8f23ee0ffe3e07acfcb8062fe5f4c9f0f6531", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_ecto": {:hex, :phoenix_ecto, "4.1.0", "a044d0756d0464c5a541b4a0bf4bcaf89bffcaf92468862408290682c73ae50d", [:mix], [{:ecto, "~> 3.0", [hex: :ecto, repo: "hexpm", optional: false]}, {:phoenix_html, "~> 2.9", [hex: :phoenix_html, repo: "hexpm", optional: true]}, {:plug, "~> 1.0", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_html": {:hex, :phoenix_html, "2.13.3", "850e292ff6e204257f5f9c4c54a8cb1f6fbc16ed53d360c2b780a3d0ba333867", [:mix], [{:plug, "~> 1.5", [hex: :plug, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_live_reload": {:hex, :phoenix_live_reload, "1.2.1", "274a4b07c4adbdd7785d45a8b0bb57634d0b4f45b18d2c508b26c0344bd59b8f", [:mix], [{:file_system, "~> 0.2.1 or ~> 0.3", [hex: :file_system, repo: "hexpm", optional: false]}, {:phoenix, "~> 1.4", [hex: :phoenix, repo: "hexpm", optional: false]}], "hexpm"},
"phoenix_pubsub": {:hex, :phoenix_pubsub, "1.1.2", "496c303bdf1b2e98a9d26e89af5bba3ab487ba3a3735f74bf1f4064d2a845a3e", [:mix], [], "hexpm"},

View File

@ -0,0 +1,9 @@
defmodule MobilizonWeb.E2EController do
use MobilizonWeb, :controller
def drain_queue(conn, _) do
Oban.drain_queue(:default)
Oban.drain_queue(:search)
send_resp(conn, 200, "")
end
end