-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
23 changed files
with
209 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,40 @@ | ||
name: e2e | ||
on: | ||
push: | ||
# pending | ||
branches-ignore: | ||
- '**' | ||
|
||
jobs: | ||
build-storybook: | ||
run-e2e-tests: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: setup | ||
- name: setup python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: "3.12" | ||
- name: setup node | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: "16" | ||
|
||
- name: cache | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
node_modules | ||
key: ${{ runner.os }}-${{ hashFiles('**/yarn.lock') }} | ||
- name: build | ||
|
||
- name: install | ||
run: | | ||
yarn install | ||
yarn run build-storybook | ||
- name: upload storybook | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: storybook | ||
path: ${{ github.workspace }}/storybook-static | ||
retention-days: 1 | ||
npx playwright install --with-deps | ||
- name: build | ||
run: yarn run build-storybook | ||
|
||
- name: run server | ||
run: | | ||
python -m http.server 5233 --directory "${{ github.workspace }}/storybook-static" & | ||
run-e2e-tests: | ||
needs: [build-storybook] | ||
runs-on: ubuntu-latest | ||
services: | ||
nginx: | ||
image: nginx:1.23.2 | ||
ports: | ||
- 5233:80 | ||
volumes: | ||
- ${{ github.workspace }}/storybook-static:/usr/share/nginx/html/ | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- uses: actions/download-artifact@v3 | ||
id: storybook | ||
with: | ||
name: storybook | ||
path: ${{ github.workspace }}/storybook-static | ||
- run: chmod -R 777 ${{ github.workspace }}/storybook-static/ | ||
- name: test | ||
run: ls -l storybook-static | ||
- name: test2 | ||
run: curl http://localhost:5233/?path=/story/basic--small | ||
run: yarn e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -22,4 +22,4 @@ jobs: | |
yarn install | ||
- name: test | ||
run: | | ||
yarn test | ||
yarn jest |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -107,3 +107,6 @@ typings/ | |
stories/ | ||
storybook-static/ | ||
.idea | ||
|
||
# Playwright | ||
test-results/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
*.spec.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('cell value', async ({ page }) => { | ||
await page.goto('http://localhost:5233/iframe.html?id=basic--small&viewMode=story'); | ||
const b2 = page.locator("[data-address='B2']"); | ||
expect(await b2.locator('.gs-cell-rendered').textContent()).toContain('b2'); | ||
|
||
const b3 = page.locator("[data-address='B3']"); | ||
expect(await b3.locator('.gs-cell-rendered').textContent()).toBe(''); | ||
|
||
await b3.dblclick(); | ||
const editor = page.locator('.gs-editor textarea'); | ||
await editor.fill('b3'); | ||
await editor.blur(); | ||
expect(await b3.locator('.gs-cell-rendered').textContent()).toBe('b3'); | ||
}); | ||
|
||
test('pointing', async ({ page }) => { | ||
await page.goto('http://localhost:5233/iframe.html?id=basic--small&viewMode=story'); | ||
const b2 = page.locator("[data-address='B2']"); | ||
await b2.click(); | ||
|
||
const address = page.locator('.gs-selecting-address'); | ||
expect(await address.textContent()).toBe('B2'); | ||
|
||
const largeEditor = page.locator('.gs-formula-bar textarea'); | ||
expect(await largeEditor.inputValue()).toBe('b2'); | ||
|
||
expect(await b2.getAttribute('class')).toContain('gs-pointed'); | ||
|
||
const hor = page.locator(".gs-header-horizontal[data-x='2']"); | ||
expect(await hor.getAttribute('class')).toContain('gs-pointed'); | ||
|
||
const ver = page.locator(".gs-header-vertical[data-y='2']"); | ||
expect(await ver.getAttribute('class')).toContain('gs-pointed'); | ||
|
||
const b3 = page.locator("[data-address='B3']"); | ||
expect(await b3.getAttribute('class')).not.toContain('gs-pointed'); | ||
|
||
}); | ||
|
||
test('walk', async ({ page }) => { | ||
await page.goto('http://localhost:5233/iframe.html?id=basic--small&viewMode=story'); | ||
const a1 = page.locator("[data-address='A1']"); | ||
await a1.click(); | ||
|
||
const address = page.locator('.gs-selecting-address'); | ||
expect(await address.textContent()).toBe('A1'); | ||
const editor = page.locator('.gs-editor textarea'); | ||
await editor.press('ArrowDown'); | ||
expect(await address.textContent()).toBe('A2'); | ||
await editor.press('Enter'); // editing | ||
await editor.press('Enter'); // commit | ||
expect(await address.textContent()).toBe('A3'); | ||
await editor.press('Tab'); | ||
expect(await address.textContent()).toBe('B3'); | ||
await editor.press('ArrowRight'); | ||
expect(await address.textContent()).toBe('C3'); | ||
await editor.press('ArrowRight'); | ||
expect(await address.textContent()).toBe('C3'); | ||
await editor.press('ArrowUp'); | ||
expect(await address.textContent()).toBe('C2'); | ||
await editor.press('ArrowLeft'); | ||
expect(await address.textContent()).toBe('B2'); | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
import { test, expect } from '@playwright/test'; | ||
|
||
test('render', async ({ page }) => { | ||
await page.goto('http://localhost:5233/iframe.html?id=sheets--multiple-sheet&viewMode=story'); | ||
const sheet1 = page.locator('[data-sheet-name="Sheet1"]'); | ||
const a11 = sheet1.locator("[data-address='A1']"); | ||
const a21 = sheet1.locator("[data-address='A2']"); | ||
const a31 = sheet1.locator("[data-address='A3']"); | ||
const b11 = sheet1.locator("[data-address='B1']"); | ||
|
||
expect(await a11.locator('.gs-cell-rendered').textContent()).toBe('150'); | ||
expect(await a21.locator('.gs-cell-rendered').textContent()).toBe('1230'); | ||
expect(await a31.locator('.gs-cell-rendered').textContent()).toBe('1555'); | ||
expect(await b11.locator('.gs-cell-rendered').textContent()).toBe('#REF!'); | ||
|
||
// raw A1 | ||
const largeEditor1 = sheet1.locator('.gs-formula-bar textarea'); | ||
expect(await largeEditor1.inputValue()).toBe('=Sheet2!A1+100'); | ||
|
||
// update sheet2 | ||
const sheet2 = page.locator('[data-sheet-name="Sheet2"]'); | ||
const editor2 = sheet2.locator('.gs-editor textarea'); | ||
const a12 = sheet2.locator("[data-address='A1']"); | ||
await a12.dblclick(); | ||
await editor2.fill('500'); | ||
await editor2.blur(); | ||
expect(await a11.locator('.gs-cell-rendered').textContent()).toBe('600'); | ||
|
||
// update sheet3 | ||
const sheet3 = page.locator('[data-sheet-name="Sheet 3"]'); | ||
const editor3 = sheet3.locator('.gs-editor textarea'); | ||
const a13 = sheet3.locator("[data-address='A1']"); | ||
await a13.dblclick(); | ||
await editor3.fill('777'); | ||
await editor3.blur(); | ||
expect(await a31.locator('.gs-cell-rendered').textContent()).toBe('1777'); | ||
|
||
const input3 = page.locator('#input3'); | ||
await input3.fill('Sheet 3a'); | ||
|
||
await a31.click(); | ||
expect(await largeEditor1.inputValue()).toBe("='Sheet 3a'!A1 + 1000"); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { defineConfig } from '@playwright/test'; | ||
|
||
export default defineConfig({ | ||
use: { | ||
trace: 'on-first-retry', | ||
video: 'on', | ||
launchOptions: { | ||
slowMo: 200, | ||
}, | ||
}, | ||
timeout: 100000, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.