From 0575158de65e82b245c2065b8163c17fa4252183 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Wed, 12 Jun 2024 15:52:04 -0300 Subject: [PATCH 01/11] Add account playwright tests --- .../playwright/e2e/account.spec.ts | 119 ++++++++++++++++++ 1 file changed, 119 insertions(+) create mode 100644 site/gatsby-site/playwright/e2e/account.spec.ts diff --git a/site/gatsby-site/playwright/e2e/account.spec.ts b/site/gatsby-site/playwright/e2e/account.spec.ts new file mode 100644 index 0000000000..eb952658d8 --- /dev/null +++ b/site/gatsby-site/playwright/e2e/account.spec.ts @@ -0,0 +1,119 @@ +import { conditionalIntercept, waitForRequest, login, maybeIt } from '../utils'; +import { test, expect } from '@playwright/test'; +import config from '../config'; + +test.describe('Account', () => { + const url = '/account'; + + const user = { + "data": { + "user": { + "__typename": "User", + "adminData": { + "__typename": "UserAdminDatum", + "creationDate": "2022-09-26T20:34:46Z", + "disabled": false, + "email": process.env.E2E_ADMIN_USERNAME, + "lastAuthenticationDate": "2023-06-06T00:07:30Z" + }, + "first_name": "Test", + "last_name": "User", + "roles": [ + "admin" + ], + "userId": "6423479655e4bb918a233bda" + } + } + }; + + test('Should successfully load account page', async ({ page }) => { + await page.goto(url); + }); + + maybeIt('Should display account information if the user is logged in', async ({ page }) => { + await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + + await conditionalIntercept( + page, + '**/graphql', + (req) => + req.postDataJSON().operationName === 'FindUser', + user, + 'findUser' + ); + + await page.goto(url); + + await waitForRequest('findUser'); + + const detailsTable = page.locator('[data-cy="details-table"]'); + await expect(detailsTable.locator(`td:has-text("${config.E2E_ADMIN_USERNAME}")`)).toBeVisible(); + await expect(detailsTable.locator('td:has-text("Test")')).toBeVisible(); + await expect(detailsTable.locator('td:has-text("User")')).toBeVisible(); + await expect(detailsTable.locator('td:has-text("admin")')).toBeVisible(); + + await expect(page.locator('a:has-text("Log out")')).toBeVisible(); + }); + + maybeIt('Should allow editing user data', async ({ page }) => { + await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + + await conditionalIntercept( + page, + '**/graphql', + (req) => + req.postDataJSON().operationName === 'FindUser', + user, + 'findUser' + ); + + await page.goto(url); + + await waitForRequest('findUser'); + + await page.locator('button:has-text("Edit")').click(); + + await conditionalIntercept( + page, + '**/graphql', + (req) => req.postDataJSON().operationName == 'UpdateUserRoles', + { + data: { + updateOneUser: { + __typename: 'User', + roles: ['subscriber', 'bananas', 'ban', 'admin', 'banana'], + userId: '6423479655e4bb918a233bda', + }, + }, + }, + 'UpdateUserRoles' + ); + + const editUserModal = page.locator('[data-cy="edit-user-modal"]'); + await editUserModal.locator('[id="roles"]').fill('banana'); + await editUserModal.locator('button:has-text("Submit")').click(); + + const updateUserRolesRequest = await waitForRequest('UpdateUserRoles'); + const variables = updateUserRolesRequest.postDataJSON().variables; + expect(variables.roles).toContain('banana'); + }); + + maybeIt('Should show edit modal if query parameter is set', async ({ page }) => { + await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + + await conditionalIntercept( + page, + '**/graphql', + (req) => + req.postDataJSON().operationName === 'FindUser', + user, + 'findUser' + ); + + await page.goto(url + '?askToCompleteProfile=1'); + + await waitForRequest('findUser'); + + await expect(page.locator('[data-cy="edit-user-modal"]')).toBeVisible(); + }); +}); \ No newline at end of file From 12db40b1cae1ba1778115e516ea6a763db139eb2 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Fri, 14 Jun 2024 16:03:16 -0300 Subject: [PATCH 02/11] Delete account.cy.js --- .../cypress/e2e/integration/account.cy.js | 73 ------------------- 1 file changed, 73 deletions(-) delete mode 100644 site/gatsby-site/cypress/e2e/integration/account.cy.js diff --git a/site/gatsby-site/cypress/e2e/integration/account.cy.js b/site/gatsby-site/cypress/e2e/integration/account.cy.js deleted file mode 100644 index dc1f1c7972..0000000000 --- a/site/gatsby-site/cypress/e2e/integration/account.cy.js +++ /dev/null @@ -1,73 +0,0 @@ -import { maybeIt } from '../../support/utils'; - -describe('Account', () => { - const url = '/account'; - - it('Should successfully load account page', () => { - cy.visit(url); - }); - - maybeIt('Should display account information if the user is logged in', () => { - cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword')); - - cy.visit(url); - - cy.waitForStableDOM(); - - cy.get('[data-cy="details-table"]').within(() => { - cy.contains(Cypress.env('e2eUsername')).should('be.visible'); - cy.contains('td', 'Test').should('be.visible'); - cy.contains('td', 'User').should('be.visible'); - cy.contains('td', 'admin').should('be.visible'); - }); - - cy.contains('Log out').should('exist'); - }); - - maybeIt('Should allow editing user data', () => { - cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword')); - - cy.visit(url); - - cy.waitForStableDOM(); - - cy.contains('button', 'Edit').click(); - - cy.waitForStableDOM(); - - cy.conditionalIntercept( - '**/graphql', - (req) => req.body.operationName == 'UpdateUserRoles', - 'UpdateUserRoles', - { - data: { - updateOneUser: { - __typename: 'User', - roles: ['subscriber', 'bananas', 'ban', 'admin', 'banana'], - userId: '6423479655e4bb918a233bda', - }, - }, - } - ); - - cy.get('[data-cy="edit-user-modal"]').within(() => { - cy.get('[id="roles"]', { timeout: 30000 }).type('banana{enter}'); - - cy.contains('Submit').click(); - - cy.wait('@UpdateUserRoles').then((xhr) => { - expect(xhr.request.body.variables.roles).includes('banana'); - }); - }); - }); - - maybeIt('Should show edit modal if query parameter is is set', () => { - cy.login(Cypress.env('e2eUsername'), Cypress.env('e2ePassword')); - - cy.visit(url + '?askToCompleteProfile=1'); - - cy.waitForStableDOM(); - - cy.get('[data-cy="edit-user-modal"]').should('be.visible'); - }); -}); From c18087f2c5c6fcec6edcc92e26a99adb1905fa08 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Thu, 20 Jun 2024 09:44:21 -0300 Subject: [PATCH 03/11] Use test from utils --- site/gatsby-site/playwright/e2e/account.spec.ts | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/site/gatsby-site/playwright/e2e/account.spec.ts b/site/gatsby-site/playwright/e2e/account.spec.ts index eb952658d8..08b092847c 100644 --- a/site/gatsby-site/playwright/e2e/account.spec.ts +++ b/site/gatsby-site/playwright/e2e/account.spec.ts @@ -1,5 +1,5 @@ -import { conditionalIntercept, waitForRequest, login, maybeIt } from '../utils'; -import { test, expect } from '@playwright/test'; +import { conditionalIntercept, waitForRequest, test } from '../utils'; +import { expect } from '@playwright/test'; import config from '../config'; test.describe('Account', () => { @@ -30,8 +30,8 @@ test.describe('Account', () => { await page.goto(url); }); - maybeIt('Should display account information if the user is logged in', async ({ page }) => { - await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + test('Should display account information if the user is logged in', async ({ page, login }) => { + await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); await conditionalIntercept( page, @@ -55,8 +55,8 @@ test.describe('Account', () => { await expect(page.locator('a:has-text("Log out")')).toBeVisible(); }); - maybeIt('Should allow editing user data', async ({ page }) => { - await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + test('Should allow editing user data', async ({ page, login }) => { + await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); await conditionalIntercept( page, @@ -98,8 +98,8 @@ test.describe('Account', () => { expect(variables.roles).toContain('banana'); }); - maybeIt('Should show edit modal if query parameter is set', async ({ page }) => { - await login(page, config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); + test('Should show edit modal if query parameter is set', async ({ page, login }) => { + await login(config.E2E_ADMIN_USERNAME, config.E2E_ADMIN_PASSWORD); await conditionalIntercept( page, From d812608c75f82552bd7e81a8c80bdbb55051b587 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Thu, 4 Jul 2024 15:40:47 -0300 Subject: [PATCH 04/11] Fix tests --- .../playwright/e2e/account.spec.ts | 5 +- site/gatsby-site/session.json | 50 +++++++++++++++++++ 2 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 site/gatsby-site/session.json diff --git a/site/gatsby-site/playwright/e2e/account.spec.ts b/site/gatsby-site/playwright/e2e/account.spec.ts index 08b092847c..40b8b69e70 100644 --- a/site/gatsby-site/playwright/e2e/account.spec.ts +++ b/site/gatsby-site/playwright/e2e/account.spec.ts @@ -88,8 +88,7 @@ test.describe('Account', () => { }, 'UpdateUserRoles' ); - - const editUserModal = page.locator('[data-cy="edit-user-modal"]'); + const editUserModal = page.getByTestId('edit-user-modal'); await editUserModal.locator('[id="roles"]').fill('banana'); await editUserModal.locator('button:has-text("Submit")').click(); @@ -114,6 +113,6 @@ test.describe('Account', () => { await waitForRequest('findUser'); - await expect(page.locator('[data-cy="edit-user-modal"]')).toBeVisible(); + await expect(page.getByTestId('edit-user-modal')).toBeVisible(); }); }); \ No newline at end of file diff --git a/site/gatsby-site/session.json b/site/gatsby-site/session.json new file mode 100644 index 0000000000..998c7aafe7 --- /dev/null +++ b/site/gatsby-site/session.json @@ -0,0 +1,50 @@ +{ + "cookies": [], + "origins": [ + { + "origin": "http://localhost:8000", + "localStorage": [ + { + "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):profile", + "value": "{\"type\":\"normal\",\"identities\":[{\"id\":\"6686ec8d6529f5ea3fa4722b-ankrhdqecbqznzokdshtfiph\",\"providerType\":\"anon-user\"}],\"data\":{}}" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):deviceId", + "value": "6686ec8fe45b944f580f0cf6" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):profile", + "value": "{\"type\":\"normal\",\"identities\":[{\"id\":\"62cd9520a69a2cdf17fb47d8\",\"providerType\":\"local-userpass\"}],\"data\":{\"email\":\"clara@botsfactory.io\"}}" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):refreshToken", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiYWFzX2RhdGEiOm51bGwsImJhYXNfZGV2a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IiwiZXhwIjoxNzIwMTIwMjEzLCJpYXQiOjE3MjAxMTg0MTMsImlzcyI6IjY2ODZlYzhkNjUyOWY1ZWEzZmE0NzI2MCIsImp0aSI6IjY2ODZlYzhkNjUyOWY1ZWEzZmE0NzI4OSIsInN0aXRjaF9kZXZJZCI6IjY2ODZlYzhkNjUyOWY1ZWEzZmE0NzI0ZiIsInN0aXRjaF9kb21haW5JZCI6IjYyY2M0OGZlZDY5NGExM2M0YWI5NDAyZSIsInN1YiI6IjY2ODZlYzhkNjUyOWY1ZWEzZmE0NzI0MyIsInR5cCI6ImFjY2VzcyJ9.qUMTvrReOlynqMPE8ybpRlFmiKIt_yMrEYBlcLPjgcg" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):providerType", + "value": "anon-user" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):userIds", + "value": "[\"62cd9520a69a2cdf17fb47db\",\"6686ec8d6529f5ea3fa47243\"]" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):accessToken", + "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiYWFzX2RldmljZV9pZCI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGNmNiIsImJhYXNfZG9tYWluX2lkIjoiNjJjYzQ4ZmVkNjk0YTEzYzRhYjk0MDJlIiwiZXhwIjoxNzIwMTIwMjE1LCJpYXQiOjE3MjAxMTg0MTUsImlzcyI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGQwMSIsImp0aSI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGQwOCIsInN0aXRjaF9kZXZJZCI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGNmNiIsInN0aXRjaF9kb21haW5JZCI6IjYyY2M0OGZlZDY5NGExM2M0YWI5NDAyZSIsInN1YiI6IjYyY2Q5NTIwYTY5YTJjZGYxN2ZiNDdkYiIsInR5cCI6ImFjY2VzcyIsInVzZXJfZGF0YSI6eyJfaWQiOiI2MjU3ODAzOTUxMDQ1OTcyNzU1MjM0MmUiLCJ1c2VySWQiOiI2MmNkOTUyMGE2OWEyY2RmMTdmYjQ3ZGIiLCJyb2xlcyI6WyJhZG1pbiIsImJhbmFuYSJdLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IlVzZXIiLCJjcmVhdGVkX2F0Ijp7IiRkYXRlIjp7IiRudW1iZXJMb25nIjoiMTcwMjQ5Mjk1MjU0NSJ9fX19.WsDcajjYlbZ1MjdfFz9PRDnDs63oqq1M71hknxkOuuY" + }, + { + "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):providerType", + "value": "local-userpass" + } + ] + } + ] +} \ No newline at end of file From 530cb091200faf56a2aad7211463d847f4c41ece Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Fri, 5 Jul 2024 14:22:06 -0300 Subject: [PATCH 05/11] Narrow down results by using text-is --- site/gatsby-site/playwright/e2e/account.spec.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/site/gatsby-site/playwright/e2e/account.spec.ts b/site/gatsby-site/playwright/e2e/account.spec.ts index 40b8b69e70..f97ed9f06b 100644 --- a/site/gatsby-site/playwright/e2e/account.spec.ts +++ b/site/gatsby-site/playwright/e2e/account.spec.ts @@ -47,12 +47,12 @@ test.describe('Account', () => { await waitForRequest('findUser'); const detailsTable = page.locator('[data-cy="details-table"]'); - await expect(detailsTable.locator(`td:has-text("${config.E2E_ADMIN_USERNAME}")`)).toBeVisible(); - await expect(detailsTable.locator('td:has-text("Test")')).toBeVisible(); - await expect(detailsTable.locator('td:has-text("User")')).toBeVisible(); - await expect(detailsTable.locator('td:has-text("admin")')).toBeVisible(); + await expect(detailsTable.locator(`td:text-is("${config.E2E_ADMIN_USERNAME}")`)).toBeVisible(); + await expect(detailsTable.locator('td:text-is("Test")')).toBeVisible(); + await expect(detailsTable.locator('td:text-is("User")')).toBeVisible(); + await expect(detailsTable.locator('td:text-is("admin")')).toBeVisible(); - await expect(page.locator('a:has-text("Log out")')).toBeVisible(); + await expect(page.locator('a:text-is("Log out")')).toBeVisible(); }); test('Should allow editing user data', async ({ page, login }) => { From 02ccd67ba5988682eede23e4c6aa468897b3f663 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Wed, 10 Jul 2024 12:29:57 -0300 Subject: [PATCH 06/11] Create cset.spec.ts --- .../playwright/e2e/integration/cset.spec.ts | 56 +++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100644 site/gatsby-site/playwright/e2e/integration/cset.spec.ts diff --git a/site/gatsby-site/playwright/e2e/integration/cset.spec.ts b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts new file mode 100644 index 0000000000..3636a21b3d --- /dev/null +++ b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts @@ -0,0 +1,56 @@ +import { test, expect, Page } from '@playwright/test'; +import { gql } from '@apollo/client'; +import { query } from '../../utils'; + +const urls = [ + { namespace: 'CSETv0', url: '/taxonomy/csetv0' }, + { namespace: 'CSETv1', url: '/taxonomy/csetv1' }, +]; + +urls.forEach(({ namespace, url }) => { + test(`successfully loads ${namespace}`, async ({ page }) => { + await page.goto(url); + }); + + if (namespace === 'CSETv0') { + test(`Should render ${namespace} fields list and Searchable status`, async ({ page }) => { + await page.goto(url); + + const fieldListQuery = gql` + { + taxa(query: { namespace_in: ["${namespace}"] }) { + namespace + field_list { + long_name + short_name + instant_facet + public + } + } + } + `; + + const result = await query({ + query: fieldListQuery, + }); + + const field_list = result.data.taxa.field_list.filter( + (entry) => (entry.public === null || entry.public) && entry.short_name !== 'Publish' + ); + + await expect(page.locator('[data-cy*="field-"]')).toHaveCount(field_list.length); + + for (const field of field_list) { + const fieldLocator = page.locator('h3', { hasText: field.long_name.replace(/\s{2,}/g, ' ') }); + await expect(fieldLocator).toBeVisible(); + + const searchableLocator = fieldLocator.locator('span', { hasText: 'Searchable in Discover App' }); + if (field.instant_facet) { + await expect(searchableLocator.first()).toBeVisible(); + } else { + await expect(searchableLocator.first()).not.toBeVisible(); + } + } + }); + } +}); From 1a7f3623958dc0bf929db9677593a12d099fbdc4 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Wed, 10 Jul 2024 12:29:59 -0300 Subject: [PATCH 07/11] Delete cset.cy.js --- .../cypress/e2e/integration/cset.cy.js | 57 ------------------- 1 file changed, 57 deletions(-) delete mode 100644 site/gatsby-site/cypress/e2e/integration/cset.cy.js diff --git a/site/gatsby-site/cypress/e2e/integration/cset.cy.js b/site/gatsby-site/cypress/e2e/integration/cset.cy.js deleted file mode 100644 index 9f74d18a2c..0000000000 --- a/site/gatsby-site/cypress/e2e/integration/cset.cy.js +++ /dev/null @@ -1,57 +0,0 @@ -const { gql } = require('@apollo/client'); - -describe('The CSET taxonomy page', () => { - const urls = [ - { namespace: 'CSETv0', url: '/taxonomy/csetv0' }, - { namespace: 'CSETv1', url: '/taxonomy/csetv1' }, - ]; - - urls.forEach(({ namespace, url }) => { - it.skip(`successfully loads ${namespace}`, () => { - cy.visit(url); - }); - - it.skip(`Should render ${namespace} fields list and Searchable status`, () => { - cy.visit(url); - - cy.waitForStableDOM(); - - cy.query({ - query: gql` - { - taxa(query: { namespace_in: ["${namespace}"] }) { - namespace - field_list { - long_name - short_name - instant_facet - public - } - } - } - `, - }) - .then( - ({ - data: { - taxa: { field_list }, - }, - }) => { - return field_list.filter( - (entry) => (entry.public === null || entry.public) && entry.short_name !== 'Publish' - ); - } - ) - .then((field_list) => { - cy.get('[data-cy*="field-"]').should('have.length', field_list.length); - - field_list.forEach((field) => { - cy.contains('h3', field.long_name.replace(/\s{2,}/g, ' ')) - .should('exist') - .contains('span', 'Searchable in Discover App') - .should(field.instant_facet ? 'exist' : 'not.exist'); - }); - }); - }); - }); -}); From 563d3cb372318b8cf2e0374235f7536deebaa411 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Wed, 10 Jul 2024 14:04:44 -0300 Subject: [PATCH 08/11] Use test from utils --- site/gatsby-site/playwright/e2e/integration/cset.spec.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/site/gatsby-site/playwright/e2e/integration/cset.spec.ts b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts index 3636a21b3d..2725b68961 100644 --- a/site/gatsby-site/playwright/e2e/integration/cset.spec.ts +++ b/site/gatsby-site/playwright/e2e/integration/cset.spec.ts @@ -1,6 +1,6 @@ -import { test, expect, Page } from '@playwright/test'; +import { expect, Page } from '@playwright/test'; import { gql } from '@apollo/client'; -import { query } from '../../utils'; +import { query, test } from '../../utils'; const urls = [ { namespace: 'CSETv0', url: '/taxonomy/csetv0' }, From 89841f14576366ca18baa9f30bb4e21fb3071d64 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Thu, 11 Jul 2024 12:45:46 -0300 Subject: [PATCH 09/11] Fix text locator --- site/gatsby-site/playwright/e2e/account.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/site/gatsby-site/playwright/e2e/account.spec.ts b/site/gatsby-site/playwright/e2e/account.spec.ts index f97ed9f06b..e50783cb61 100644 --- a/site/gatsby-site/playwright/e2e/account.spec.ts +++ b/site/gatsby-site/playwright/e2e/account.spec.ts @@ -50,7 +50,7 @@ test.describe('Account', () => { await expect(detailsTable.locator(`td:text-is("${config.E2E_ADMIN_USERNAME}")`)).toBeVisible(); await expect(detailsTable.locator('td:text-is("Test")')).toBeVisible(); await expect(detailsTable.locator('td:text-is("User")')).toBeVisible(); - await expect(detailsTable.locator('td:text-is("admin")')).toBeVisible(); + await expect(detailsTable.locator('span:text-is("admin")')).toBeVisible(); await expect(page.locator('a:text-is("Log out")')).toBeVisible(); }); From b6bd479ebab5af3b91659a3e3689714e3635956f Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Thu, 11 Jul 2024 15:42:27 -0300 Subject: [PATCH 10/11] Delete session.json --- site/gatsby-site/session.json | 50 ----------------------------------- 1 file changed, 50 deletions(-) delete mode 100644 site/gatsby-site/session.json diff --git a/site/gatsby-site/session.json b/site/gatsby-site/session.json deleted file mode 100644 index 998c7aafe7..0000000000 --- a/site/gatsby-site/session.json +++ /dev/null @@ -1,50 +0,0 @@ -{ - "cookies": [], - "origins": [ - { - "origin": "http://localhost:8000", - "localStorage": [ - { - "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):profile", - "value": "{\"type\":\"normal\",\"identities\":[{\"id\":\"6686ec8d6529f5ea3fa4722b-ankrhdqecbqznzokdshtfiph\",\"providerType\":\"anon-user\"}],\"data\":{}}" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):deviceId", - "value": "6686ec8fe45b944f580f0cf6" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):profile", - "value": "{\"type\":\"normal\",\"identities\":[{\"id\":\"62cd9520a69a2cdf17fb47d8\",\"providerType\":\"local-userpass\"}],\"data\":{\"email\":\"clara@botsfactory.io\"}}" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):refreshToken", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiYWFzX2RhdGEiOm51bGwsImJhYXNfZGV2aWNlX2lkIjoiNjY4NmVjOGQ2NTI5ZjVlYTNmYTQ3MjRmIiwiYmFhc19kb21haW5faWQiOiI2MmNjNDhmZWQ2OTRhMTNjNGFiOTQwMmUiLCJiYWFzX2lkIjoiNjY4NmVjOGQ2NTI5ZjVlYTNmYTQ3MjYwIiwiYmFhc19pZGVudGl0eSI6eyJpZCI6IjY2ODZlYzhkNjUyOWY1ZWEzZmE0NzIyYi1hbmtyaGRxZWNicXpuem9rZHNodGZpcGgiLCJwcm92aWRlcl90eXBlIjoiYW5vbi11c2VyIiwicHJvdmlkZXJfaWQiOiI2MmNjNjY5ZTJmYjBmMGU5YTI0MzJhNGUifSwiZXhwIjozMjk2OTE4NDE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{ - "name": "realm-web:app(aiidstitch2-qoueg):user(6686ec8d6529f5ea3fa47243):providerType", - "value": "anon-user" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):userIds", - "value": "[\"62cd9520a69a2cdf17fb47db\",\"6686ec8d6529f5ea3fa47243\"]" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):accessToken", - "value": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJiYWFzX2RldmljZV9pZCI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGNmNiIsImJhYXNfZG9tYWluX2lkIjoiNjJjYzQ4ZmVkNjk0YTEzYzRhYjk0MDJlIiwiZXhwIjoxNzIwMTIwMjE1LCJpYXQiOjE3MjAxMTg0MTUsImlzcyI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGQwMSIsImp0aSI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGQwOCIsInN0aXRjaF9kZXZJZCI6IjY2ODZlYzhmZTQ1Yjk0NGY1ODBmMGNmNiIsInN0aXRjaF9kb21haW5JZCI6IjYyY2M0OGZlZDY5NGExM2M0YWI5NDAyZSIsInN1YiI6IjYyY2Q5NTIwYTY5YTJjZGYxN2ZiNDdkYiIsInR5cCI6ImFjY2VzcyIsInVzZXJfZGF0YSI6eyJfaWQiOiI2MjU3ODAzOTUxMDQ1OTcyNzU1MjM0MmUiLCJ1c2VySWQiOiI2MmNkOTUyMGE2OWEyY2RmMTdmYjQ3ZGIiLCJyb2xlcyI6WyJhZG1pbiIsImJhbmFuYSJdLCJmaXJzdF9uYW1lIjoiVGVzdCIsImxhc3RfbmFtZSI6IlVzZXIiLCJjcmVhdGVkX2F0Ijp7IiRkYXRlIjp7IiRudW1iZXJMb25nIjoiMTcwMjQ5Mjk1MjU0NSJ9fX19.WsDcajjYlbZ1MjdfFz9PRDnDs63oqq1M71hknxkOuuY" - }, - { - "name": "realm-web:app(aiidstitch2-qoueg):user(62cd9520a69a2cdf17fb47db):providerType", - "value": "local-userpass" - } - ] - } - ] -} \ No newline at end of file From 4a3405adf33055852a4bb58b673454f011d24b95 Mon Sep 17 00:00:00 2001 From: Clara Youdale Date: Fri, 12 Jul 2024 14:18:59 -0300 Subject: [PATCH 11/11] Update test-playwright.yml (#2971) --- .github/workflows/test-playwright.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/test-playwright.yml b/.github/workflows/test-playwright.yml index f13020e3da..567dcd71d5 100644 --- a/.github/workflows/test-playwright.yml +++ b/.github/workflows/test-playwright.yml @@ -77,6 +77,7 @@ jobs: E2E_ADMIN_PASSWORD: ${{ secrets.E2E_ADMIN_PASSWORD }} E2E_ADMIN_USERNAME: ${{ secrets.E2E_ADMIN_USERNAME }} IS_EMPTY_ENVIRONMENT: ${{ vars.IS_EMPTY_ENVIRONMENT }} + GATSBY_AVAILABLE_LANGUAGES: ${{ vars.GATSBY_AVAILABLE_LANGUAGES }} - uses: actions/upload-artifact@v4 if: ${{ !cancelled() }}