Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Change testing browser #2752

Closed
wants to merge 49 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
b34a024
use firefox instead
ElinorW Aug 21, 2023
4079ad2
remove ms-edge tag
ElinorW Aug 21, 2023
a933073
Merge branch 'dev' into fix/playwright-browser-launch
ElinorW Aug 21, 2023
7dc5d70
restore default
ElinorW Aug 23, 2023
596053e
use previous version
ElinorW Aug 23, 2023
7442a5f
return version
ElinorW Aug 23, 2023
0173d72
Merge branch 'dev' into fix/playwright-browser-launch
ElinorW Sep 6, 2023
45b1157
use node16
ElinorW Sep 6, 2023
98410ea
Merge branch 'fix/playwright-browser-launch' of https://github.com/mi…
ElinorW Sep 6, 2023
036025e
rearrange test order
ElinorW Sep 7, 2023
370dd19
update script reordering
ElinorW Sep 7, 2023
e5d9782
update config file
ElinorW Sep 7, 2023
72dff8c
return previous config
ElinorW Sep 7, 2023
17c7528
rearrange order and use node18
ElinorW Sep 7, 2023
d4d1848
run accessibility test first
ElinorW Sep 7, 2023
9239cd1
Merge branch 'dev' into fix/playwright-browser-launch
ElinorW Sep 21, 2023
ef49246
remove screenshot
ElinorW Oct 3, 2023
9c62b47
Merge branch 'fix/playwright-browser-launch' of https://github.com/mi…
ElinorW Oct 3, 2023
396d506
Merge branch 'dev' into fix/playwright-browser-launch
ElinorW Nov 16, 2023
eb700c2
update packages
ElinorW Nov 16, 2023
8b17ba2
use node16
ElinorW Nov 16, 2023
19cda50
downgrade start-server-and-test
ElinorW Nov 16, 2023
b7e9715
use the commands
ElinorW Nov 16, 2023
077f7fa
return previous command and versions
ElinorW Nov 16, 2023
8dac3f1
allow different url option
ElinorW Nov 16, 2023
f8bb9cb
add URL to web server settings
ElinorW Nov 16, 2023
468c13a
add alternative url option
ElinorW Nov 16, 2023
8b9b941
restore previous settings
ElinorW Nov 16, 2023
11210cb
add server
ElinorW Nov 21, 2023
bdcca8a
increase timeout
ElinorW Nov 27, 2023
7ef9eca
Merge branch 'dev' into fix/playwright-browser-launch
ElinorW Nov 27, 2023
8e6dfd0
increase timeout
ElinorW Nov 27, 2023
4bbad5e
disable run only on dev branch(temporary)
ElinorW Nov 27, 2023
e580df8
update script
ElinorW Nov 27, 2023
2e57e92
increase test timeout
ElinorW Nov 27, 2023
d1bb3da
remove env variable
ElinorW Nov 27, 2023
629d9fe
begin with UI tests
ElinorW Nov 28, 2023
a9aeecf
remove legacy setting
ElinorW Nov 29, 2023
4b39f5c
add browser close
ElinorW Nov 29, 2023
2e83a96
run playwright on github CI
ElinorW Nov 29, 2023
044de9b
add URL
ElinorW Nov 29, 2023
ede8b20
return condition
ElinorW Nov 29, 2023
1ef8175
temporarily set baseURL
ElinorW Nov 29, 2023
f806838
code clean up
ElinorW Nov 29, 2023
d490649
temporarily disable condition
ElinorW Nov 29, 2023
973a6bc
specify edge browser
ElinorW Nov 29, 2023
3047930
add UI tests to github CI
ElinorW Nov 30, 2023
1ec0e04
remove playwright job
ElinorW Nov 30, 2023
ae3de1c
Add environment variables
ElinorW Nov 30, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: Playwright Tests
on:
push:
branches: [ master, dev ]
pull_request:
types: [opened, synchronize, reopened, closed]

env:
PLAYWRIGHT_TESTS_BASE_URL: ${{secrets.PLAYWRIGHT_TESTS_BASE_URL}}
PLAYWRIGHT_TESTS_USERNAME: ${{secrets.PLAYWRIGHT_TESTS_USERNAME}}
PLAYWRIGHT_TESTS_PASSWORD: ${{secrets.PLAYWRIGHT_TESTS_PASSWORD}}
jobs:
test:
timeout-minutes: 60
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 18
- name: Install dependencies
run: npm ci

- name: Install Playwright Browsers
run: npx playwright install --with-deps

- name: Run Playwright accessibility tests
run: npx playwright test src/tests/accessibility/ --project=Ms-Edge

- name: Run Playwright UI tests
run: npx playwright test src/tests/ui/

- uses: actions/upload-artifact@v3
if: always()
with:
name: playwright-report
path: playwright-report/
retention-days: 30
50 changes: 0 additions & 50 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,56 +117,6 @@ extends:
displayName: "Run build"

- job: Two
displayName: "Run playwright tests"
condition: eq(variables['isDev'], 'true')
steps:
- task: NodeTool@0
inputs:
versionSpec: "18.16.x"
displayName: "Install npm"

- script: |
npm install
displayName: "npm install"

- script: |
npm install -D @playwright/test
npx playwright install-deps
displayName: "Install playwright dependancies"

- script: |
npx playwright install
displayName: "Install playwright"

- script: |
npm run test-playwright-accessibility
displayName: "Run accessibility tests"

- script: |
set CI=true
npm run test-playwright
env:
REACT_APP_CLIENT_ID: $(REACT_APP_PLAYWRIGHT_TEST_CLIENT_ID)
REACT_APP_INSTRUMENTATION_KEY: $(REACT_APP_STAGING_INSTRUMENTATION_KEY)
REACT_APP_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_STAGING_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID: $(REACT_APP_NPS_FEEDBACK_CAMPAIGN_ID)
REACT_APP_NOMINATION_PERIOD: $(REACT_APP_NOMINATION_PERIOD)
REACT_APP_COOLDOWN_PERIOD: $(REACT_APP_COOLDOWN_PERIOD)
REACT_APP_USAGE_TIME: $(REACT_APP_USAGE_TIME)
PLAYWRIGHT_TESTS_BASE_URL: $(PLAYWRIGHT_TESTS_BASE_URL)
PLAYWRIGHT_TESTS_USERNAME: $(PLAYWRIGHT_TESTS_USERNAME)
PLAYWRIGHT_TESTS_PASSWORD: $(PLAYWRIGHT_TESTS_PASSWORD)
displayName: "Run playwright tests"

templateContext:
outputs:
- output: pipelineArtifact
displayName: 'Publish test results'
condition: always()
targetPath: $(System.DefaultWorkingDirectory)/playwright-report
artifactName: playwright-report

- job: Three
displayName: "Publish artifacts"
dependsOn: One
condition: and(succeeded(), or(eq(variables['isMaster'], 'true'), eq(variables['isDev'], 'true')))
Expand Down
74 changes: 34 additions & 40 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
],
"devDependencies": {
"@axe-core/playwright": "4.7.3",
"@playwright/test": "1.38.1",
"@playwright/test": "1.39.0",
"@types/chromedriver": "81.0.1",
"@types/isomorphic-fetch": "0.0.36",
"@types/jest": "29.5.3",
Expand Down Expand Up @@ -122,7 +122,7 @@
"redux-logger": "3.0.6",
"redux-mock-store": "1.5.4",
"selenium-webdriver": "4.11.1",
"start-server-and-test": "2.0.0",
"start-server-and-test": "2.0.2",
"ts-jest": "29.1.1"
},
"jestSonar": {
Expand Down
13 changes: 9 additions & 4 deletions playwright.config.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
require('dotenv').config();
import { PlaywrightTestConfig } from '@playwright/test';
import { defineConfig } from '@playwright/test';

const baseURL = process.env.PLAYWRIGHT_TESTS_BASE_URL!;

const config: PlaywrightTestConfig = {
export default defineConfig({
globalSetup: require.resolve('./src/tests/ui/global-setup'),
webServer: {
command: 'npm start',
url: baseURL,
reuseExistingServer: !process.env.CI,
timeout: 350 * 1000
},
expect: {
toMatchSnapshot: {
threshold: 0.3,
Expand Down Expand Up @@ -41,5 +47,4 @@ const config: PlaywrightTestConfig = {
viewport: { width: 1365, height: 768 }}
}
]
};
export default config;
});
9 changes: 6 additions & 3 deletions src/tests/accessibility/accessibility.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ test.describe('Accessibility', () => {
test('should not have any automatically detectable accessibility issues', async () => {

await page.locator('[aria-label="Settings"]').isVisible();
const accessibilityScan = new AxeBuilder({ page }).setLegacyMode();
const accessibilityScan = new AxeBuilder({ page });
const result = await accessibilityScan
.disableRules([
'landmark-one-main',
Expand All @@ -29,8 +29,11 @@ test.describe('Accessibility', () => {
'color-contrast'
])
.analyze();
accessibilityScan.setLegacyMode(false);

expect(result.violations).toEqual([]);
});
})
})

test.afterAll(async ({ browser}) => {
await browser.close();
});
4 changes: 2 additions & 2 deletions src/tests/ui/responsiveness/mobile-responsive.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ test.describe('Response area navigation', () => {
await page.getByRole('tab', { name: 'C# C#' }).click();
await page.evaluate(() => document.fonts.ready);
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot();
expect(page.getByText('C#')).toBeDefined();
})
test('should have adaptive card tab in overflow menu', async () => {
await page.getByRole('button', { name: 'Minimize sidebar' }).click();
Expand Down Expand Up @@ -108,7 +108,7 @@ test.describe('Response area navigation', () => {
await page.getByRole('tab', { name: 'C# C#' }).click();
await page.evaluate(() => document.fonts.ready);
await page.waitForTimeout(500);
expect(await page.screenshot()).toMatchSnapshot();
expect(page.getByText('C#')).toBeDefined();
await page.getByRole('button', { name: 'Close expanded response area' }).click();
});
});
Loading