Skip to content

Commit

Permalink
Merge branch 'master' into douglasduteil/chore-deps-update-dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
douglasduteil authored Dec 13, 2023
2 parents 7f4a8d5 + acd9938 commit e74493d
Show file tree
Hide file tree
Showing 10 changed files with 5,347 additions and 1 deletion.
31 changes: 31 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#

name: CI

on:
push:
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: "npm"
node-version-file: package.json
- run: npm ci

e2e:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: npm ci
- name: Cypress run
uses: cypress-io/github-action@v6
with:
working-directory: ./e2e
start: npm start
wait-on: http://localhost:3000
50 changes: 50 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
#

name: Publish

on:
push:
branches:
- master
workflow_dispatch:

permissions:
packages: write

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to Github Container Registry
uses: docker/login-action@v2
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ github.token }}

- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/betagouv/moncomptepro-test-client
tags: |
type=sha,format=long,prefix=
type=ref,event=branch
type=ref,event=tag
flavor: |
latest=${{ github.ref == 'refs/heads/master' }}
- name: Build image
uses: docker/build-push-action@v3
with:
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64
cache-from: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache
cache-to: type=registry,ref=ghcr.io/${{ github.repository }}:buildcache,mode=max
build-args: |
SOURCE_COMMIT=${{ github.sha }}
35 changes: 35 additions & 0 deletions e2e/cypress.config.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//

import { addCucumberPreprocessorPlugin } from "@badeball/cypress-cucumber-preprocessor";
import { createEsbuildPlugin } from "@badeball/cypress-cucumber-preprocessor/esbuild";
import createBundler from "@bahmutov/cypress-esbuild-preprocessor";
import { defineConfig } from "cypress";

//

export default defineConfig({
e2e: {
baseUrl: "http://localhost:3000",
specPattern: "**/*.feature",
setupNodeEvents,
supportFile: false,
},
});

//

async function setupNodeEvents(
on: Cypress.PluginEvents,
config: Cypress.PluginConfigOptions
) {
await addCucumberPreprocessorPlugin(on, config);

on(
"file:preprocessor",
createBundler({
plugins: [createEsbuildPlugin(config)],
})
);

return config;
}
16 changes: 16 additions & 0 deletions e2e/features/connexion.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#language: fr
Fonctionnalité: Connexion de [email protected]

Scénario: Connexion d'un utilisateur
Etant donné que je navigue sur la page
Alors je vois "Bonjour monde !"
Quand je clique sur le bouton MonComptePro

Quand je me connecte en tant que user@yopmail.com sur moncomptepro
Et je vois "Votre organisation de rattachement" sur moncomptepro
Et je click sur "Continuer" sur moncomptepro

Alors je suis redirigé sur "/"
Et je vois "Information utilisateur"
Et je vois "[email protected]"
Et je vois "International knowledge practice leader"
58 changes: 58 additions & 0 deletions e2e/features/connexion.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
//

import { Given, Then, When } from "@badeball/cypress-cucumber-preprocessor";

//

Given("je navigue sur la page", () => {
cy.visit("/");
});

When("je clique sur le bouton MonComptePro", () => {
cy.get(".moncomptepro-button").click();
});

When("je suis redirigé sur {string}", (path: string) => {
cy.url().should("contain", path);
});

Then("je vois {string}", function (text: string) {
cy.contains(text);
});

//

When("je vois {string} sur moncomptepro", (_text: string) => {
cy.origin(
"https://app-test.moncomptepro.beta.gouv.fr",
{ args: _text },
(text) => {
cy.contains(text);
}
);
});

When("je click sur {string} sur moncomptepro", (_text: string) => {
cy.origin(
"https://app-test.moncomptepro.beta.gouv.fr",
{ args: _text },
(text) => {
cy.contains(text).click();
}
);
});

When(
"je me connecte en tant que [email protected] sur moncomptepro",
(path: string) => {
cy.origin("https://app-test.moncomptepro.beta.gouv.fr", () => {
cy.get('[name="login"]').type("[email protected]");
cy.get('[type="submit"]').click();

cy.get('[name="password"]').type("[email protected]");
cy.get('[action="/users/sign-in"] [type="submit"]')
.contains("Se connecter")
.click();
});
}
);
Loading

0 comments on commit e74493d

Please sign in to comment.