Basic test verifying if demo account is working properly (#8442)

This commit is contained in:
BOHEUS 2024-12-17 13:56:00 +01:00 committed by GitHub
parent 8bb699cbc2
commit c754585e47
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 86 additions and 3 deletions

59
.github/workflows/ci-demo-check.yml vendored Normal file
View File

@ -0,0 +1,59 @@
name: CI demo check
on:
schedule:
- cron: '30 7,19 * * *'
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test:
timeout-minutes: 15
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: lts/*
- name: Install dependencies
uses: ./.github/workflows/actions/yarn-install
- name: Install Playwright Browsers
run: yarn playwright install --with-deps
- name: Run Playwright tests
id: test
run: yarn playwright test --grep @demo-only
- name: Upload report after tests
uses: actions/upload-artifact@v4
with:
name: playwright-report
path: playwright-report/
retention-days: 90
- name: Send Discord notification
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
uses: Ilshidur/action-discord@0.3.2
with:
args: 'Demo check ${{ steps.test.outcome }} - check ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}'
- name: Send email if demo is not working
if: steps.test.outcome == 'failure'
uses: dawidd6/action-send-mail@v3.12.0
with:
connection_url: ${{ secrets.MAIL_CONNECTION }}
server_address: smtp.gmail.com
server_port: 465
secure: true
username: ${{ secrets.MAIL_USERNAME }}
subject: 'Demo is not working'
from: 'Github CI Demo check'
to: ${{ secrets.RECIPIENTS }}
body: '<a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">Link</a>'
priority: high

View File

@ -34,12 +34,19 @@ export default defineConfig({
expect: {
timeout: 5000,
},
reporter: [['html', { open: 'never' }]],
reporter: process.env.CI ? 'github' : 'list',
projects: [
{
name: 'Login setup',
testMatch: /login\.setup\.ts/, // finds all tests matching this regex, in this case only 1 test should be found
},
{
name: 'Demo check',
use: {
...devices['Desktop Chrome'],
},
testMatch: /demo\/demo_basic\.spec\.ts/,
},
{
name: 'chromium',
use: {
@ -47,6 +54,7 @@ export default defineConfig({
storageState: path.resolve(__dirname, '.auth', 'user.json'), // takes saved cookies from directory
},
dependencies: ['Login setup'], // forces to run login setup before running tests from this project - CASE SENSITIVE
testMatch: /all\/.+\.spec\.ts/,
},
{
name: 'firefox',
@ -55,6 +63,7 @@ export default defineConfig({
storageState: path.resolve(__dirname, '.auth', 'user.json'),
},
dependencies: ['Login setup'],
testMatch: /all\/.+\.spec\.ts/,
},
{
name: 'Authentication',

View File

@ -1,4 +1,4 @@
import { test, expect } from '../lib/fixtures/screenshot';
import { test, expect } from '../../lib/fixtures/screenshot';
test.describe('Basic check', () => {
test('Checking if table in Companies is visible', async ({ page }) => {

View File

@ -1,5 +1,5 @@
import { test, expect } from '@playwright/test';
import { sh } from '../drivers/shell_driver';
import { sh } from '../../drivers/shell_driver';
test.describe('', () => {
test('Testing logging', async ({ page }) => {

View File

@ -0,0 +1,15 @@
import { test, expect } from '@playwright/test';
test('Check if demo account is working properly @demo-only', async ({
page,
}) => {
await page.goto('https://demo.twenty.com/');
await page.getByRole('button', { name: 'Continue With Email' }).click();
await page.getByRole('button', { name: 'Continue', exact: true }).click();
await page.getByRole('button', { name: 'Sign in' }).click();
await expect(page.getByText('Welcome to Twenty')).not.toBeVisible();
await page.waitForTimeout(5000);
await expect(page.getByText('Servers on a coffee break')).not.toBeVisible({
timeout: 5000,
});
});